[errai-dev] Errai UI and i18n

Eric Wittmann eric.wittmann at redhat.com
Mon Mar 25 12:40:35 EDT 2013


Hello everyone.  I'm finally putting hands to keyboard on this, and am 
making some progress figuring out how a lot of the code generation works 
in Errai.  It's a bit slow going for me, but it gets easier every...hour. :)

Anyway, the first aspect of this that I'm tackling is the creation and 
inclusion of the message bundle file.  We tentatively decided to use the 
standard resource loading mechanism in GWT (the same thing the template 
system uses) to load the message bundle.  I'm hoping that we'll 
eventually have something that will work either statically or 
dynamically (giving devs that option).  But for now I'm sticking with 
static loading of the bundle file.

Here are some initial decisions:

1) You active i18n support in your module by annotating your @EntryPoint 
with @Bundle, providing the name of the bundle resource in the @Bundle 
annotation.
2) Each GWT module has at most one i18n message bundle.
3) The bundle resource is a JSON formatted file.  No one likes 
Properties files, and browsers are pretty darn good at processing JSON I 
imagine.  That said, I'm certainly open to changing this.
4) The bundle file can have any name, as long as it has a .json extension.
5) Localized versions of the bundle file look like this:
   * MyAppBundle.json
   * MyAppBundle_en_US.json
   * MyAppBundle_de_DE.json
   * MyAppBundle_zh_CN.json

Some questions:
A) How do I locate the translation files at compile time?  Logically the 
package containing MyAppBundle.json should be scanned for all resources 
matching MyAppBundle_*_*.json.  Any thoughts on the best way to actually 
accomplish that?

I thought I had more questions than that... :)

Thinking ahead (not planning on this in the short term) there's a way to 
hold up app initialization until async data is pulled down, right?  I 
saw a voting system in there.  For the optional "I want to pull down 
translation files asyncronously" feature, can the EntryPoint vote "no" 
to the initialization until it's done pulling down the bundle?

-Eric


More information about the errai-dev mailing list