Changeset 1065 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-11-02T15:06:01+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r1062 r1065 404 404 synchronized public Collection<String> getCollection(String key, Collection<String> def) { 405 405 String s = get(key); 406 if(s != null )406 if(s != null && s.length() != 0) 407 407 { 408 408 /* handle old comma separated stuff - remove in future */ -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r1059 r1065 173 173 localeName = (String)(args.get("language").toArray()[0]); 174 174 175 //TODO: Check preferences for language 176 177 //If override then set new default locale - otherwise, override 178 if (localeName != null) { 179 Locale.setDefault(new Locale(localeName)); 180 } 181 175 if (localeName == null) { 176 localeName = Main.pref.get("language", null); 177 } 178 179 if (localeName != null) { 180 Locale l; 181 int i = localeName.indexOf('_'); 182 if (i > 0) { 183 l = new Locale(localeName.substring(0, i), localeName.substring(i + 1)); 184 } else { 185 l = new Locale(localeName); 186 } 187 Locale.setDefault(l); 188 } 182 189 try { 183 190 i18n = I18nFactory.getI18n(MainApplication.class); -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r1053 r1065 123 123 // order is important! 124 124 settings.add(new LafPreference()); 125 settings.add(new LanguagePreference()); 125 126 settings.add(new DrawingPreference()); 126 127 settings.add(new ColorPreference()); -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r1058 r1065 3 3 4 4 import java.text.MessageFormat; 5 import java.util.Arrays; 6 import java.util.Comparator; 7 import java.util.Locale; 8 import java.util.Vector; 5 9 6 10 /** … … 10 14 */ 11 15 public class I18n { 16 17 /* Base name for translation data. Used for detecting available translations */ 18 private static final String TR_BASE = "org.openstreetmap.josm.i18n.Translation_"; 19 12 20 /** 13 21 * Set by MainApplication. Changes here later will probably mess up everything, because … … 43 51 return i18n.trn(text, pluralText, n); 44 52 } 53 54 /** 55 * Get a list of all available JOSM Translations. 56 * @return an array of locale objects. 57 */ 58 public static final Locale[] getAvailableTranslations() { 59 Vector<Locale> v = new Vector<Locale>(); 60 Locale[] l = Locale.getAvailableLocales(); 61 for (int i = 0; i < l.length; i++) { 62 String cn = TR_BASE + l[i]; 63 try { 64 Class.forName(cn); 65 v.add(l[i]); 66 } catch (ClassNotFoundException e) { 67 } 68 } 69 l = new Locale[v.size()]; 70 l = v.toArray(l); 71 Arrays.sort(l, new Comparator<Locale>() { 72 public int compare(Locale o1, Locale o2) { 73 return o1.toString().compareTo(o2.toString()); 74 } 75 }); 76 return l; 77 } 45 78 }
Note:
See TracChangeset
for help on using the changeset viewer.