Changeset 1802 in josm for trunk/src/org/openstreetmap/josm/gui/MainApplication.java
- Timestamp:
- 2009-07-17T20:53:35+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r1677 r1802 3 3 package org.openstreetmap.josm.gui; 4 4 5 import static org.openstreetmap.josm.tools.I18n.i18n;6 5 import static org.openstreetmap.josm.tools.I18n.tr; 7 6 … … 15 14 import java.util.LinkedList; 16 15 import java.util.List; 17 import java.util.Locale;18 16 import java.util.Map; 19 import java.util.MissingResourceException;20 17 21 18 import javax.swing.JFrame; … … 25 22 import org.openstreetmap.josm.tools.BugReportExceptionHandler; 26 23 import org.openstreetmap.josm.tools.ImageProvider; 27 import org. xnap.commons.i18n.I18nFactory;24 import org.openstreetmap.josm.tools.I18n; 28 25 29 26 /** … … 63 60 */ 64 61 public static void main(final String[] argArray) { 65 /* try initial language settings, may be changed later again */ 66 try { i18n = I18nFactory.getI18n(MainApplication.class); } 67 catch (MissingResourceException ex) { Locale.setDefault(Locale.ENGLISH);} 62 I18n.init(); 68 63 69 64 Thread.setDefaultUncaughtExceptionHandler(new BugReportExceptionHandler()); … … 92 87 Main.pref.init(args.containsKey("reset-preferences")); 93 88 94 String localeName = null; // The locale to use95 96 89 // Check if passed as parameter 97 90 if (args.containsKey("language")) 98 localeName = (String)(args.get("language").toArray()[0]); 99 100 if (localeName == null) 101 localeName = Main.pref.get("language", null); 102 103 if (localeName != null) { 104 Locale l; 105 Locale d = Locale.getDefault(); 106 if (localeName.equals("he")) localeName = "iw_IL"; 107 int i = localeName.indexOf('_'); 108 if (i > 0) { 109 l = new Locale(localeName.substring(0, i), localeName.substring(i + 1)); 110 } else { 111 l = new Locale(localeName); 112 } 113 try { 114 Locale.setDefault(l); 115 i18n = I18nFactory.getI18n(MainApplication.class); 116 } catch (MissingResourceException ex) { 117 if (!l.getLanguage().equals("en")) { 118 System.out.println(tr("Unable to find translation for the locale {0}. Reverting to {1}.", 119 l.getDisplayName(), d.getDisplayName())); 120 Locale.setDefault(d); 121 } else { 122 i18n = null; 123 } 124 } 125 } 91 I18n.set((String)(args.get("language").toArray()[0])); 92 else 93 I18n.set(Main.pref.get("language", null)); 126 94 127 95 if (argList.contains("--help") || argList.contains("-?") || argList.contains("-h")) {
Note:
See TracChangeset
for help on using the changeset viewer.