diff options
| author | 2020-03-05 22:17:08 +0000 | |
|---|---|---|
| committer | 2020-03-05 22:17:08 +0000 | |
| commit | 863d40a1c1f6591ef1ee8594b12ae4b0942fe810 (patch) | |
| tree | 614c0e3bc842e1ab50413dcc18b450c96224db10 /src/main/java/cuchaz/enigma/gui/dialog | |
| parent | Fix drop mappings not checking localVars (diff) | |
| download | enigma-fork-863d40a1c1f6591ef1ee8594b12ae4b0942fe810.tar.gz enigma-fork-863d40a1c1f6591ef1ee8594b12ae4b0942fe810.tar.xz enigma-fork-863d40a1c1f6591ef1ee8594b12ae4b0942fe810.zip | |
Made Enigma gui translatable (#193)
* made enigma gui translatable
* key renamings
* missed strings
* string.format() & another missed string
* cached content (thanks @liach)
* added a dialog when changing language
* better sentence
* more %s
* liach's requests
* empty map
* the last (?) missed strings
* IT WORKS
* French translation
* Update fr_fr.json
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/dialog')
5 files changed, 18 insertions, 13 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/dialog/AboutDialog.java b/src/main/java/cuchaz/enigma/gui/dialog/AboutDialog.java index 7b3234d..82fd6a5 100644 --- a/src/main/java/cuchaz/enigma/gui/dialog/AboutDialog.java +++ b/src/main/java/cuchaz/enigma/gui/dialog/AboutDialog.java | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | package cuchaz.enigma.gui.dialog; | 12 | package cuchaz.enigma.gui.dialog; |
| 13 | 13 | ||
| 14 | import cuchaz.enigma.Constants; | 14 | import cuchaz.enigma.Constants; |
| 15 | import cuchaz.enigma.utils.I18n; | ||
| 15 | import cuchaz.enigma.utils.Utils; | 16 | import cuchaz.enigma.utils.Utils; |
| 16 | 17 | ||
| 17 | import javax.swing.*; | 18 | import javax.swing.*; |
| @@ -22,7 +23,7 @@ public class AboutDialog { | |||
| 22 | 23 | ||
| 23 | public static void show(JFrame parent) { | 24 | public static void show(JFrame parent) { |
| 24 | // init frame | 25 | // init frame |
| 25 | final JFrame frame = new JFrame(Constants.NAME + " - About"); | 26 | final JFrame frame = new JFrame(String.format(I18n.translate("menu.help.about.title"), Constants.NAME)); |
| 26 | final Container pane = frame.getContentPane(); | 27 | final Container pane = frame.getContentPane(); |
| 27 | pane.setLayout(new FlowLayout()); | 28 | pane.setLayout(new FlowLayout()); |
| 28 | 29 | ||
| @@ -52,7 +53,7 @@ public class AboutDialog { | |||
| 52 | pane.add(linkPanel); | 53 | pane.add(linkPanel); |
| 53 | 54 | ||
| 54 | // show ok button | 55 | // show ok button |
| 55 | JButton okButton = new JButton("Ok"); | 56 | JButton okButton = new JButton(I18n.translate("menu.help.about.ok")); |
| 56 | pane.add(okButton); | 57 | pane.add(okButton); |
| 57 | okButton.addActionListener(arg0 -> frame.dispose()); | 58 | okButton.addActionListener(arg0 -> frame.dispose()); |
| 58 | 59 | ||
diff --git a/src/main/java/cuchaz/enigma/gui/dialog/CrashDialog.java b/src/main/java/cuchaz/enigma/gui/dialog/CrashDialog.java index 04dd5d7..7e66ecd 100644 --- a/src/main/java/cuchaz/enigma/gui/dialog/CrashDialog.java +++ b/src/main/java/cuchaz/enigma/gui/dialog/CrashDialog.java | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | package cuchaz.enigma.gui.dialog; | 12 | package cuchaz.enigma.gui.dialog; |
| 13 | 13 | ||
| 14 | import cuchaz.enigma.Constants; | 14 | import cuchaz.enigma.Constants; |
| 15 | import cuchaz.enigma.utils.I18n; | ||
| 15 | import cuchaz.enigma.utils.Utils; | 16 | import cuchaz.enigma.utils.Utils; |
| 16 | 17 | ||
| 17 | import javax.swing.*; | 18 | import javax.swing.*; |
| @@ -28,11 +29,11 @@ public class CrashDialog { | |||
| 28 | 29 | ||
| 29 | private CrashDialog(JFrame parent) { | 30 | private CrashDialog(JFrame parent) { |
| 30 | // init frame | 31 | // init frame |
| 31 | frame = new JFrame(Constants.NAME + " - Crash Report"); | 32 | frame = new JFrame(String.format(I18n.translate("crash.title"), Constants.NAME)); |
| 32 | final Container pane = frame.getContentPane(); | 33 | final Container pane = frame.getContentPane(); |
| 33 | pane.setLayout(new BorderLayout()); | 34 | pane.setLayout(new BorderLayout()); |
| 34 | 35 | ||
| 35 | JLabel label = new JLabel(Constants.NAME + " has crashed! =("); | 36 | JLabel label = new JLabel(String.format(I18n.translate("crash.summary"), Constants.NAME)); |
| 36 | label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); | 37 | label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
| 37 | pane.add(label, BorderLayout.NORTH); | 38 | pane.add(label, BorderLayout.NORTH); |
| 38 | 39 | ||
| @@ -46,14 +47,14 @@ public class CrashDialog { | |||
| 46 | FlowLayout buttonsLayout = new FlowLayout(); | 47 | FlowLayout buttonsLayout = new FlowLayout(); |
| 47 | buttonsLayout.setAlignment(FlowLayout.RIGHT); | 48 | buttonsLayout.setAlignment(FlowLayout.RIGHT); |
| 48 | buttonsPanel.setLayout(buttonsLayout); | 49 | buttonsPanel.setLayout(buttonsLayout); |
| 49 | buttonsPanel.add(Utils.unboldLabel(new JLabel("If you choose exit, you will lose any unsaved work."))); | 50 | buttonsPanel.add(Utils.unboldLabel(new JLabel(I18n.translate("crash.exit.warning")))); |
| 50 | JButton ignoreButton = new JButton("Ignore"); | 51 | JButton ignoreButton = new JButton(I18n.translate("crash.ignore")); |
| 51 | ignoreButton.addActionListener(event -> { | 52 | ignoreButton.addActionListener(event -> { |
| 52 | // close (hide) the dialog | 53 | // close (hide) the dialog |
| 53 | frame.setVisible(false); | 54 | frame.setVisible(false); |
| 54 | }); | 55 | }); |
| 55 | buttonsPanel.add(ignoreButton); | 56 | buttonsPanel.add(ignoreButton); |
| 56 | JButton exitButton = new JButton("Exit"); | 57 | JButton exitButton = new JButton(I18n.translate("crash.exit")); |
| 57 | exitButton.addActionListener(event -> { | 58 | exitButton.addActionListener(event -> { |
| 58 | // exit enigma | 59 | // exit enigma |
| 59 | System.exit(1); | 60 | System.exit(1); |
diff --git a/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java b/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java index 84e4d8f..57811ee 100644 --- a/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java +++ b/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | package cuchaz.enigma.gui.dialog; | 12 | package cuchaz.enigma.gui.dialog; |
| 13 | 13 | ||
| 14 | import cuchaz.enigma.utils.I18n; | ||
| 14 | import cuchaz.enigma.utils.Utils; | 15 | import cuchaz.enigma.utils.Utils; |
| 15 | 16 | ||
| 16 | import javax.swing.*; | 17 | import javax.swing.*; |
| @@ -26,7 +27,7 @@ public class JavadocDialog { | |||
| 26 | 27 | ||
| 27 | private JavadocDialog(JFrame parent, JTextArea text, Callback callback) { | 28 | private JavadocDialog(JFrame parent, JTextArea text, Callback callback) { |
| 28 | // init frame | 29 | // init frame |
| 29 | frame = new JFrame("Edit Javadocs"); | 30 | frame = new JFrame(I18n.translate("javadocs.edit")); |
| 30 | final Container pane = frame.getContentPane(); | 31 | final Container pane = frame.getContentPane(); |
| 31 | pane.setLayout(new BorderLayout()); | 32 | pane.setLayout(new BorderLayout()); |
| 32 | 33 | ||
| @@ -55,14 +56,14 @@ public class JavadocDialog { | |||
| 55 | FlowLayout buttonsLayout = new FlowLayout(); | 56 | FlowLayout buttonsLayout = new FlowLayout(); |
| 56 | buttonsLayout.setAlignment(FlowLayout.RIGHT); | 57 | buttonsLayout.setAlignment(FlowLayout.RIGHT); |
| 57 | buttonsPanel.setLayout(buttonsLayout); | 58 | buttonsPanel.setLayout(buttonsLayout); |
| 58 | buttonsPanel.add(Utils.unboldLabel(new JLabel("Edit javadocs here."))); | 59 | buttonsPanel.add(Utils.unboldLabel(new JLabel(I18n.translate("javadocs.instruction")))); |
| 59 | JButton cancelButton = new JButton("Cancel"); | 60 | JButton cancelButton = new JButton(I18n.translate("javadocs.cancel")); |
| 60 | cancelButton.addActionListener(event -> { | 61 | cancelButton.addActionListener(event -> { |
| 61 | // close (hide) the dialog | 62 | // close (hide) the dialog |
| 62 | callback.closeUi(frame, false); | 63 | callback.closeUi(frame, false); |
| 63 | }); | 64 | }); |
| 64 | buttonsPanel.add(cancelButton); | 65 | buttonsPanel.add(cancelButton); |
| 65 | JButton saveButton = new JButton("Save"); | 66 | JButton saveButton = new JButton(I18n.translate("javadocs.save")); |
| 66 | saveButton.addActionListener(event -> { | 67 | saveButton.addActionListener(event -> { |
| 67 | // exit enigma | 68 | // exit enigma |
| 68 | callback.closeUi(frame, true); | 69 | callback.closeUi(frame, true); |
diff --git a/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java b/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java index ae30667..6d9a419 100644 --- a/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java +++ b/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java | |||
| @@ -13,6 +13,7 @@ package cuchaz.enigma.gui.dialog; | |||
| 13 | 13 | ||
| 14 | import cuchaz.enigma.Constants; | 14 | import cuchaz.enigma.Constants; |
| 15 | import cuchaz.enigma.ProgressListener; | 15 | import cuchaz.enigma.ProgressListener; |
| 16 | import cuchaz.enigma.utils.I18n; | ||
| 16 | import cuchaz.enigma.utils.Utils; | 17 | import cuchaz.enigma.utils.Utils; |
| 17 | 18 | ||
| 18 | import javax.swing.*; | 19 | import javax.swing.*; |
| @@ -29,7 +30,7 @@ public class ProgressDialog implements ProgressListener, AutoCloseable { | |||
| 29 | public ProgressDialog(JFrame parent) { | 30 | public ProgressDialog(JFrame parent) { |
| 30 | 31 | ||
| 31 | // init frame | 32 | // init frame |
| 32 | this.frame = new JFrame(Constants.NAME + " - Operation in progress"); | 33 | this.frame = new JFrame(String.format(I18n.translate("progress.operation"), Constants.NAME)); |
| 33 | final Container pane = this.frame.getContentPane(); | 34 | final Container pane = this.frame.getContentPane(); |
| 34 | FlowLayout layout = new FlowLayout(); | 35 | FlowLayout layout = new FlowLayout(); |
| 35 | layout.setAlignment(FlowLayout.LEFT); | 36 | layout.setAlignment(FlowLayout.LEFT); |
diff --git a/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java b/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java index 1657d7b..47f9149 100644 --- a/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java +++ b/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java | |||
| @@ -14,6 +14,7 @@ package cuchaz.enigma.gui.dialog; | |||
| 14 | import com.google.common.collect.Lists; | 14 | import com.google.common.collect.Lists; |
| 15 | import cuchaz.enigma.gui.Gui; | 15 | import cuchaz.enigma.gui.Gui; |
| 16 | import cuchaz.enigma.translation.representation.entry.ClassEntry; | 16 | import cuchaz.enigma.translation.representation.entry.ClassEntry; |
| 17 | import cuchaz.enigma.utils.I18n; | ||
| 17 | import me.xdrop.fuzzywuzzy.FuzzySearch; | 18 | import me.xdrop.fuzzywuzzy.FuzzySearch; |
| 18 | import me.xdrop.fuzzywuzzy.model.ExtractedResult; | 19 | import me.xdrop.fuzzywuzzy.model.ExtractedResult; |
| 19 | 20 | ||
| @@ -45,7 +46,7 @@ public class SearchDialog { | |||
| 45 | } | 46 | } |
| 46 | 47 | ||
| 47 | public void show() { | 48 | public void show() { |
| 48 | frame = new JFrame("Search"); | 49 | frame = new JFrame(I18n.translate("menu.view.search")); |
| 49 | frame.setVisible(false); | 50 | frame.setVisible(false); |
| 50 | JPanel pane = new JPanel(); | 51 | JPanel pane = new JPanel(); |
| 51 | pane.setBorder(new EmptyBorder(5, 10, 5, 10)); | 52 | pane.setBorder(new EmptyBorder(5, 10, 5, 10)); |