Changeset 1802 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2009-07-17T20:53:35+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/I18n.java
r1583 r1802 7 7 import java.util.Locale; 8 8 import java.util.LinkedList; 9 import java.util.MissingResourceException; 9 10 import java.util.Vector; 11 import org.openstreetmap.josm.gui.MainApplication; 12 import org.xnap.commons.i18n.I18nFactory; 10 13 11 14 /** … … 89 92 return l; 90 93 } 94 95 public static void init() 96 { 97 /* try initial language settings, may be changed later again */ 98 try { i18n = I18nFactory.getI18n(MainApplication.class); } 99 catch (MissingResourceException ex) { Locale.setDefault(Locale.ENGLISH);} 100 } 101 102 public static void set(String localeName) 103 { 104 if (localeName != null) { 105 Locale l; 106 Locale d = Locale.getDefault(); 107 if (localeName.equals("he")) localeName = "iw_IL"; 108 int i = localeName.indexOf('_'); 109 if (i > 0) { 110 l = new Locale(localeName.substring(0, i), localeName.substring(i + 1)); 111 } else { 112 l = new Locale(localeName); 113 } 114 try { 115 Locale.setDefault(l); 116 i18n = I18nFactory.getI18n(MainApplication.class); 117 } catch (MissingResourceException ex) { 118 if (!l.getLanguage().equals("en")) { 119 System.out.println(tr("Unable to find translation for the locale {0}. Reverting to {1}.", 120 l.getDisplayName(), d.getDisplayName())); 121 Locale.setDefault(d); 122 } else { 123 i18n = null; 124 } 125 } 126 } 127 } 91 128 }
Note:
See TracChangeset
for help on using the changeset viewer.