Yup, this was a tough one.  Unfortunately I don't have an example in
my public code.  I'll try to get that added as it would have been
helpful to me when I was trying to figure this out.

I imagine this will end up being incomplete and as unhelpful as much
of the other info you can find.  But this does come from a working
example  And I might remember it all!  I'm using gwt 2.0.3.

In my build.xml I added '-extra extras" to the arguments for
com.google.gwt.dev.Compiler.  At gwt compile time that creates an
extras directory with a ./extras/<modulename>/
<UiBinderViewClass><MyInterfaceThatExtendsUiBinder>ImplGenMessages.properties
that contain my default locale properties.  To cause that to be
generated, you'll need the following.

In my UiBinder I have:
<ui:UiBinder
        xmlns:ui='urn:ui:com.google.gwt.uibinder'
        xmlns:g='urn:import:com.google.gwt.user.client.ui'
        
ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
 
ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"
        ui:generateLocales="default"
>
<...snip...>
<g:TextBox ui:field="myTextBox"><ui:msg description="Search
textbox">Find item with wildcard</ui:msg></g:TextBox>
<...snip...>

Compiling with the extras option creates a file called
   extras/<modulesname>/
com.myproject.client.mvp.FirstPageViewMyUiBinderImplGenMessages.properties
where FirstPageView is the name of my UiBinder view class and
MyUiBinder is my interface in FirstPageView that extends UiBinder.
(I'm using gwt-presenter so the code convention comes from that.)

The UiBinder g:TextBox node above causes a property to be created in
the properties file that looks like this:
# Description: Search textbox
2792A577EE221C4962C46BB4C49EBE6F=Find item with wildcard

Note where "description" and the body of my ui:msg tag show up.

In order to use this new properties file, I need to copy it to the
package that contains my UiBinder (keep the name the same).  Then make
a copy and append _de and _ja to the root filename.  Translate (I used
google translate until we can get some professional editing done).

In gwt.xml I needed     <extend-property name="locale" values="de,ja"/
>, for German and Japanese localizations.
Recompile.  You should get 2x more permutations during the compile.

Then to test add ?locale=de or ja to the url and translations just
show up!

I reviewed my code to write this although I didn't go through the
steps again.  Let us know what you run into.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to