X-Git-Url: http://git.nikiroo.be/?p=nikiroo-utils.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fresources%2FBundle.java;h=78d73a8148088619180caa59aa50fffcc2d50d40;hp=1c63d69f04f84276eeaf19ee3a29e028f52fae54;hb=2cce3dcb72c55aa5cca66e1398f23906e286abc8;hpb=72c32e8891f0964080f957fb6f4ff332b2ca203f diff --git a/src/be/nikiroo/utils/resources/Bundle.java b/src/be/nikiroo/utils/resources/Bundle.java index 1c63d69..78d73a8 100644 --- a/src/be/nikiroo/utils/resources/Bundle.java +++ b/src/be/nikiroo/utils/resources/Bundle.java @@ -8,7 +8,6 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Reader; -import java.io.UnsupportedEncodingException; import java.io.Writer; import java.lang.reflect.Field; import java.util.ArrayList; @@ -18,9 +17,6 @@ import java.util.MissingResourceException; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; -import be.nikiroo.utils.resources.Bundles; -import be.nikiroo.utils.resources.Meta; - /** * This class encapsulate a {@link ResourceBundle} in UTF-8. It only allows to * retrieve values associated to an enumeration, and allows some additional @@ -241,26 +237,17 @@ public class Bundle> { } /** - * Get the value for the given key if it exists in the internal map. + * Get the value for the given key if it exists in the internal map, or NULL + * if not. * * @param key * the key to check for * - * @return true if it does + * @return the value, or NULL */ protected String getString(String key) { if (containsKey(key)) { - try { - // Note: it is also possible to fix the borked charset issue - // with a custom ResourceBundle#Control class, but this one, - // while a workaround, depend less upon the JRE classes, which - // may change - return new String(map.getString(key).getBytes("ISO-8859-1"), - "UTF-8"); - } catch (UnsupportedEncodingException e) { - // Those 2 encodings are always supported - e.printStackTrace(); - } + return map.getString(key); } return null; @@ -432,7 +419,7 @@ public class Bundle> { if (map == null) { map = ResourceBundle.getBundle(type.getPackage().getName() + "." - + name.name(), locale); + + name.name(), locale, new FixedResourceBundleControl()); } }