Author: jflesch
Date: 2007-07-02 00:01:19 +0000 (Mon, 02 Jul 2007)
New Revision: 13874

Modified:
   trunk/apps/Thaw/src/thaw/core/Core.java
   trunk/apps/Thaw/src/thaw/core/I18n.java
   trunk/apps/Thaw/src/thaw/core/ThawConfigPanel.java
   trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
   trunk/apps/Thaw/src/thaw/i18n/thaw.properties
   trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
Log:
Let the user select the language to use

Modified: trunk/apps/Thaw/src/thaw/core/Core.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/Core.java     2007-07-01 23:40:51 UTC (rev 
13873)
+++ trunk/apps/Thaw/src/thaw/core/Core.java     2007-07-02 00:01:19 UTC (rev 
13874)
@@ -181,6 +181,9 @@
                if (config.getValue("tmpDir") != null)
                        System.setProperty("java.io.tmpdir", 
config.getValue("tmpDir"));

+               if (config.getValue("lang") != null)
+                       I18n.setLocale(new 
java.util.Locale(config.getValue("lang")));
+
                return true;
        }


Modified: trunk/apps/Thaw/src/thaw/core/I18n.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/I18n.java     2007-07-01 23:40:51 UTC (rev 
13873)
+++ trunk/apps/Thaw/src/thaw/core/I18n.java     2007-07-02 00:01:19 UTC (rev 
13874)
@@ -34,6 +34,10 @@
  * @version $Id: I18n.java 355 2006-03-24 15:04:11Z bombe $
  */
 public class I18n {
+       public final static Locale[] supportedLocales = {
+               new Locale("en"),
+               new Locale("fr")
+       };

        private static Locale currentLocale;


Modified: trunk/apps/Thaw/src/thaw/core/ThawConfigPanel.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/ThawConfigPanel.java  2007-07-01 23:40:51 UTC 
(rev 13873)
+++ trunk/apps/Thaw/src/thaw/core/ThawConfigPanel.java  2007-07-02 00:01:19 UTC 
(rev 13874)
@@ -13,7 +13,11 @@
 import javax.swing.JButton;
 import javax.swing.JTextField;
 import javax.swing.JTextField;
+import javax.swing.JComboBox;

+import java.util.Vector;
+import java.util.Locale;
+
 import thaw.gui.FileChooser;

 /**
@@ -31,6 +35,8 @@
        private JTextField tmpDirField;
        private JButton tmpDirButton;

+       private JLabel langLabel;
+       private JComboBox langBox;

        public ThawConfigPanel(final ConfigWindow configWindow, final Core 
core) {
                this.core = core;
@@ -41,6 +47,8 @@
                advancedMode = 
Boolean.valueOf(core.getConfig().getValue("advancedMode")).booleanValue();


+               /* advanced mode */
+
                thawConfigPanel = new JPanel();
                thawConfigPanel.setLayout(new GridLayout(15, 1));

@@ -49,6 +57,9 @@
                thawConfigPanel.add(advancedModeBox);
                thawConfigPanel.add(new JLabel(" "));

+
+               /* tmpdir */
+
                tmpDirField = new 
JTextField(System.getProperty("java.io.tmpdir"));
                tmpDirButton = new 
JButton(I18n.getMessage("thaw.common.browse"));
                tmpDirButton.addActionListener(this);
@@ -64,6 +75,19 @@
                                 BorderLayout.EAST);
                thawConfigPanel.add(tempDirPanel);

+               /* lang */
+               langLabel = new JLabel(I18n.getMessage("thaw.common.language"));
+               langBox = new JComboBox(I18n.supportedLocales);
+
+               setLang();
+
+               thawConfigPanel.add(new JLabel(""));
+               thawConfigPanel.add(langLabel);
+               thawConfigPanel.add(langBox);
+
+
+               /* misc */
+
                setAdvancedOptionsVisibility(advancedMode);

                configWindow.addObserver(this);
@@ -74,11 +98,19 @@
                return thawConfigPanel;
        }

+       private void setLang() {
+               for (int i = 0 ; i < I18n.supportedLocales.length; i++) {
+                       if 
(I18n.supportedLocales[i].getLanguage().equals(I18n.getLocale().getLanguage()))
+                               
langBox.setSelectedItem(I18n.supportedLocales[i]);
+               }
+       }

        private void setAdvancedOptionsVisibility(boolean v) {
                tmpDirField.setVisible(v);
                tmpDirButton.setVisible(v);
                tmpDirLabel.setVisible(v);
+               langLabel.setVisible(v);
+               langBox.setVisible(v);
        }

        public void actionPerformed(ActionEvent e) {
@@ -101,6 +133,9 @@
                        System.setProperty("java.io.tmpdir", 
tmpDirField.getText());
                        
tmpDirField.setText(System.getProperty("java.io.tmpdir"));

+                       core.getConfig().setValue("lang",
+                                                 
((Locale)langBox.getSelectedItem()).getLanguage());
+
                        setAdvancedOptionsVisibility(advancedMode);
                }

@@ -108,6 +143,7 @@
                        advancedModeBox.setSelected(advancedMode);

                        
tmpDirField.setText(System.getProperty("java.io.tmpdir"));
+                       setLang();
                }
        }


Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-07-01 
23:40:51 UTC (rev 13873)
+++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties     2007-07-02 
00:01:19 UTC (rev 13874)
@@ -86,7 +86,10 @@
 thaw.common.tempDir=R?pertoire pour les fichiers temporaires
 thaw.common.browse=Parcourir...

+thaw.common.language=Langue (n?cessite de red?marrer Thaw) :

+
+
 ## Errors
 thaw.error.idAlreadyUsed=Impossible de se connecter. Notre identifiant est 
d?j? utilis? par un autre client connect? au noeud.


Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-07-01 23:40:51 UTC 
(rev 13873)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties       2007-07-02 00:01:19 UTC 
(rev 13874)
@@ -88,6 +88,8 @@
 thaw.common.tempDir=Directory for the temporary files
 thaw.common.browse=Browse...

+thaw.common.language=Language (you must restart Thaw) :
+
 ## Errors
 thaw.error.idAlreadyUsed=Unable to connect. Our Id is already used by another 
client connected to the node.


Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties
===================================================================
--- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-07-01 23:40:51 UTC 
(rev 13873)
+++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties    2007-07-02 00:01:19 UTC 
(rev 13874)
@@ -86,7 +86,10 @@
 thaw.common.tempDir=R\u00e9pertoire pour les fichiers temporaires
 thaw.common.browse=Parcourir...

+thaw.common.language=Langue (n\u00e9cessite de red\u00e9marrer Thaw) :

+
+
 ## Errors
 thaw.error.idAlreadyUsed=Impossible de se connecter. Notre identifiant est 
d\u00e9j\u00e0 utilis\u00e9 par un autre client connect\u00e9 au noeud.

@@ -331,7 +334,7 @@

 thaw.plugin.index.loadOnTheFly=Charger l'arbre d'indexes \u00e0 la vol\u00e9e 
(signifie moins de m\u00e9moire utilis\u00e9e, mais plus de temps CPU 
consomm\u00e9)

-thaw.plugin.index.indexLoading=Chargement d'indexes
+thaw.plugin.index.indexLoading=Chargement de l'index

 thaw.plugin.index.blackList=Liste noire d'indexes
 thaw.plugin.index.editBlackList=Editer la liste noire d'indexes


Reply via email to