user405458
user405458

Reputation: 1137

GWT:Locale does not change?

To make my GWT application internationalizable, I created a message interface as follows:

@DefaultLocale("fr")
@Generate(format =
   { "com.google.gwt.i18n.rebind.format.PropertiesFormat" }, fileName = "Messages", locales =
   { "fr", "en" })
public interface MessageResources extends Messages
{

   public static final MessageResources MR = GWT.create(MessageResources.class);

   @DefaultMessage("Identifiant")
   public String login();

   @DefaultMessage("Mot de passe")
   public String password();
}

Then I configured my project to support the English and French as follow:

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

I compiled my project with the option -extra extra, and I copied the two files. properties in the same package as the interface. But when I run my application the parameter ?Locale=en has no effect and the application remains in French!

Upvotes: 1

Views: 520

Answers (1)

Thomas Broyer
Thomas Broyer

Reputation: 64541

The properties files are read at compile-time, so you have to re-compile (GWT compile) each time you modify them.

The first compilation with -extra is only a "help" in generating a "skeleton" properties file; you could have written it by yourself (provided you know what to put in there).

Oh, and BTW, it's locale=en, not Locale=en (lowercase L)

Upvotes: 1

Related Questions