summaryrefslogtreecommitdiff
path: root/utils/src
diff options
context:
space:
mode:
authorAndreas Abraham <andreas.abraham@egiz.gv.at>2018-09-07 17:08:37 +0200
committerAndreas Abraham <andreas.abraham@egiz.gv.at>2018-09-07 17:08:37 +0200
commitbfaf81f5e5d4efd62e04c4e5bdcd08e64f530ca8 (patch)
tree7646827f6a5ac2443ab7cc49ef4bf5961b2e117d /utils/src
parent706277b1275d0a852f8602fbc236325d3ca71cd3 (diff)
downloadmocca-bfaf81f5e5d4efd62e04c4e5bdcd08e64f530ca8.tar.gz
mocca-bfaf81f5e5d4efd62e04c4e5bdcd08e64f530ca8.tar.bz2
mocca-bfaf81f5e5d4efd62e04c4e5bdcd08e64f530ca8.zip
message bundle support implemented
Diffstat (limited to 'utils/src')
-rw-r--r--utils/src/main/java/at/gv/egiz/updater/NewVersionDialog.java28
1 files changed, 25 insertions, 3 deletions
diff --git a/utils/src/main/java/at/gv/egiz/updater/NewVersionDialog.java b/utils/src/main/java/at/gv/egiz/updater/NewVersionDialog.java
index b3a58648..570dfcd3 100644
--- a/utils/src/main/java/at/gv/egiz/updater/NewVersionDialog.java
+++ b/utils/src/main/java/at/gv/egiz/updater/NewVersionDialog.java
@@ -22,6 +22,10 @@ import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URLClassLoader;
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
@@ -34,6 +38,17 @@ public class NewVersionDialog extends JDialog {
private final JPanel contentPanel = new JPanel();
private final Logger log = LoggerFactory.getLogger(NewVersionDialog.class);
+
+ private Locale getCurrenLocale() {
+
+ String language = Locale.getDefault().getLanguage();
+ if (language.contains("en")) {
+ return Locale.ENGLISH;
+ }
+
+ return Locale.GERMAN;
+ }
+
/**
* Launch the application.
*/
@@ -52,7 +67,12 @@ public class NewVersionDialog extends JDialog {
* @throws IOException
*/
public NewVersionDialog(String version) throws IOException {
- setTitle("New Version Available!");
+
+ ResourceBundle bundle = ResourceBundle.getBundle("at/gv/egiz/updater/Messages", getCurrenLocale());
+ System.out.println(bundle.getString("title"));
+
+
+ setTitle(bundle.getString("title"));
setResizable(false);
setBounds(100, 100, 375, 180);
getContentPane().setLayout(new BorderLayout());
@@ -62,12 +82,14 @@ public class NewVersionDialog extends JDialog {
BufferedImage myPicture = ImageIO.read(getClass().getResource("/at/gv/egiz/updater/information-icon.png"));
ImageIcon icon = new ImageIcon(myPicture.getScaledInstance(50, 50, Image.SCALE_SMOOTH));
{
- JLabel lblNewVersion = new JLabel("New Mocca Version " + version + " available.");
+ String pattern = bundle.getString("mocca.version");
+ String message = MessageFormat.format(pattern, version);
+ JLabel lblNewVersion = new JLabel(message);
lblNewVersion.setBounds(76, 36, 283, 27);
contentPanel.add(lblNewVersion);
}
{
- JLabel lblNewLabel = new JLabel("Open download page now?");
+ JLabel lblNewLabel = new JLabel(bundle.getString("mocca.download"));
lblNewLabel.setBounds(76, 55, 283, 27);
contentPanel.add(lblNewLabel);
}