I spent a couple of fruitless hours yesterday trying to get plurals to
work the way I wanted them to with the new Plural API. After digging
through the source code (never a good sign) I discovered that I have
to accept GWT's notion that '0' is a plural in the English language.
Really? Zero? None?
Technically, yes, none is plural: there is one egg, there are two
eggs, there are no eggs. However, I wanted this kind of messaging:
Found 1 result.
Found 23 results.
No results found.
With the Plural API, I found myself writing my own PluralRule so I
could trigger the magical DefaultRule_0_1_n class myself. This is not
to mention that it never worked--GWT would not pick up that rule no
matter what DefaultLocale I picked.
So this morning over my cappuccino I came to the conclusion that GWT
is mistakenly joined two concerns that should not be joined, namely
Plurals and L10N. Instead of being fused together, it makes more sense
for Plurals to use the resource bundles, but for the definition of
what plurals to use for a given string should be controlled by how one
defines the resource. I'd love this:
public String resultsCount(@PluralText int count);
//in props file:
resultsCount = Found {0} results
resultsCount[0] = No results found
resultsCount[1] = Found 1 result
And then; in the same files:
public String shots(@PluralText int count)
shots = {0}-shot espresso
shots[0] = Steamed milk?
shots[1] = Single espresso
shots[2] = Double espresso
shots[3] = Triple espresso
shots[4] = Quad me baby!
You see, I have different ideas in different contexts as to what the
plurals should be.
I may or may not have these same ideas given a different language, but
that that property file can be different. That's a separate concern
and should be dealt with separately.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---