public String getString(final String language, final String key, final String defaultValue) {
final String l = language == null ? defaultLanguage : language;
// try to load bundle if is not loaded
XmlBundle b = bundles.get(l);
if(b == null) {
final File f = new File(this.bundleDir, l + ".xml");
if(f.exists()) {
try {
b = new XmlBundle(f);
bundles.put(l, b);
} catch (Exception ex) {
logger.error("Error to load bundle file (" + l + "): " + f);
}
}
}
final String result = b == null ? defaultValue : b.getString(key);
return result == null ? key : result;
}