From cf6537793007727d65f787a20c407de92bd83246 Mon Sep 17 00:00:00 2001 From: mmk2410 Date: Tue, 9 Jun 2015 10:56:50 +0200 Subject: [PATCH] "Germanization" --- src/de/marcelkapfer/c/morseconverter/Main.form | 14 +++++++------- src/de/marcelkapfer/c/morseconverter/Main.java | 8 +++++--- .../marcelkapfer/c/morseconverter/text.properties | 11 +++++++++++ .../c/morseconverter/text_de.properties | 11 +++++++++++ .../c/morseconverter/update/Update.java | 2 -- .../c/morseconverter/update/UpdateDialog.java | 10 ++++++---- 6 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 src/de/marcelkapfer/c/morseconverter/text.properties create mode 100644 src/de/marcelkapfer/c/morseconverter/text_de.properties diff --git a/src/de/marcelkapfer/c/morseconverter/Main.form b/src/de/marcelkapfer/c/morseconverter/Main.form index c5c8d54..b32c9b5 100644 --- a/src/de/marcelkapfer/c/morseconverter/Main.form +++ b/src/de/marcelkapfer/c/morseconverter/Main.form @@ -21,7 +21,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -102,7 +102,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -134,7 +134,7 @@ - + diff --git a/src/de/marcelkapfer/c/morseconverter/Main.java b/src/de/marcelkapfer/c/morseconverter/Main.java index 1f07c94..fafeded 100644 --- a/src/de/marcelkapfer/c/morseconverter/Main.java +++ b/src/de/marcelkapfer/c/morseconverter/Main.java @@ -35,6 +35,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.util.ResourceBundle; public class Main extends JFrame { @@ -42,6 +43,7 @@ public class Main extends JFrame { public static final int currentVersion = 200; public int latestVersion = currentVersion; + public static ResourceBundle resourceBundle = ResourceBundle.getBundle("de.marcelkapfer.c.morseconverter.text"); public JTabbedPane morseConverterPane; private JPanel panel1; private JTextArea inputAreaWrittenMorse; @@ -73,7 +75,7 @@ public class Main extends JFrame { //TODO To be also shown in the about view if (currentVersion < latestVersion){ - JOptionPane.showMessageDialog(null, "An Update is available!\nGo to the 'About' section for more."); + JOptionPane.showMessageDialog(null, resourceBundle.getString("updateAvailable")); } updateDialogButton.addActionListener(new ActionListener() { @@ -97,7 +99,7 @@ public class Main extends JFrame { main.setContentPane(new Main().morseConverterPane); main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Title - main.setTitle("Morse Converter"); + main.setTitle(resourceBundle.getString("title")); main.pack(); // Window position and Size main.setBounds(100, 100, 800, 400); @@ -123,7 +125,7 @@ public class Main extends JFrame { private void instantNormalMorseConvert(){ // Gets the text from the input field String input = inputAreaNormalMorse.getText(); - // cechs if the code is a normal Morse code + // checks if the code is a normal Morse code if(NormalMorseCodeRecognization.isCode(input)){ // converts the code into normal letters outputAreaNormalMorse.setText(EncodeNormalMorseManager.getEncodedString(input)); diff --git a/src/de/marcelkapfer/c/morseconverter/text.properties b/src/de/marcelkapfer/c/morseconverter/text.properties new file mode 100644 index 0000000..eb16473 --- /dev/null +++ b/src/de/marcelkapfer/c/morseconverter/text.properties @@ -0,0 +1,11 @@ +about=

Developer
Marcel Kapfer

Version
2.0.0 dev

+inputText=Enter your text +tabAbout=About +tabNormalMorse=Normal Morse +title=Morse Converter +update-error=There was an error while getting the current directory. +update-no-connection=The connection to the server was not possible.\nTry again later. +update-not-successful=Update not successful +update-successful=Update successful.\nPlease restart the software to activate the changes. +updateAvailable=An Update is available\!\nGo to the 'About' section for more. +updateButton=Check for updates \ No newline at end of file diff --git a/src/de/marcelkapfer/c/morseconverter/text_de.properties b/src/de/marcelkapfer/c/morseconverter/text_de.properties new file mode 100644 index 0000000..de4327e --- /dev/null +++ b/src/de/marcelkapfer/c/morseconverter/text_de.properties @@ -0,0 +1,11 @@ +about=

Entwickler\:
Marcel Kapfer

Version
2.0.0 dev

+inputText=Geben Sie einen Text ein +tabAbout=Über +tabNormalMorse=Normales Morse +title=Morse Umwandler +update-error=Es trat ein Fehler auf, beim Versuch das aktuelle Verzeichniss zu finden +update-no-connection=Eine Verbindung zum Server war nicht möglich\nVersuchen Sie es später nochmal. +update-not-successful=Update nich erfolgreich +update-successful=Update erfolgreich\nBitte starten Sie die Software neu um die Änderungen zu aktivieren +updateAvailable=Ein Update ist verfügbarr\nMehr in der "Über" Abteilung. +updateButton=Auf Updates überprüfen \ No newline at end of file diff --git a/src/de/marcelkapfer/c/morseconverter/update/Update.java b/src/de/marcelkapfer/c/morseconverter/update/Update.java index ba40c38..371d299 100644 --- a/src/de/marcelkapfer/c/morseconverter/update/Update.java +++ b/src/de/marcelkapfer/c/morseconverter/update/Update.java @@ -2,9 +2,7 @@ package de.marcelkapfer.c.morseconverter.update; import java.io.BufferedReader; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStreamReader; -import java.net.MalformedURLException; import java.net.URL; import java.nio.channels.Channels; import java.nio.channels.ReadableByteChannel; diff --git a/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.java b/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.java index d752c24..7ef53ee 100644 --- a/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.java +++ b/src/de/marcelkapfer/c/morseconverter/update/UpdateDialog.java @@ -30,11 +30,13 @@ import java.io.File; import java.net.URISyntaxException; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ResourceBundle; public class UpdateDialog extends JDialog { private JPanel contentPane; private JButton buttonOK; private JButton buttonCancel; + private ResourceBundle resourceBundle = ResourceBundle.getBundle("de.marcelkapfer.c.morseconverter.text"); public UpdateDialog() { setContentPane(contentPane); @@ -76,16 +78,16 @@ public class UpdateDialog extends JDialog { path = path.substring(0, path.lastIndexOf(File.separator)); if(Update.isConnected("http://c2/LAB/java/morseconverter/morseconverter-1.jar")){ if(Update.update(path + File.separator, "morseconverter-1.jar")){ - JOptionPane.showMessageDialog(null, "Update successful. \n Please restart the software to activate."); + JOptionPane.showMessageDialog(null, resourceBundle.getString("update-successful")); } else { - JOptionPane.showMessageDialog(null, "Update not successful."); + JOptionPane.showMessageDialog(null, resourceBundle.getString("update-not-successful")); } } else { - JOptionPane.showMessageDialog(null, "The connection to the server was not possible. \n Try again later."); + JOptionPane.showMessageDialog(null, resourceBundle.getString("update-no-connection")); } } catch (URISyntaxException e) { e.printStackTrace(); - JOptionPane.showMessageDialog(null, "There was an error while getting the current directory."); + JOptionPane.showMessageDialog(null, resourceBundle.getString("update-error")); } dispose(); }