You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hop.apache.org by ha...@apache.org on 2021/03/31 14:55:44 UTC

[incubator-hop] branch master updated: HOP-2717 - Fixed hardcoded strings in GitGuiPlugin HOP-2725 - Fixed hardcoded strings in HopGuiContextDelegate HOP-2330 - Improved Italian Translations

This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hop.git


The following commit(s) were added to refs/heads/master by this push:
     new 16d5166  HOP-2717 - Fixed hardcoded strings in GitGuiPlugin HOP-2725 - Fixed hardcoded strings in HopGuiContextDelegate HOP-2330 - Improved Italian Translations
     new 4fe9217  Merge pull request #725 from sramazzina/GUI_Multilanguage
16d5166 is described below

commit 16d51663af53da6b9b18a7a20b73cef682bf98a6
Author: sergio.ramazzina <se...@serasoft.it>
AuthorDate: Wed Mar 31 16:25:51 2021 +0200

    HOP-2717 - Fixed hardcoded strings in GitGuiPlugin
    HOP-2725 - Fixed hardcoded strings in HopGuiContextDelegate
    HOP-2330 - Improved Italian Translations
---
 .../main/java/org/apache/hop/git/GitGuiPlugin.java | 55 ++++++++++++----------
 .../hop/git/messages/messages_en_US.properties     | 31 ++++++++++++
 .../hop/git/messages/messages_it_IT.properties     | 53 +++++++++++++++++++++
 .../ui/hopgui/delegates/HopGuiContextDelegate.java | 24 ++++++++--
 .../delegates}/messages/messages_en_US.properties  |  9 ++--
 .../delegates/messages/messages_it_IT.properties   |  9 ++--
 6 files changed, 146 insertions(+), 35 deletions(-)

diff --git a/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java b/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java
index 4fa187e..2b81ae5 100644
--- a/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java
+++ b/plugins/misc/git/src/main/java/org/apache/hop/git/GitGuiPlugin.java
@@ -31,6 +31,7 @@ import org.apache.hop.git.info.GitInfoExplorerFileTypeHandler;
 import org.apache.hop.git.model.UIFile;
 import org.apache.hop.git.model.UIGit;
 import org.apache.hop.git.model.VCS;
+import org.apache.hop.i18n.BaseMessages;
 import org.apache.hop.ui.core.dialog.EnterSelectionDialog;
 import org.apache.hop.ui.core.dialog.EnterStringDialog;
 import org.apache.hop.ui.core.dialog.ErrorDialog;
