Changeset 15547 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2019-11-30T18:53:35+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/I18n.java
r15506 r15547 605 605 public static void set(String localeName) { 606 606 if (localeName != null) { 607 Locale l = LanguageInfo.getLocale(localeName );607 Locale l = LanguageInfo.getLocale(localeName, true); 608 608 if (load(LanguageInfo.getJOSMLocaleCode(l))) { 609 609 Locale.setDefault(l); -
trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java
r15475 r15547 197 197 */ 198 198 public static Locale getLocale(String localeName) { 199 return getLocale(localeName, false); 200 } 201 202 /** 203 * Replies the locale used by Java for a given language code. 204 * 205 * Accepts JOSM and Java codes as input. 206 * 207 * @param localeName the locale code. 208 * @param useDefaultCountry if {@code true}, the current locale country will be used if no country is specified 209 * @return the resulting locale 210 * @since 15547 211 */ 212 public static Locale getLocale(String localeName, boolean useDefaultCountry) { 199 213 int country = localeName.indexOf('_'); 200 214 int variant = localeName.indexOf('@'); … … 209 223 l = new Locale(localeName.substring(0, country), localeName.substring(country + 1)); 210 224 } else { 211 l = new Locale(localeName, Locale.getDefault().getCountry());225 l = new Locale(localeName, useDefaultCountry ? Locale.getDefault().getCountry() : ""); 212 226 } 213 227 return l;
Note:
See TracChangeset
for help on using the changeset viewer.