Hi!
In MessageFormatter, you have a way to use conditionals (see ICU docs
here:
http://icu-project.org/apiref/icu4c/classMessageFormat.html#_details)
which may allow you to do correct plurals. Of course, you would still
have to supply the correct words (room/rooms, etc.) in the format.
Thank you answer.
I would have one more question, which is a little more theoretically.
Currently I see two direction providing proper plural handling and
actually I am not sure which one should be better to use.
So I am curious what others think about this, and can offer some more
thing which I should consider, and what helps me to make a better decision.
1.) Gettext way: I call a format_plural($count, '1 comment', '$count
comments'), and this function can handle special cases (for example
Russian), and the given language file can store multiple plural format.
2.) "All-in-one" way: only one string belongs to one string id, and this
string holds the different versions of the given word/sentence, and the
rules too on which we can decide which version should be used. For example:
"[0]No comment.|[1]1 comment.|[2,]$count comments."
Actually I like the second way, why it is more flexible, but I am not
sure if this flexibility worth. And I like the possibility that you can
handle the "0 case" in one place.
But I have some problems with this approach too (I feel that it is a
little programmer centric).
o Maybe the most obvious one is that the rules are repeated in every
entry and the fact that the rules belongs to the language not to an
entry (so the data model is a little strange, it holds some redundancy).
o My other problem is that for this structure it would be not easy to
create a logical/usable user interface for translating.
o Or what is if I want to export my master language to XLIFF format,
will a translator able handle this approach and create a proper translation?
I will really appreciate your comments about this topic, I have no work
experience yet with it.
TIA!
Best Regards,
Felhő
--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php