Update of /cvsroot/osmose-dev/osmose/src/osmose/application/dialog
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31107/src/osmose/application/dialog
Modified Files:
OSMDialogApplicationPreferences.java
Log Message:
Language switching (feature request #1359770)
Index: OSMDialogApplicationPreferences.java
===================================================================
RCS file: /cvsroot/osmose-dev/osmose/src/osmose/application/dialog/OSMDialogApplicationPreferences.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OSMDialogApplicationPreferences.java 3 Oct 2007 21:31:14 -0000 1.3
--- OSMDialogApplicationPreferences.java 3 Apr 2008 20:38:41 -0000 1.4
***************
*** 84,87 ****
--- 84,88 ----
m_AppDefaultMedia = ((Integer)OSMUser.USER.getProperty("media.default", new Integer(OSMApplication.Properties.getIntProp("OSM_DefaultMedia")))).intValue();
m_AppBrowser = (File)OSMUser.USER.getProperty("browser", new File(OSMApplication.Properties.getStringProp("OSM_Browser")));
+ m_AppDefaultLanguage = (String)OSMUser.USER.getProperty("language.default", OSMApplication.Properties.getStringProp("OSM_Language")+"_"+OSMApplication.Properties.getStringProp("OSM_Country"));
m_LabelAuthor = (String)OSMUser.USER.getProperty("labels.author", OSMApplication.Localisation.getString("OSM_LabelsAuthor"));
m_LabelVersion = (String)OSMUser.USER.getProperty("labels.version", OSMApplication.Localisation.getString("OSM_LabelsVersion"));
***************
*** 113,117 ****
// m_MediaType2.put(new Integer(OSMMedia.TYPE_RTF), "Texte Riche");
m_MediaType2.put(new Integer(OSMMedia.TYPE_VID), OSMApplication.Localisation.getString("PRE_MediaVid"));
!
/**
--- 114,122 ----
// m_MediaType2.put(new Integer(OSMMedia.TYPE_RTF), "Texte Riche");
m_MediaType2.put(new Integer(OSMMedia.TYPE_VID), OSMApplication.Localisation.getString("PRE_MediaVid"));
!
! // available languages
! m_Languages = new Hashtable();
! m_Languages.put("English", "en_US");
! m_Languages.put("Français", "fr_FR");
/**
***************
*** 403,406 ****
--- 408,444 ----
pApp.add(eltPanel, new Rectangle(0, 5, 1, 2));
+ /**
+ * APPLICATION => Language.
+ */
+ JPanel pLanguage = new JPanel();
+ pLanguage.setLayout(new OSMGraphPaperLayout(new Dimension(3, 2), 1, 1));
+ JLabel lLanguageDefault1 = new JLabel(OSMApplication.Localisation.getString("DAP_TabAppLabelDefaultLanguage1"));
+ JLabel lLanguageDefault2 = new JLabel(OSMApplication.Localisation.getString("DAP_TabAppLabelDefaultLanguage2"));
+ JPanel plLanguage = new JPanel();
+ plLanguage.setLayout(new FlowLayout(FlowLayout.LEFT));
+ plLanguage.add(lLanguageDefault1);
+ plLanguage.add(lLanguageDefault2);
+ pLanguage.add(plLanguage, new Rectangle(0, 0, 2, 1));
+ final JComboBox cbLanguage = new JComboBox();
+ for(Enumeration enumer = m_Languages.keys();enumer.hasMoreElements();)
+ cbLanguage.addItem(enumer.nextElement());
+ cbLanguage.addKeyListener(this);
+ JPanel pcbLanguage = new JPanel();
+ pcbLanguage.setLayout(new FlowLayout(FlowLayout.RIGHT));
+ pcbLanguage.add(cbLanguage);
+ pLanguage.add(pcbLanguage, new Rectangle(2, 0, 1, 1));
+ cbLanguage.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ m_AppDefaultLanguage = (String)m_Languages.get((String)cbLanguage.getSelectedItem());
+ }
+ });
+ Iterator entries = m_Languages.entrySet().iterator();
+ while (entries.hasNext()) {
+ Map.Entry entry = (Map.Entry)entries.next();
+ if (entry.getValue().equals(m_AppDefaultLanguage)) {
+ cbLanguage.setSelectedItem(entry.getKey());
+ }
+ }
+ pApp.add(pLanguage, new Rectangle(0, 7, 1, 3));
/**
***************
*** 525,528 ****
--- 563,567 ----
OSMUser.USER.setProperty("labels.version", m_LabelVersion);
OSMUser.USER.setProperty("labels.htmltitle", m_LabelHTMLTitle);
+ OSMUser.USER.setProperty("language.default", m_AppDefaultLanguage);
***************
*** 586,589 ****
--- 625,630 ----
private JSpinner m_EltSize;
private JSpinner m_EltMaxSize;
+ private String m_AppDefaultLanguage;
+ private Hashtable m_Languages;
private boolean isSaved;
|