问题描述:

When I do

<set-property name="user.agent" value="ie9,gecko1_8,safari,opera" />

the compiler does 4 permutations;

But adding :

<set-property name="user.agent" value="ie9,gecko1_8,safari,opera" />

<extend-property name="locale" values="nl" />

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

<collapse-property name="locale" values="en*" />

<collapse-property name="locale" values="nl*" />

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

I see 48 permutations. But I would expect 4 * 2 = 8 permutations.

What are the 48 permutations and/or is there a way to instruct the compiler to show what the permutations represent during the compilation process ?

I also have this in my module <inherits name="com.google.gwt.i18n.CldrLocales" />

*UPDATE* : This change gives 56 permutations

<extend-property name="locale" values="nl_NL" />

<extend-property name="locale" values="nl_BE" />

<extend-property name="locale" values="en_GB" />

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

<set-property name="user.agent" value="ie9,gecko1_8,safari,opera" />

It still is not clear to how the compiler gets to this number ?

网友答案:

This comment from Thomas revealed the solution :

you should have <set-property name="locale" value="en,nl"/> or you'll still have the default locale even though you'll never use it.

So modified to :

<extend-property name="locale" values="nl_NL" />
<extend-property name="locale" values="nl_BE" />
<extend-property name="locale" values="en_GB" />
<set-property name="locale" value="en_GB,nl_NL,nl_BE"/>
<!-- <collapse-property name="locale" values="en*" /> <collapse-property 
    name="locale" values="nl*" /> -->
<set-property-fallback name="locale" value="en_GB" />

=> 12 permutations, as expected from 4 (browsers) * 3 (lang/country) = 12 permutations

网友答案:

I guess you ran in to this issue.

It seems its producing permutations for all countries(?).

For cases where the translated values are the same, but you still want country-specific details, you can use runtime locales to reduce the number of compiled permutations, but still get country-specific details like the default currency, number/date formatting rules, etc.

As an example, you might have one set of translations for all of Spanish as spoken in Latin America (es_419), yet allow users to choose a country-specific locale such as Argentinian Spanish (es_AR).

Read Runtime LocaleSpecifying

相关阅读:
Top