X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Futils%2Fresources%2FBundle.java;h=2039d578e3c581a98efabad7369dbd0c879ed626;hb=80383c142f85a7850d0fbea418689608fdccac05;hp=78d73a8148088619180caa59aa50fffcc2d50d40;hpb=2cce3dcb72c55aa5cca66e1398f23906e286abc8;p=nikiroo-utils.git diff --git a/src/be/nikiroo/utils/resources/Bundle.java b/src/be/nikiroo/utils/resources/Bundle.java index 78d73a8..2039d57 100644 --- a/src/be/nikiroo/utils/resources/Bundle.java +++ b/src/be/nikiroo/utils/resources/Bundle.java @@ -57,7 +57,7 @@ public class Bundle> { * resource file) */ public String getString(E id) { - return getStringX(id, ""); + return getStringX(id, null); } /** @@ -74,8 +74,7 @@ public class Bundle> { */ public String getStringX(E id, String suffix) { String key = id.name() - + ((suffix == null || suffix.isEmpty()) ? "" : "_" - + suffix.toUpperCase()); + + (suffix == null ? "" : "_" + suffix.toUpperCase()); if (containsKey(key)) { return getString(key).trim(); @@ -180,10 +179,11 @@ public class Bundle> { } /** - * Create/update the .properties file. Will use the most likely candidate as - * base if the file does not already exists and this resource is - * translatable (for instance, "en_US" will use "en" as a base if the - * resource is a translation file). + * Create/update the .properties file. + *

+ * Will use the most likely candidate as base if the file does not already + * exists and this resource is translatable (for instance, "en_US" will use + * "en" as a base if the resource is a translation file). * * @param path * the path where the .properties files are @@ -219,6 +219,13 @@ public class Bundle> { writer.close(); } + /** + * Reload the {@link Bundle} data files. + */ + public void reload() { + setBundle(name, null); + } + /** * Check if the internal map contains the given key. * @@ -367,7 +374,7 @@ public class Bundle> { value = ""; } - String[] lines = value.replaceAll("\\\t", "\\\\\\t").split("\n"); + String[] lines = value.replaceAll("\t", "\\t").split("\n"); for (int i = 0; i < lines.length; i++) { writer.write(lines[i]); if (i < lines.length - 1) {