Peter
Peter

Reputation: 45

Multiple locale GWT not working

I want to localize my GWT project to more laguages so I added to my module.gwt.xml this section `

<inherits name="com.google.gwt.i18n.I18N" /> 
<extend-property name="locale" values="en" />
<extend-property name="locale" values="cs" />

I created all the properties files and interfaces but after loading module I get this exception.

        00:00:02,960 [WARN] Unable to get locale properties, using defaults
    com.google.gwt.core.ext.BadPropertyValueException: Property 'locale' cannot be set to unexpected value '<failed to compute>'

Any idea where can be the problem? Because when I have just one locale for example

<inherits name="com.google.gwt.i18n.I18N" /> 
<extend-property name="locale" values="en" />

it works fine. I tried to add to avoid generating permutations for default locale but this even doesn`t work

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

Upvotes: 2

Views: 3715

Answers (4)

mp31415
mp31415

Reputation: 6689

I had a similar situation. I commented out locales in gwt.xml to speed up compilation process and that obviously made all locales other than English unavailable. Then when I decided to test more than one locale and uncommented locales in gwt.xml I got the same error as posted in the question (in dev mode). Only when I recompiled the project again with all locales available the error went away.

Upvotes: 0

Colin Alworth
Colin Alworth

Reputation: 18356

If the page loads without specifying a locale through the supported mechanisms (meta tag, url param, see http://code.google.com/webtoolkit/doc/latest/DevGuideI18nLocale.html#LocaleSpecifying for more details on how these are accomplished), it will try to fall back on a default. For that reason, you must specify a default locale to fall back on, or you get an error, as the app can't load without selecting a locale.

Set a default locale like this (from http://code.google.com/webtoolkit/doc/latest/DevGuideI18nLocale.html#LocaleDefault):

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

If your page will always load with a default, there is no need to provide a fallback. But for testing purposes, you may find it helpful to always use one.

Upvotes: 1

Yusuf K.
Yusuf K.

Reputation: 4260

Excuse me, As Marcelo said did you try below code.

<inherits name="com.google.gwt.i18n.I18N" /> 
<extend-property name="locale" values="en_US, cs_CZ" />

Could you try above code?

Source

You could find locale values here

Upvotes: 0

Marcelo
Marcelo

Reputation: 4608

Try

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

Upvotes: 2

Related Questions