From f95d9522616ad1c7c5ed7c31400ae3afdb17368f Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 2 Oct 2015 15:37:17 +0000 Subject: [PATCH] Added i18N support git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-wizard-widget@119350 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../wizardwidget/client/WizardMessages.java | 24 ++++++++ .../td/wizardwidget/client/WizardWindow.java | 15 ++--- .../user/td/wizardwidget/Wizard.gwt.xml | 56 +++++++++++-------- .../wizardwidget/client/Messages.properties | 2 - .../client/Messages_fr.properties | 2 - .../client/WizardMessages.properties | 3 + .../client/WizardMessages_es.properties | 3 + .../client/WizardMessages_it.properties | 3 + 8 files changed, 75 insertions(+), 33 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages.java delete mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages.properties delete mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages_fr.properties create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages.properties create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages_es.properties create mode 100644 src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages_it.properties diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages.java new file mode 100644 index 0000000..22d0bdf --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages.java @@ -0,0 +1,24 @@ +package org.gcube.portlets.user.td.wizardwidget.client; + +import com.google.gwt.i18n.client.Messages; + +/** + * + * @author giancarlo + * email: g.panichi@isti.cnr.it + * + */ +public interface WizardMessages extends Messages { + + // + @DefaultMessage("Back") + String buttonBackLabel(); + + @DefaultMessage("Next") + String buttonNextLabel(); + + @DefaultMessage("Finish") + String buttonFinishLabel(); + + +} diff --git a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardWindow.java b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardWindow.java index 401d72c..cb0e99e 100644 --- a/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardWindow.java +++ b/src/main/java/org/gcube/portlets/user/td/wizardwidget/client/WizardWindow.java @@ -11,9 +11,10 @@ import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.core.client.Callback; +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Element; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.user.client.Command; -import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.Event; import com.google.gwt.user.client.ui.Widget; import com.google.web.bindery.event.shared.EventBus; @@ -45,9 +46,6 @@ public class WizardWindow extends Window { protected String WIZARDHEIGHT = "520px"; protected boolean WIZARRESIZABLE = false; protected boolean WIZARDCOLLAPSIBLE = true; - protected String BUTTONBACKLABEL = "Back"; - protected String BUTTONNEXTLABEL = "Next"; - protected String BUTTONFINISHLABEL = "Finish"; protected String title; protected ArrayList cardStack = new ArrayList(); @@ -75,6 +73,7 @@ public class WizardWindow extends Window { protected ToolBar cardMoveToolBar; protected FillToolItem fillSpacingCardMoveToolBar; + protected WizardMessages msgs; /** * Create a new Wizard Window with the specified title. @@ -91,6 +90,8 @@ public class WizardWindow extends Window { super(); this.title = title; this.eventBus = eventBus; + this.msgs = GWT.create(WizardMessages.class); + initWindow(); listeners = new ArrayList(); @@ -103,7 +104,7 @@ public class WizardWindow extends Window { cardMoveToolBar.setSpacing(2); cardMoveToolBar.addStyleName(ThemeStyles.get().style().borderTop()); - backButton = new TextButton(BUTTONBACKLABEL); + backButton = new TextButton(msgs.buttonBackLabel()); backButton.setIcon(ResourceBundle.INSTANCE.wizardPrevious()); backButton.setIconAlign(IconAlign.LEFT); @@ -115,7 +116,7 @@ public class WizardWindow extends Window { cardMoveToolBar.add(fillSpacingCardMoveToolBar); - nextButton = new TextButton(BUTTONNEXTLABEL); + nextButton = new TextButton(msgs.buttonNextLabel()); nextButton.setIcon(ResourceBundle.INSTANCE.wizardNext()); nextButton.setIconAlign(IconAlign.RIGHT); nextButton.setTabIndex(1000); @@ -303,7 +304,7 @@ public class WizardWindow extends Window { * to it. */ public void setNextButtonToFinish() { - nextButton.setText(BUTTONFINISHLABEL); + nextButton.setText(msgs.buttonNextLabel()); nextButton.setIcon(ResourceBundle.INSTANCE.wizardGo()); nextButton.setIconAlign(IconAlign.RIGHT); nextButtonAction = new Command() { diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/Wizard.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/Wizard.gwt.xml index 57dce87..b8045ed 100644 --- a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/Wizard.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/Wizard.gwt.xml @@ -1,30 +1,42 @@ - - + + + - - - + + + - - - - - - + + + + + + - - - - - - - - + + + - - - + + + + + + + + + + diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages.properties b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages.properties deleted file mode 100644 index c222555..0000000 --- a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages.properties +++ /dev/null @@ -1,2 +0,0 @@ -sendButton = Send -nameField = Enter your name \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages_fr.properties b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages_fr.properties deleted file mode 100644 index b4a7627..0000000 --- a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/Messages_fr.properties +++ /dev/null @@ -1,2 +0,0 @@ -sendButton = Envoyer -nameField = Entrez votre nom \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages.properties b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages.properties new file mode 100644 index 0000000..5ee0b2a --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages.properties @@ -0,0 +1,3 @@ +buttonBackLabel = Back +buttonNextLabel = Next +buttonFinishLabel = Finish diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages_es.properties b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages_es.properties new file mode 100644 index 0000000..417ef73 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages_es.properties @@ -0,0 +1,3 @@ +buttonBackLabel = Volver +buttonNextLabel = Adelante +buttonFinishLabel = Final \ No newline at end of file diff --git a/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages_it.properties b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages_it.properties new file mode 100644 index 0000000..81b017a --- /dev/null +++ b/src/main/resources/org/gcube/portlets/user/td/wizardwidget/client/WizardMessages_it.properties @@ -0,0 +1,3 @@ +buttonBackLabel = Indietro +buttonNextLabel = Avanti +buttonFinishLabel = Fine \ No newline at end of file