Gwt i18n> generates property files

I use GWT in my materials, and I would like to do this, international, so I use the GWT constant method.

I have a java file with default settings, and now I need to make property files.

Remember that there is a special thing (or done automatically) to generate a kind of template in which all constants are created with empty labels for other languages.

Did I dream it?

(using eclipse indigo to develop webapp with gwt but not gae)

[edit:]

This was not a dream, this is i18ncreator:

http://code.google.com/intl/fr-FR/webtoolkit/doc/latest/RefCommandLineTools.html#i18nCreator

but I can not get it to work with windows: - (

[edit again]

due to this problem: http://code.google.com/p/google-web-toolkit/issues/detail?id=5113

Recommended Solution

is using i18ncreator in gwt 1.7 (!)

+4
source share
4 answers

In my project, I used i18n-Creator

http://code.google.com/webtoolkit/doc/latest/DevGuideI18n.html#DevGuidePropertiesFiles

This is similar to what you are asking. With the i18n creator, you create property files for different locales and run a script that is generated using i18n-creator, and it will generate a constant interface.

+1
source

you should see the locale page in GWT

+2
source

I had the same problem. I looked everywhere at the answer, but could not find the answer; either in documents or in stackoverflow.

So I asked in the GWT channel for gitter and I was told to use the compiler argument

-extra <destination-folder-name>

to create .properties from interface files.

Steps in eclipse:

  • Select the project you want to compile
  • [right click] β†’ Google β†’ GWT Compilation
  • In the window that opens, open the Advanded options.
  • Add the following optional compiler argument -extra <destination-folder-name>
  • Compile

setting compiler option in eclipse to create additional files

This should generate *.properties in /destination-folder-name .

NOTE. . This only generates .properties . It does not actually compile the application with all the locales for deployment.

  1. Move MyInterfaceExtension_*.properties MyInterfaceExtension.java next to MyInterfaceExtension.java .

  2. Make copies for each locale, i.e. MyInterfaceExtension_fr_CA.properties , MyInterfaceExtension_fr_FR.properties , etc.

  3. Translate to them

  4. Then start the compilation process with the option -extra <destination-folder-name> . Because he is no longer needed.

This will compile with all the locales you have enabled. Now you can deploy the application in the usual way.

Quick Tips:

When compiling for the first time, to generate a .properties file, I commented on the locales in the module definition file so that the compiler does not sit and compiles again and again for each browser and each language standard

i.e. supported_browser_count x enabled_locale_count = 5 browsers x 3 locales = 15 compilation Permutations that increase compilation time.

Because I needed only one *_en.properties file.

For the second compilation, after copying and translating the properties files for each locale, you need to include all the locales that you want to maintain and compile.

Loans:

  • github @ niloc132: Colin Alworth
  • github @ibaca: Ignacio Baca Moreno-Torres

To help me with this.

+2
source

I have not heard about this function in Eclipse yet, but IntelliJ IDEA has this function, you just create the Constants interface class and properties file. If you add a method to a class file, it will warn you about adding a property or vice versa. NTN.

0
source

Source: https://habr.com/ru/post/1391608/


All Articles