Commit e6996ff17b1f7848efac151d99cf80af061cad07
- Diff rendering mode:
- inline
- side by side
ChangeLog
(29 / 0)
|   | |||
| 1 | 2012-01-26 Murray Cumming <murrayc@murrayc.com> | ||
| 2 | |||
| 3 | Internationalize the UI strings. | ||
| 4 | |||
| 5 | * pom.xml: gwt-maven-plugin: Add the i18n goal and specify a | ||
| 6 | <i18nConstantsBundle>, removing the unused <i18nMessagesBundle>. | ||
| 7 | * src/main/resources/org/glom/web/client/Messages.properties: Remove this | ||
| 8 | because it is unused. Messages are apparently strings that can have | ||
| 9 | parameters, but we do not need that yet, so Contants will be enough for now. | ||
| 10 | * src/main/java/org/glom/web/OnlineGlom.gwt.xml: Add extend-property lines | ||
| 11 | to say that we support the en and de locales. | ||
| 12 | * src/main/resources/org/glom/web/client/ui/OnlineGlomConstants.properties: | ||
| 13 | The original English strings. | ||
| 14 | * src/main/resources/org/glom/web/client/ui/OnlineGlomConstants_de.properties: | ||
| 15 | Some German translations of the English strings. | ||
| 16 | The i18n goal then uses the .properties file to generate an | ||
| 17 | OnlineGlomConstants.java file in target/ and somehow GWT.create() magically | ||
| 18 | returns an implementation that returns the translated strings. | ||
| 19 | The documentation suggests putting these in src/java/*/client/, but it seems | ||
| 20 | best to put it in src/resources/*/client/. | ||
| 21 | * src/main/java/org/glom/web/client/ui/TableSelectionViewImpl.java: | ||
| 22 | Instantiate OnlineGlomConstants via GWT.create() and use it to get the strings | ||
| 23 | instead of hard-coding them. | ||
| 24 | Note that we cannot import OnlineGlomConstants because it does not exist yet, | ||
| 25 | but that does not seem to stop the build, though it confuses Eclipse. | ||
| 26 | |||
| 27 | You can see the translated string by adding ?locale=de to the URL, like so: | ||
| 28 | http://127.0.0.1:8888/OnlineGlom.html?gwt.codesvr=127.0.0.1:9997?locale=de#list:document=film_manager | ||
| 29 | |||
| 1 | 30 | 2012-01-24 Murray Cumming <murrayc@murrayc.com> | |
| 2 | 31 | ||
| 3 | 32 | Improve null/empty String checks. |
pom.xml
(4 / 1)
|   | |||
| 138 | 138 | <executions> | |
| 139 | 139 | <execution> | |
| 140 | 140 | <goals> | |
| 141 | <goal>i18n</goal> | ||
| 141 | 142 | <goal>compile</goal> | |
| 142 | 143 | <goal>test</goal> | |
| 143 | 144 | </goals> | |
| … | … | ||
| 149 | 149 | <configuration> | |
| 150 | 150 | <runTarget>OnlineGlom.html</runTarget> | |
| 151 | 151 | <hostedWebapp>${webappDirectory}</hostedWebapp> | |
| 152 | <i18nMessagesBundle>org.glom.web.client.Messages</i18nMessagesBundle> | ||
| 152 | <i18nConstantsBundles> | ||
| 153 | <i18nConstantsBundle>org.glom.web.client.ui.OnlineGlomConstants</i18nConstantsBundle> | ||
| 154 | </i18nConstantsBundles> | ||
| 153 | 155 | </configuration> | |
| 154 | 156 | </plugin> | |
| 155 | 157 |
|   | |||
| 28 | 28 | ||
| 29 | 29 | <!-- Use the GWT internationalization framework --> | |
| 30 | 30 | <inherits name="com.google.gwt.i18n.I18N"/> | |
| 31 | <extend-property name="locale" values="en"/> | ||
| 32 | <extend-property name="locale" values="de"/> | ||
| 31 | 33 | ||
| 32 | 34 | </module> |
|   | |||
| 23 | 23 | ||
| 24 | 24 | import org.glom.web.client.place.ListPlace; | |
| 25 | 25 | ||
| 26 | import com.google.gwt.core.client.GWT; | ||
| 26 | 27 | import com.google.gwt.event.dom.client.ClickEvent; | |
| 27 | 28 | import com.google.gwt.event.dom.client.ClickHandler; | |
| 28 | 29 | import com.google.gwt.event.dom.client.HasChangeHandlers; | |
| … | … | ||
| 41 | 41 | */ | |
| 42 | 42 | public class TableSelectionViewImpl extends Composite implements TableSelectionView { | |
| 43 | 43 | ||
| 44 | // OnlineGlomConstants.java is generated in the target/ directory, | ||
| 45 | // from OnlineGlomConstants.properties | ||
| 46 | // by the gwt-maven-plugin's i18n (mvn:i18n) goal. | ||
| 47 | private OnlineGlomConstants constants = GWT.create(OnlineGlomConstants.class); | ||
| 48 | |||
| 44 | 49 | Label documentTitleLabel = new Label(); | |
| 45 | 50 | ListBox tablesChooser = new ListBox(); | |
| 46 | 51 | ||
| 47 | Label searchLabel = new Label("Search"); | ||
| 52 | Label searchLabel = new Label(constants.search()); | ||
| 48 | 53 | TextBox searchTextBox = new TextBox(); | |
| 49 | 54 | ||
| 50 | 55 | ListBox localesChooser = new ListBox(); | |
| 51 | 56 | ||
| 52 | Anchor backLink = new Anchor("Back to List"); | ||
| 57 | Anchor backLink = new Anchor(constants.backToList()); | ||
| 53 | 58 | private Presenter presenter; | |
| 54 | 59 | private HandlerRegistration backLinkHandlerReg; | |
| 55 | 60 |
|   | |||
| 1 | # TODO: implement | ||
| 2 | dropBoxLabel = Table Name |
|   | |||
| 1 | #Human-visible strings to be translated in language specific versions of this property file | ||
| 2 | search = Search | ||
| 3 | backToList = Back to List |
|   | |||
| 1 | search = Suche | ||
| 2 | backToList = Back To List |