@@ -63,6 +64,8 @@ public class GitGuiPlugin
         IExplorerRefreshListener,
         IExplorerSelectionListener {
 
+  public static final Class<?> PKG = GitGuiPlugin.class;
+
   public static final String TOOLBAR_ITEM_GIT_INFO = "ExplorerPerspective-Toolbar-20000-GitInfo";
   public static final String TOOLBAR_ITEM_ADD = "ExplorerPerspective-Toolbar-20100-Add";
   public static final String TOOLBAR_ITEM_REVERT = "ExplorerPerspective-Toolbar-20200-Revert";
@@ -121,7 +124,7 @@ public class GitGuiPlugin
   @GuiToolbarElement(
       root = ExplorerPerspective.GUI_PLUGIN_TOOLBAR_PARENT_ID,
       id = TOOLBAR_ITEM_COMMIT,
-      toolTip = "Git commit",
+      toolTip = "i18n::GitGuiPlugin.Toolbar.Commit.Tooltip",
       image = "git-commit.svg")
   public void gitCommit() {
 
@@ -140,8 +143,8 @@ public class GitGuiPlugin
       if (changedFiles.isEmpty()) {
         MessageBox box =
             new MessageBox(HopGui.getInstance().getShell(), SWT.OK | SWT.ICON_INFORMATION);
-        box.setText("No files to commit");
-        box.setMessage("Sorry, there are no files to commit");
+        box.setText(BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.NoFilesToCommit.Header"));
+        box.setMessage(BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.NoFilesToCommit.Message"));
         box.open();
       } else {
         String[] files = changedFiles.toArray(new String[0]);
@@ -165,8 +168,8 @@ public class GitGuiPlugin
           EnterStringDialog enterStringDialog =
               new EnterStringDialog(
                   HopGui.getInstance().getShell(),
-                  "Commit message",
-                  "Please enter a commit message:",
+                  BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.SelectFilesToCommit.Header"),
+                      BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.SelectFilesToCommit.Message"),
                   "");
           String message = enterStringDialog.open();
           if (message != null) {
@@ -203,8 +206,8 @@ public class GitGuiPlugin
     } catch (Exception e) {
       new ErrorDialog(
           HopGui.getInstance().getShell(),
-          "Commit error",
-          "There was an error doing a git commit",
+          BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.CommitError.Header"),
+          BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.CommitError.Message"),
           e);
     }
   }
@@ -217,35 +220,38 @@ public class GitGuiPlugin
   @GuiToolbarElement(
       root = ExplorerPerspective.GUI_PLUGIN_TOOLBAR_PARENT_ID,
       id = TOOLBAR_ITEM_PUSH,
-      toolTip = "Git push",
+      toolTip = "i18n::GitGuiPlugin.Toolbar.Push.Tooltip",
       image = "push.svg")
   public void gitPush() {
     try {
       git.push();
     } catch (Exception e) {
       new ErrorDialog(
-          HopGui.getInstance().getShell(), "Push error", "There was an error doing a git push", e);
+          HopGui.getInstance().getShell()
+              , BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.PushError.Header")
+              , BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.PushError.Message"), e);
     }
   }
 
   @GuiToolbarElement(
       root = ExplorerPerspective.GUI_PLUGIN_TOOLBAR_PARENT_ID,
       id = TOOLBAR_ITEM_PULL,
-      toolTip = "Git pull",
+      toolTip = "i18n::GitGuiPlugin.Toolbar.Pull.Tooltip",
       image = "pull.svg")
   public void gitPull() {
     try {
       git.pull();
     } catch (Exception e) {
       new ErrorDialog(
-          HopGui.getInstance().getShell(), "Push error", "There was an error doing a git pull", e);
+          HopGui.getInstance().getShell(), BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.PullError.Header")
+              , BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.PullError.Message"), e);
     }
   }
 
   @GuiToolbarElement(
       root = ExplorerPerspective.GUI_PLUGIN_TOOLBAR_PARENT_ID,
       id = TOOLBAR_ITEM_ADD,
-      toolTip = "Git add",
+      toolTip = "i18n::GitGuiPlugin.Toolbar.Add.Tooltip",
       image = "git-add.svg")
   public void gitAdd() {
     try {
@@ -264,14 +270,15 @@ public class GitGuiPlugin
       ExplorerPerspective.getInstance().refresh();
     } catch (Exception e) {
       new ErrorDialog(
-          HopGui.getInstance().getShell(), "Add error", "There was an error doing a git add", e);
+          HopGui.getInstance().getShell(), BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.AddError.Header")
+              , BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.AddError.Message"), e);
     }
   }
 
   @GuiToolbarElement(
       root = ExplorerPerspective.GUI_PLUGIN_TOOLBAR_PARENT_ID,
       id = TOOLBAR_ITEM_REVERT,
-      toolTip = "Git revert file to the last committed version (HEAD)",
+      toolTip = "i18n::GitGuiPlugin.Toolbar.Revert.Tooltip",
       image = "git-revert.svg")
   public void gitRevert() {
     try {
@@ -287,8 +294,8 @@ public class GitGuiPlugin
       if (revertPathFiles.isEmpty()) {
         MessageBox box =
             new MessageBox(HopGui.getInstance().getShell(), SWT.OK | SWT.ICON_INFORMATION);
-        box.setText("No files to revert");
-        box.setMessage("Sorry, there are no files to revert");
+        box.setText(BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.NoFilesToRevert.Header"));
+        box.setMessage(BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.NoFilesToRevert.Message"));
         box.open();
       } else {
         String[] files = revertPathFiles.toArray(new String[0]);
@@ -300,8 +307,8 @@ public class GitGuiPlugin
             new EnterSelectionDialog(
                 HopGui.getInstance().getShell(),
                 files,
-                "Select files to revert",
-                "Please select the files to revert");
+                BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.RevertFiles.Header"),
+                    BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.RevertFiles.Message"));
         selectionDialog.setMulti(true);
         // Select all files by default
         //
@@ -317,9 +324,9 @@ public class GitGuiPlugin
       }
     } catch (Exception e) {
       new ErrorDialog(
-          HopGui.getInstance().getShell(),
-          "Revert error",
-          "There was an error doing a git revert",
+          HopGui.getInstance().getShell()
+              , BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.RevertError.Header")
+              , BaseMessages.getString(PKG, "GitGuiPlugin.Dialog.RevertError.Message"),
           e);
     }
 
@@ -474,7 +481,7 @@ public class GitGuiPlugin
   @GuiToolbarElement(
       root = ExplorerPerspective.GUI_PLUGIN_TOOLBAR_PARENT_ID,
       id = TOOLBAR_ITEM_GIT_INFO,
-      toolTip = "Git Info",
+      toolTip = "i18n::GitGuiPlugin.Toolbar.Info.Tooltip",
       image = "git-info.svg",
       separator = true)
   public void showGitInfo() {
@@ -492,10 +499,10 @@ public class GitGuiPlugin
     ExplorerFile activeFile = explorerPerspective.getSelectedFile();
     if (activeFile == null) {
       activeFile = new ExplorerFile();
-      activeFile.setName( "Git project" );
+      activeFile.setName( BaseMessages.getString(PKG, "GitGuiPlugin.Project.Label") );
       activeFile.setFilename( git.getDirectory() );
     }
-    activeFile.setName("Git info: " + activeFile.getName());
+    activeFile.setName(BaseMessages.getString(PKG, "GitGuiPlugin.Info.Label", activeFile.getName()));
     GitInfoExplorerFileType fileType = new GitInfoExplorerFileType();
     activeFile.setFileType(fileType);
     GitInfoExplorerFileTypeHandler fileTypeHandler =
diff --git a/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_en_US.properties b/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_en_US.properties
index 191c3f2..cac5539 100644
--- a/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_en_US.properties
+++ b/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_en_US.properties
@@ -20,3 +20,34 @@
 #Sun Jan 10 16:37:49 CET 2021
 Dialog.Error=Error
 Dialog.Success=Succes\!
+
+GitGuiPlugin.Toolbar.Commit.Tooltip=Git Commit
+GitGuiPlugin.Toolbar.Push.Tooltip=Git Push
+GitGuiPlugin.Toolbar.Pull.Tooltip=Git Pull
+GitGuiPlugin.Toolbar.Add.Tooltip=Git Add
+GitGuiPlugin.Toolbar.Revert.Tooltip=Git revert file to the last committed version (HEAD)
+GitGuiPlugin.Toolbar.Info.Tooltip=Git Info
+
+GitGuiPlugin.Project.Label=Git Project
+GitGuiPlugin.Info.Label=Git Info: {0}
+
+
+GitGuiPlugin.Dialog.NoFilesToCommit.Header=No Files to Commit
+GitGuiPlugin.Dialog.NoFilesToCommit.Message=Sorry, there are no files to commit
+GitGuiPlugin.Dialog.NoFilesToRevert.Header=No Files to Revert
+GitGuiPlugin.Dialog.NoFilesToRevert.Message=Sorry, there are no files to revert
+GitGuiPlugin.Dialog.RevertFiles.Header=Select files to revert
+GitGuiPlugin.Dialog.RevertFiles.Message=Please select the files to revert
+
+GitGuiPlugin.Dialog.SelectFilesToCommit.Header=Commit Message
+GitGuiPlugin.Dialog.SelectFilesToCommit.Message=Please enter a commit message:
+GitGuiPlugin.Dialog.CommitError.Header=Commit Error
+GitGuiPlugin.Dialog.CommitError.Message=There was an error doing a git commit
+GitGuiPlugin.Dialog.PushError.Header=GIT Push Error
+GitGuiPlugin.Dialog.PushError.Message=There was an error doing a git push
+GitGuiPlugin.Dialog.PullError.Header=GIT Pull Error
+GitGuiPlugin.Dialog.PullError.Message=There was an error doing a git pull
+GitGuiPlugin.Dialog.AddError.Header=GIT Add Error
+GitGuiPlugin.Dialog.AddError.Message=There was an error doing a git add
+GitGuiPlugin.Dialog.RevertError.Header=GIT Revert Error
+GitGuiPlugin.Dialog.RevertError.Message=There was an error doing a git revert
diff --git a/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_it_IT.properties b/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_it_IT.properties
new file mode 100644
index 0000000..ebda38b
--- /dev/null
+++ b/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_it_IT.properties
@@ -0,0 +1,53 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#File generated by Hop Translator for package 'org.apache.hop.git' in locale 'en_US'
+#
+#
+#Sun Jan 10 16:37:49 CET 2021
+Dialog.Error=Errore
+Dialog.Success=Succeso\!
+
+GitGuiPlugin.Toolbar.Commit.Tooltip=Git Commit
+GitGuiPlugin.Toolbar.Push.Tooltip=Git Push
+GitGuiPlugin.Toolbar.Pull.Tooltip=Git Pull
+GitGuiPlugin.Toolbar.Add.Tooltip=Git Add
+GitGuiPlugin.Toolbar.Revert.Tooltip=Git revert - riporta il file all''ultima versione confermata (HEAD)
+GitGuiPlugin.Toolbar.Info.Tooltip=Git Info
+
+GitGuiPlugin.Project.Label=Progetto Git
+GitGuiPlugin.Info.Label=Git Info: {0}
+
+
+GitGuiPlugin.Dialog.NoFilesToCommit.Header=Non ci sono file da confermare
+GitGuiPlugin.Dialog.NoFilesToCommit.Message=Spiacente, non ci sono file da confermare
+GitGuiPlugin.Dialog.NoFilesToRevert.Header=Non ci sono file da ripristinare
+GitGuiPlugin.Dialog.NoFilesToRevert.Message=Spiacente, non ci sono file da ripristinare
+GitGuiPlugin.Dialog.RevertFiles.Header=Files da ripristinare
+GitGuiPlugin.Dialog.RevertFiles.Message=Per favore seleziona i files da ripristinare
+
+GitGuiPlugin.Dialog.SelectFilesToCommit.Header=Messaggio di Commit
+GitGuiPlugin.Dialog.SelectFilesToCommit.Message=Per favore immetti un mesaggio di commit:
+GitGuiPlugin.Dialog.CommitError.Header=Errore di Commit
+GitGuiPlugin.Dialog.CommitError.Message=Si \u00E8 verificato un errore durante l''operazione di commit
+GitGuiPlugin.Dialog.PushError.Header=GIT Push Error
+GitGuiPlugin.Dialog.PushError.Message=Si \u00E8 verificato un errore durante l''operazione di push
+GitGuiPlugin.Dialog.PullError.Header=GIT Pull Error
+GitGuiPlugin.Dialog.PullError.Message=Si \u00E8 verificato un errore durante l''operazione di pull
+GitGuiPlugin.Dialog.AddError.Header=GIT Add Error
+GitGuiPlugin.Dialog.AddError.Message=Si \u00E8 verificato un errore durante l''operazione di add
+GitGuiPlugin.Dialog.RevertError.Header=GIT Revert Error
+GitGuiPlugin.Dialog.RevertError.Message=Si \u00E8 verificato un errore durante l''operazione di revert
diff --git a/ui/src/main/java/org/apache/hop/ui/hopgui/delegates/HopGuiContextDelegate.java b/ui/src/main/java/org/apache/hop/ui/hopgui/delegates/HopGuiContextDelegate.java
index 276ef10..178dd46 100644
--- a/ui/src/main/java/org/apache/hop/ui/hopgui/delegates/HopGuiContextDelegate.java
+++ b/ui/src/main/java/org/apache/hop/ui/hopgui/delegates/HopGuiContextDelegate.java
@@ -19,10 +19,13 @@ package org.apache.hop.ui.hopgui.delegates;
 
 import org.apache.hop.core.gui.Point;
 import org.apache.hop.core.gui.plugin.action.GuiActionType;
+import org.apache.hop.i18n.BaseMessages;
 import org.apache.hop.ui.hopgui.HopGui;
 import org.apache.hop.ui.hopgui.context.GuiContextUtil;
 
 public class HopGuiContextDelegate {
+
+  public static final Class<?> PKG = HopGuiContextDelegate.class;
   private HopGui hopGui;
 
   public HopGuiContextDelegate( HopGui hopGui ) {
@@ -38,7 +41,12 @@ public class HopGuiContextDelegate {
     int x = 50 + hopGui.getShell().getLocation().x;
     int y = 50 + hopGui.getShell().getLocation().y;
 
-    GuiContextUtil.getInstance().handleActionSelection( hopGui.getShell(), "Select the item to create", new Point( x, y ), hopGui, GuiActionType.Create, "FileNew", true );
+    GuiContextUtil.getInstance().handleActionSelection( hopGui.getShell()
+            , BaseMessages.getString(PKG, "HopGuiContextDelegate.SelectItemCreate.Dialog.Header")
+            , new Point( x, y )
+            , hopGui
+            , GuiActionType.Create
+            , "FileNew", true );
   }
 
   /**
@@ -46,7 +54,12 @@ public class HopGuiContextDelegate {
    */
   public void fileMetadataEdit() {
 
-    GuiContextUtil.getInstance().handleActionSelection( hopGui.getShell(), "Select the element type to edit...", new Point( 0, 0 ), hopGui, GuiActionType.Modify, "FileMetadataEdit", true );
+    GuiContextUtil.getInstance().handleActionSelection( hopGui.getShell()
+            , BaseMessages.getString(PKG, "HopGuiContextDelegate.SelectElementTypeEdit.Dialog.Header")
+            , new Point( 0, 0 )
+            , hopGui, GuiActionType.Modify
+            , "FileMetadataEdit"
+            , true );
   }
 
   /**
@@ -54,7 +67,12 @@ public class HopGuiContextDelegate {
    */
   public void fileMetadataDelete() {
 
-    GuiContextUtil.getInstance().handleActionSelection( hopGui.getShell(), "Select the element type to delete...", new Point( 0, 0 ), hopGui, GuiActionType.Delete, "FileMetadataDelete", true );
+    GuiContextUtil.getInstance().handleActionSelection( hopGui.getShell()
+            , BaseMessages.getString(PKG, "HopGuiContextDelegate.SelectElementTypeDelete.Dialog.Header")
+            , new Point( 0, 0 )
+            , hopGui
+            , GuiActionType.Delete
+            , "FileMetadataDelete", true );
   }
 
   /**
diff --git a/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_en_US.properties b/ui/src/main/resources/org/apache/hop/ui/hopgui/delegates/messages/messages_en_US.properties
similarity index 74%
copy from plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_en_US.properties
copy to ui/src/main/resources/org/apache/hop/ui/hopgui/delegates/messages/messages_en_US.properties
index 191c3f2..0759fd2 100644
--- a/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_en_US.properties
+++ b/ui/src/main/resources/org/apache/hop/ui/hopgui/delegates/messages/messages_en_US.properties
@@ -1,4 +1,5 @@
 #
+#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -14,9 +15,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-#File generated by Hop Translator for package 'org.apache.hop.git' in locale 'en_US'
 #
 #
-#Sun Jan 10 16:37:49 CET 2021
-Dialog.Error=Error
-Dialog.Success=Succes\!
+
+HopGuiContextDelegate.SelectItemCreate.Dialog.Header=Select the item to create
+HopGuiContextDelegate.SelectElementTypeEdit.Dialog.Header=Select the element type to edit...
+HopGuiContextDelegate.SelectElementTypeDelete.Dialog.Header=Select the element type to delete...
\ No newline at end of file
diff --git a/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_en_US.properties b/ui/src/main/resources/org/apache/hop/ui/hopgui/delegates/messages/messages_it_IT.properties
similarity index 73%
copy from plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_en_US.properties
copy to ui/src/main/resources/org/apache/hop/ui/hopgui/delegates/messages/messages_it_IT.properties
index 191c3f2..5179db3 100644
--- a/plugins/misc/git/src/main/resources/org/apache/hop/git/messages/messages_en_US.properties
+++ b/ui/src/main/resources/org/apache/hop/ui/hopgui/delegates/messages/messages_it_IT.properties
@@ -1,4 +1,5 @@
 #
+#
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -14,9 +15,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-#File generated by Hop Translator for package 'org.apache.hop.git' in locale 'en_US'
 #
 #
-#Sun Jan 10 16:37:49 CET 2021
-Dialog.Error=Error
-Dialog.Success=Succes\!
+
+HopGuiContextDelegate.SelectItemCreate.Dialog.Header=Seleziona l''elemento da creare
+HopGuiContextDelegate.SelectElementTypeEdit.Dialog.Header=Seleziona l''elemento da modificare...
+HopGuiContextDelegate.SelectElementTypeDelete.Dialog.Header=Seleziona l''elemento da cancellare...
\ No newline at end of file