Locale specification in *.gwt.xml file

653 views
Skip to first unread message

Constantin Tanno

unread,
Oct 13, 2010, 9:53:09 PM10/13/10
to Google Web Toolkit
Our application.gwt.xml file contains this:

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

What I want to do is to tell GWT that a) there is only ONE locale
supported, b) it is "en", and c) it - "en" - is the default locale.

However, when I configure the file like this,
LocaleInfo.getAvailableLocaleNames() returns two locales: “default”
and “en”, and I can tell that GWT is compiling two locale
permutations.

I know I can fix this by just running the app in the default locale,
but the GWT docs specifically recommend NOT doing this, see
http://code.google.com/webtoolkit/doc/latest/DevGuideI18nLocale.html.

So, how do I fix this?
Thanks,
Constantin

Thomas Broyer

unread,
Oct 14, 2010, 9:27:01 AM10/14/10
to Google Web Toolkit


On 14 oct, 03:53, Constantin Tanno <constantin.ta...@gmail.com> wrote:
> Our application.gwt.xml file contains this:
>
> <extend-property name="locale" values="en"/>
> <set-property-fallback name="locale" value="en"/>
>
> What I want to do is to tell GWT that a) there is only ONE locale
> supported, b) it is "en", and c) it - "en" - is the default locale.
>
> However, when I configure the file like this,
> LocaleInfo.getAvailableLocaleNames() returns two locales: “default”
> and “en”, and I can tell that GWT is compiling two locale
> permutations.
>
> I know I can fix this by just running the app in the default locale,
> but the GWT docs specifically recommend NOT doing this, seehttp://code.google.com/webtoolkit/doc/latest/DevGuideI18nLocale.html.
>
> So, how do I fix this?

Add <set-property name="locale" value="en" /> to only support the "en"
locale.

Constantin Tanno

unread,
Oct 14, 2010, 3:09:38 PM10/14/10
to Google Web Toolkit
Thomas - Thanks for the answer, but it doesn't work. I created a
simple test project with one class. Here's the module.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='localetest'>
<inherits name='com.google.gwt.user.User'/>

<inherits name='com.google.gwt.user.theme.standard.Standard'/>

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

<entry-point class='com.aravo.localetest.client.LocaleTest'/>

<source path='client'/>
<source path='shared'/>

</module>

Here's the client code:

package com.aravo.localetest.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;

public class LocaleTest implements EntryPoint
{
public void onModuleLoad()
{
RootPanel.get().add(new Label("Locales:"));
String[] locales = LocaleInfo.getAvailableLocaleNames();
for (String locale : locales)
{
RootPanel.get().add(new Label(locale.toString()));
}
}
}

When I run this, the UI still prints out:

Locales:
default
en

In other words, I still get two locales, default and en. I just want
one.

I tried to remove the <extend-property name="locale" values="en"/> in
the XML file, but then I get an error from GWT saying:

Unexpected exception while processing element set-property - the value
"en" was not previously defined.
Reply all
Reply to author
Forward
0 new messages