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/07/01 17:36:02 UTC
[incubator-hop] branch master updated: HOP-3025 - Manage hardcoded
strings in HopBeamGuiPlugin
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 6f78627 HOP-3025 - Manage hardcoded strings in HopBeamGuiPlugin
new 24b2f15 Merge pull request #913 from sramazzina/HOP-3025
6f78627 is described below
commit 6f7862724c7f291885b049d2f39408e678e9283e
Author: sergio.ramazzina <se...@serasoft.it>
AuthorDate: Thu Jul 1 19:04:31 2021 +0200
HOP-3025 - Manage hardcoded strings in HopBeamGuiPlugin
---
.../org/apache/hop/beam/gui/HopBeamGuiPlugin.java | 32 ++++++++++--------
.../beam/gui/messages/messages_en_US.properties | 39 ++++++++++++++++++++++
.../beam/gui/messages/messages_it_IT.properties | 39 ++++++++++++++++++++++
3 files changed, 96 insertions(+), 14 deletions(-)
diff --git a/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/HopBeamGuiPlugin.java b/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/HopBeamGuiPlugin.java
index 61fefff..3d23596 100644
--- a/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/HopBeamGuiPlugin.java
+++ b/plugins/engines/beam/src/main/java/org/apache/hop/beam/gui/HopBeamGuiPlugin.java
@@ -24,6 +24,7 @@ import org.apache.hop.core.gui.plugin.GuiPlugin;
import org.apache.hop.core.gui.plugin.menu.GuiMenuElement;
import org.apache.hop.core.metadata.SerializableMetadataProvider;
import org.apache.hop.core.vfs.HopVfs;
+import org.apache.hop.i18n.BaseMessages;
import org.apache.hop.ui.core.dialog.BaseDialog;
import org.apache.hop.ui.core.dialog.ErrorDialog;
import org.apache.hop.ui.core.gui.GuiResource;
@@ -46,6 +47,8 @@ import java.util.Set;
@GuiPlugin
public class HopBeamGuiPlugin {
+ public static final Class<?> PKG = HopBeamGuiPlugin.class; // i18n
+
public static final String ID_MAIN_MENU_TOOLS_FAT_JAR = "40200-menu-tools-fat-jar";
public static final String ID_MAIN_MENU_TOOLS_EXPORT_METADATA =
"40210-menu-tools-export-metadata";
@@ -67,7 +70,7 @@ public class HopBeamGuiPlugin {
@GuiMenuElement(
root = HopGui.ID_MAIN_MENU,
id = ID_MAIN_MENU_TOOLS_FAT_JAR,
- label = "Generate a Hop fat jar...",
+ label = "i18n::BeamGuiPlugin.Menu.GenerateFatJar.Text",
parentId = HopGui.ID_MAIN_MENU_TOOLS_PARENT_ID,
separator = true)
public void menuToolsFatJar() {
@@ -75,11 +78,11 @@ public class HopBeamGuiPlugin {
final Shell shell = hopGui.getShell();
MessageBox box = new MessageBox(shell, SWT.OK | SWT.CANCEL | SWT.ICON_INFORMATION);
- box.setText("Create a Hop fat jar file");
+ box.setText(BaseMessages.getString(PKG, "BeamGuiPlugin.GenerateFatJar.Dialog.Header"));
box.setMessage(
- "This function generates a single Java library which contains the Hop code and all it's current plugins."
+ BaseMessages.getString(PKG, "BeamGuiPlugin.GenerateFatJar.Dialog.Message1")
+ Const.CR
- + "If you hit OK simply select the file to save the so called 'fat jar' file to afterwards. All the code will then be collected automatically.");
+ + BaseMessages.getString(PKG, "BeamGuiPlugin.GenerateFatJar.Dialog.Message2"));
int answer = box.open();
if ((answer & SWT.CANCEL) != 0) {
return;
@@ -92,7 +95,8 @@ public class HopBeamGuiPlugin {
true,
shell,
new String[] {"*.jar", "*.*"},
- new String[] {"Jar files (*.jar)", "All Files (*.*)"},
+ new String[] {BaseMessages.getString(PKG, "BeamGuiPlugin.FileTypes.Jars.Label"),
+ BaseMessages.getString(PKG, "BeamGuiPlugin.FileTypes.All.Label")},
true);
if (filename == null) {
return;
@@ -104,7 +108,7 @@ public class HopBeamGuiPlugin {
IRunnableWithProgress op =
monitor -> {
try {
- monitor.setTaskName("Building a Hop fat jar...");
+ monitor.setTaskName(BaseMessages.getString(PKG, "BeamGuiPlugin.GenerateFatJar.Progress.Message"));
FatJarBuilder fatJarBuilder =
new FatJarBuilder(hopGui.getVariables(), filename, jarFilenames);
fatJarBuilder.setExtraTransformPluginClasses(null);
@@ -122,12 +126,11 @@ public class HopBeamGuiPlugin {
GuiResource.getInstance().toClipboard(filename);
box = new MessageBox(shell, SWT.CLOSE | SWT.ICON_INFORMATION);
- box.setText("Fat jar created");
+ box.setText(BaseMessages.getString(PKG, "BeamGuiPlugin.FatJarCreated.Dialog.Header"));
box.setMessage(
- "A fat jar was successfully created : "
- + filename
+ BaseMessages.getString(PKG, "BeamGuiPlugin.FatJarCreated.Dialog.Message1", filename)
+ Const.CR
- + "The filename was copied to the clipboard.");
+ + BaseMessages.getString(PKG, "BeamGuiPlugin.FatJarCreated.Dialog.Message2"));
box.open();
} catch (Exception e) {
new ErrorDialog(shell, "Error", "Error creating fat jar", e);
@@ -137,7 +140,7 @@ public class HopBeamGuiPlugin {
@GuiMenuElement(
root = HopGui.ID_MAIN_MENU,
id = ID_MAIN_MENU_TOOLS_EXPORT_METADATA,
- label = "Export metadata to JSON",
+ label = "i18n::BeamGuiPlugin.Menu.ExportMetadata.Text",
parentId = HopGui.ID_MAIN_MENU_TOOLS_PARENT_ID,
separator = true)
public void menuToolsExportMetadata() {
@@ -145,9 +148,9 @@ public class HopBeamGuiPlugin {
final Shell shell = hopGui.getShell();
MessageBox box = new MessageBox(shell, SWT.OK | SWT.CANCEL | SWT.ICON_INFORMATION);
- box.setText("Export current metadata to JSON");
+ box.setText(BaseMessages.getString(PKG, "BeamGuiPlugin.ExportMetadata.Dialog.Header"));
box.setMessage(
- "Do you want to export the currently available metadata objects to a JSON file?");
+ BaseMessages.getString(PKG, "BeamGuiPlugin.ExportMetadata.Dialog.Message"));
int answer = box.open();
if ((answer & SWT.CANCEL) != 0) {
return;
@@ -160,7 +163,8 @@ public class HopBeamGuiPlugin {
true,
shell,
new String[] {"*.json", "*.*"},
- new String[] {"JSON files (*.json)", "All Files (*.*)"},
+ new String[] {BaseMessages.getString(PKG, "BeamGuiPlugin.FileTypes.Json.Label"),
+ BaseMessages.getString(PKG, "BeamGuiPlugin.FileTypes.All.Label")},
true);
if (filename == null) {
return;
diff --git a/plugins/engines/beam/src/main/resources/org/apache/hop/beam/gui/messages/messages_en_US.properties b/plugins/engines/beam/src/main/resources/org/apache/hop/beam/gui/messages/messages_en_US.properties
new file mode 100644
index 0000000..2c4baf1
--- /dev/null
+++ b/plugins/engines/beam/src/main/resources/org/apache/hop/beam/gui/messages/messages_en_US.properties
@@ -0,0 +1,39 @@
+#
+#
+# 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.
+#
+#
+#
+
+BeamGuiPlugin.Menu.GenerateFatJar.Text=Generate a Hop fat jar...
+BeamGuiPlugin.Menu.ExportMetadata.Text=Export metadata to JSON
+
+BeamGuiPlugin.GenerateFatJar.Dialog.Header=Create a Hop fat jar file
+BeamGuiPlugin.GenerateFatJar.Dialog.Message1=This function generates a single Java library which contains the Hop code and all it''s current plugins.
+BeamGuiPlugin.GenerateFatJar.Dialog.Message2=If you hit OK simply select the file to save the so called ''fat jar'' file to afterwards. All the code will then be collected automatically.
+
+BeamGuiPlugin.FatJarCreated.Dialog.Header=Fat jar created
+BeamGuiPlugin.FatJarCreated.Dialog.Message1=A fat jar was successfully created: {0}
+BeamGuiPlugin.FatJarCreated.Dialog.Message2=The filename was copied to the clipboard.
+
+BeamGuiPlugin.ExportMetadata.Dialog.Header=Export current metadata to JSON
+BeamGuiPlugin.ExportMetadata.Dialog.Message=Do you want to export the currently available metadata objects to a JSON file?
+
+BeamGuiPlugin.GenerateFatJar.Progress.Message=Building a Hop fat jar...
+
+BeamGuiPlugin.FileTypes.Jars.Label=Jar files (*.jar)
+BeamGuiPlugin.FileTypes.Json.Label=JSON files (*.json)
+BeamGuiPlugin.FileTypes.All.Label=All Files (*.*)
\ No newline at end of file
diff --git a/plugins/engines/beam/src/main/resources/org/apache/hop/beam/gui/messages/messages_it_IT.properties b/plugins/engines/beam/src/main/resources/org/apache/hop/beam/gui/messages/messages_it_IT.properties
new file mode 100644
index 0000000..82ccb25
--- /dev/null
+++ b/plugins/engines/beam/src/main/resources/org/apache/hop/beam/gui/messages/messages_it_IT.properties
@@ -0,0 +1,39 @@
+#
+#
+# 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.
+#
+#
+#
+
+BeamGuiPlugin.Menu.GenerateFatJar.Text=Genera il fat jar di Hop...
+BeamGuiPlugin.Menu.ExportMetadata.Text=Esporta i metadati in formato JSON
+
+BeamGuiPlugin.GenerateFatJar.Dialog.Header=Creazione del fat jar di Hop
+BeamGuiPlugin.GenerateFatJar.Dialog.Message1=Questa funzione genera una singola libreria Java contenente il codice di Hop e tutti i plugins installati in questo momento.
+BeamGuiPlugin.GenerateFatJar.Dialog.Message2=Premi OK e seleziona il file da salvare per contenere il ''fat jar''. Tutto il codice disponibile sar\u00E0 incluso automaticamente.
+
+BeamGuiPlugin.FatJarCreated.Dialog.Header=Fat jar creato
+BeamGuiPlugin.FatJarCreated.Dialog.Message1=Il fat jar ''{0}'' \u00E9 stato creato con successo
+BeamGuiPlugin.FatJarCreated.Dialog.Message2=Il nome del file \u00E9 stato copiato negli appunti.
+
+BeamGuiPlugin.ExportMetadata.Dialog.Header=Esporto i metadati correnti in formato JSON
+BeamGuiPlugin.ExportMetadata.Dialog.Message=Vuoi esportare i metadati degli oggetti disponibili in questo momento in un file JSON?
+
+BeamGuiPlugin.GenerateFatJar.Progress.Message=Sto costruendo il fat jar di Hop...
+
+BeamGuiPlugin.FileTypes.Jars.Label=Files Jar (*.jar)
+BeamGuiPlugin.FileTypes.Json.Label=Files JSON (*.json)
+BeamGuiPlugin.FileTypes.All.Label=Tutti i files (*.*)
\ No newline at end of file