I want to ask a question related to i18n in GWT.
I have a web application which uses UIBinding, I followed online instructions and successfully made the UIBinder i18n. The property generated by the GWT compiler is put into a directory of:
src/main/java/com/google/gwt/i18n/client/LocalizableResource_en.properties
src/main/java/com/google/gwt/i18n/client/LocalizableResource_de.properties
src/main/java/com/google/gwt/i18n/client/LocalizableResource_es.properties
I can therefore in the web app switch language by specifying "&locale=de" in the query string of URL.
Here is the problem. I have some other string that cannot be fit into UiBinder. They are decided at runtime and therefore needs to be read dynamically. For example, given a file, I need to workout its file type and display the file type in the proper language and display something like:
mytextfile.txt -> "TEXT"
The word "TEXT" needs to be change depends on language. Because the I get the file from server and could be any file, I cannot statically bind the "TEXT" into any translation key.
Question 1: How can I do this in UiBinder?
I understand I can do this without using UIBinder. I can use a class that extends Constants and create getter method to read i18n property files. However, the question is that in the property files above, the string key is a MD5 string. This is generated by GWT compiler. For those properties that are not in the UiBinder, there is no equivalent MD5 with it. How can I place them in the property file?
Will my property file look something like this:
952D2C56D0485958336747BCDD98590D=Hello
Apology=Sorry
the first property is used in UIBinder and the second one is used dynamically.
QUESTION 2: Is there any chance I can avoid this hybrid way of mixing properties? Either uses separate property files or something else.
QUESTION 3 : Another question is that: The property file is currently named as above. This is because some online material says GWT will automatically pick the property file in:
com/google/gwt/i18n/client/
and the filename
LocalizableResource_xxxx.properties
Is it possible for me to put this property file in the Maven's standard resource directory and tells GWT to find there?
Many thanks.