Changeset 4211 in josm
- Timestamp:
- 2011-07-08T21:03:14+02:00 (13 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/I18n.java
r4171 r4211 286 286 for (String loc : languages.keySet()) { 287 287 if(Main.class.getResource("/data/"+loc+".lang") != null) { 288 int i = loc.indexOf('_'); 289 if (i > 0) { 290 v.add(new Locale(loc.substring(0, i), loc.substring(i + 1))); 291 } else { 292 v.add(new Locale(loc)); 293 } 288 v.add(LanguageInfo.getLocale(loc)); 294 289 } 295 290 } … … 322 317 languages.put("fr", PluralMode.MODE_GREATERONE); 323 318 languages.put("gl", PluralMode.MODE_NOTONE); 319 languages.put("he", PluralMode.MODE_NOTONE); 320 //languages.put("id", PluralMode.MODE_NONE); 324 321 languages.put("is", PluralMode.MODE_NOTONE); 325 322 languages.put("it", PluralMode.MODE_NOTONE); 326 languages.put("iw_IL", PluralMode.MODE_NOTONE);327 323 languages.put("ja", PluralMode.MODE_NONE); 328 324 languages.put("nb", PluralMode.MODE_NOTONE); … … 594 590 public static void set(String localeName){ 595 591 if (localeName != null) { 596 Locale l; 597 if (localeName.equals("he")) { 598 localeName = "iw_IL"; 599 } 600 int i = localeName.indexOf('_'); 601 if (i > 0) { 602 l = new Locale(localeName.substring(0, i), localeName.substring(i + 1)); 603 } else { 604 l = new Locale(localeName); 605 } 606 if (load(localeName)) { 592 Locale l = LanguageInfo.getLocale(localeName); 593 if (load(LanguageInfo.getJOSMLocaleCode(l))) { 607 594 Locale.setDefault(l); 608 595 } else { -
trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java
r3589 r4211 67 67 if (full.equals("iw_IL")) 68 68 return "he"; 69 else if (full.equals("in")) 70 return "id"; 69 71 /* list of non-single codes supported by josm */ 70 72 else if (full.equals("en_GB") || full.equals("pt_BR") || full.equals("en_AU") || full.equals("zh_TW") || full.equals("zh_CN")) … … 72 74 73 75 return locale.getLanguage(); 76 } 77 78 /** 79 * Replies the locale code used by Java for a given locale. 80 * 81 * In most cases JOSM and Java uses the same codes, but for some exceptions this is needed. 82 * 83 * @param code the locale code. 84 * @return the resulting locale 85 */ 86 static public Locale getLocale(String localeName) { 87 if (localeName.equals("he")) { 88 localeName = "iw_IL"; 89 } 90 else if (localeName.equals("id")) { 91 localeName = "in"; 92 } 93 Locale l; 94 int i = localeName.indexOf('_'); 95 if (i > 0) { 96 l = new Locale(localeName.substring(0, i), localeName.substring(i + 1)); 97 } else { 98 l = new Locale(localeName); 99 } 100 return l; 74 101 } 75 102
Note:
See TracChangeset
for help on using the changeset viewer.