Monday, December 30, 2013

Re: Completely lost at internationalization (i18n)

On Monday, December 23, 2013 11:24:20 PM UTC+1, Qunit wrote:
I'm completely stumped on I18n. Any help would be greatly appreciated. Here's my info:
- Using mvn 3.0.5
- Using uiBinder
- GWT 2.5.1 with GWTBootstrap
- Eclipse 4.2 with maven integration

All working, except when trying to add I18n for dutch (nl, default) and english (en)

Part of .gwt.xml

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

That last line is saying that only "nl" locale will actually be compiled. You probably want value="nl,en", though I've been told that removing the 'default' locale might break a few things (haven't personally noticed anything though).
Example part of uiBinder:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ui:UiBinder SYSTEM "">
<ui:UiBinder xmlns:ui=""

You disabled the 'default' locale, so maybe you'll want ui:generateLocales="en, nl"

…or maybe you meant ui:defaultLocale="en" ? (equivalent to @DefaultLocale)

<b:Container ui:field="signupContainer">
<b:Paragraph><ui:msg description="Enter user details">Please enter your details to signup</ui:msg></b:Paragraph>

Part of pom.xml:


According to some documentation I should be able to generate property files using mvn install or mvn gwt:i18n.

"mvn gwt:i18n" is about generating interfaces from existing .properties files (from your src/main/resources folder), so it's not what you want here.

However doing that results in errors/warnings the the com.mongoasis.presentation.i18n.Messages file could not be found.

This is probably because gwt:i18n cannot find a com/mongoasis/presentation/i18n/ file in src/main/resources (that's the name you gave in i18nMessagesBundle, which is a configuration property for the gwt:i18n goal).
Because of that error, your build fails and the GWT compiler (that would generate properties files from your UiBinder templates) is not run (gwt:i18n runs a generate-sources while gwt:compile runs at prepare-package, which is much later in the Maven lifecycle)

So I create it manually after which it complains that it is ampty. Adding random key-value pairs stops the error message, but nowhere I find MD5 hashed properties to fill in. Event specifying the key manually does not result in the text being replaced with any translated text.

I'm felling lost and alone in a dark world... Who enlightens me?

First, don't use gwt:i18n unless you know you need it. It's only useful for a few specific cases, and even more-specific cases if you consider binding it to the build lifecycle.

The gwt:compile should then generate properties files the <extra> folder (which defaults to target/extra). You'll have to copy those files to your src/main/resources (keeping the same folder hierarchy and file name, possibly making copies for the different locales) and then tweak them. In the subsequent calls to gwt:compile, GWT will use them as sources so the correct translations will appear in the generated JavaScript code. You'll only see the result in DevMode or once compiled to JS.

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment