44 |
*/ |
*/ |
45 |
public static Locale getLocaleFor(String code) { |
public static Locale getLocaleFor(String code) { |
46 |
for (Locale l : Locale.getAvailableLocales()) { |
for (Locale l : Locale.getAvailableLocales()) { |
47 |
// System.out.println(l.getLanguage()+" not = "+code); |
if (l.getLanguage().equals(code.toLowerCase())) { |
|
if (l.getLanguage().toLowerCase().equals(code.toLowerCase())) { |
|
48 |
return l; |
return l; |
49 |
} |
} |
50 |
|
LOGGER.debug(l.getLanguage() + " not = " + code); |
51 |
} |
} |
52 |
|
|
53 |
LOGGER.error("Can't create a Locale for code " + code |
LOGGER.error("Can't create a Locale for code " + code |
54 |
+ "! Returning the system default locale to avoid NPEs."); |
+ "! Returning the system default locale to avoid NPEs."); |
55 |
|
|
56 |
return Locale.getDefault(); |
return Locale.getDefault(); |
57 |
} |
} |
58 |
|
|