+
+ public static Object getLocalized(Dictionary<String, Object> properties, String key, Locale locale) {
+ if (locale == null)
+ return null;
+ Object value = null;
+ value = properties.get(key + ";lang-" + locale.getLanguage() + "-" + locale.getCountry());
+ if (value == null)
+ value = properties.get(key + ";lang-" + locale.getLanguage());
+ return value;
+ }
+
+ public static String toLocalizedKey(String key, Locale locale) {
+ String country = locale.getCountry();
+ if ("".equals(country)) {
+ return key + ";lang-" + locale.getLanguage();
+ } else {
+ return key + ";lang-" + locale.getLanguage() + "-" + locale.getCountry();
+ }
+ }