Frage

I define the following locale in my module xml file:

<extend-property name="locale" values="en, en_US, en_GB"/>
<extend-property name="locale" values="de, de_DE" />    

How can I get only one permutation for en, en_US, en_GB and one permutation for de, de_DE?

War es hilfreich?

Lösung 2

Remove the country-specific versions, if you do not offer them as options to your users:

<extend-property name="locale" values="en"/>
<extend-property name="locale" values="de" />

To set the default locale:

<set-property-fallback name="locale" value="en"/>

Andere Tipps

The GWT way to merge permutations of different property values is called SoftPermutations:

<collapse-property name="locale" values="en, en_US, en_GB" />   
<collapse-property name="locale" values="de, de_DE" />   

EDITED

About the benefits of using all locales instead of selecting one per language, you take advantage of using all of those languages differences, what is very important for users.

Think that GWT includes a full i18n stack (based on CLDR) for internationalising numbers, dates, plurals, etc. and it is not the same to show an 'en' date-picker vs an 'en_GB' datepicker because Europeans use Monday as first day of week instead of Sunday.

The increment of javascript in your final permutation is not significant (very few KB), because only those slim differences have to be included, since most of the properties are shared between similar languages.

Of course you only have to translate your application once per language supported, for instance you write all your application messages in 'en' because 'en_GB' will fallback to 'en' when a message is not found, but you still maintain the option to change some messages if you need it.

What many people do with locale in GWT is to collapse all of them avoiding permutation explosion <collapse-property name="locale" values="*" /> and improving compilation times. You have the option to put that line out when you deliver your app for production which normally happens once per delivering cycle, and you can leave your CI server compiling all permutations.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top