|
DevGuidePropertiesFiles
How to create localized properties files for use with Constants or Messages
Localized Properties FilesStatic string internationalization uses traditional Java .properties files to manage translating tags into localized values. These files may be placed into the same package as your main module class. They must be placed in the same package as their corresponding Constants/Messages subinterface definition file. Tip: Use the i18nCreator script to get started. $PP_OFF $ i18nCreator -eclipse Foo com.example.foo.client.FooConstants Created file src/com/example/foo/client/FooConstants.properties Created file FooConstants-i18n.launch Created file FooConstants-i18n
Both Constants and Messages use traditional Java properties files, with one notable difference: properties files used with GWT should be encoded as UTF-8 and may contain Unicode characters directly, avoiding the need for native2ascii. See the API documentation for the above interfaces for examples and formatting details. Many thanks to the Tapestry project for solving the problem of reading UTF-8 properties files in Tapestry's LocalizedProperties class. In order to use internationalized characters, make sure that your host HTML file contains the charset=utf8 content type in the meta tag in the header: <meta http-equiv="content-type" content="text/html;charset=utf-8" /> You must also insure that all relevant source and .properties files are set to be the UTF-8 charset in your IDE. See Also |
Sign in to add a comment