[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][TOP]

Re: Fw: Re: IceWM gettextize patch


> IceWM のメール通知機能部分で、メールが1通なら "1 mail message"、
> 複数なら "2 mail messages" 等と表示されるところをいかに国際化するか、
> というお話しなんですが…各国語に対応できる一般解って、やっぱり無い
> んでしょうかね。
> 何かよいアイディアがありましたら、御教示ください。

  gnome-i18n ML で今年の始めくらいにこの手の話題がありました。

   Plurals in Gnumeric
   Survey (language specific i18n problems)

という Subject でいくらかスレッドがあったのですが、1 か 1より大きいか、
というだけじゃなく、

   n == 1
   n % 10 == 2,3,4
   n > 1 && n % 10 == 0,5,...,9

などのパターンが紹介されてました。
#mailing list のページの構成が変わって archvie がどっかいってしまった..

そして、
   
	if(count == 1 )
	    mesg = g_strdup_printf (_("Deleting row %d"), start_row);
	else {
	    if ( ( count < 20 && count > 4  )
		  || count%10 > 4
		  || count%10 == 0 )
		/* plural for n = 5-20, 25-30, 35-40, ...; preserve "(_pl_norm_)" */
		mesg = g_strdup_printf (_("(_pl_norm_)Deleting %d rows (%d:%d)") +11,
					count, start_row, start_row+count-1);
	    else if (count%10 == 1 )
		/* plural for n = 21,31,41, ...; preserve  "(_pl_1_)" */
		mesg = g_strdup_printf (_("(_pl_1_)Deleting %d rows (%d:%d)") +8 ,
					count, start_row, start_row+count-1);
	    else
		/*  plural for n = 2-4, 22-24, 32-34, ...; preserve "(_pl_234_)" */
		mesg = g_strdup_printf (_("(_pl_234_)Deleting %d rows (%d:%d)") +10,
					count, start_row, start_row+count-1);
	}         

といった感じで、_() に渡す文字列に一定の prefix を付け、それを prefix 
を付けたまま訳し、実際に表示する際には +n してそれを skip して、、といっ
た技や、

   A function returning a string selected from a format string based on an
   integer argument.  The format string takes the form:

   "value1#string1|value2#string2..."

   If the integer argument is less than value1, string1 is returned.

   If the integer argument is greater than or equal to valueN and less than
   valueN+1, stringN is returned.

   If the integer argument is greater than valueN, then stringN is returned.

   The string returned is malloc'ed by this function and must be freed by the
   caller.

ということをする関数はどうだ、という話が出ました。「plural」「i18n」と
いった単語で検索してみるといいかもしれません。他の i18n 作業の ML や、
Java のサイトなどでもこの手の話題は出ているかも。

  KUSANO Takayuki <URL:http://www.asahi-net.or.jp/~AE5T-KSN/>