writer.println("private native void ensureNativeDisplayNames() /*-{");
writer.println(" if (this.@" + qualName + "::nativeDisplayNames != null) {");
writer.println(" return;");
writer.println(" }");
writer.println(" this.@" + qualName + "::nativeDisplayNames = {");
LocalizedProperties displayNames = new LocalizedProperties();
LocalizedProperties displayNamesManual = new LocalizedProperties();
LocalizedProperties displayNamesOverride = new LocalizedProperties();
ClassLoader classLoader = getClass().getClassLoader();
try {
InputStream str = classLoader.getResourceAsStream(GENERATED_LOCALE_NATIVE_DISPLAY_NAMES);
if (str != null) {
displayNames.load(str, "UTF-8");
}
str = classLoader.getResourceAsStream(MANUAL_LOCALE_NATIVE_DISPLAY_NAMES);
if (str != null) {
displayNamesManual.load(str, "UTF-8");
}
str = classLoader.getResourceAsStream(OVERRIDE_LOCALE_NATIVE_DISPLAY_NAMES);
if (str != null) {
displayNamesOverride.load(str, "UTF-8");
}
} catch (UnsupportedEncodingException e) {
// UTF-8 should always be defined
logger.log(TreeLogger.ERROR, "UTF-8 encoding is not defined", e);
throw new UnableToCompleteException();
} catch (IOException e) {
logger.log(TreeLogger.ERROR, "Exception reading locale display names", e);
throw new UnableToCompleteException();
}
boolean needComma = false;
for (String propval : localeValues) {
String displayName = displayNamesOverride.getProperty(propval);
if (displayName == null) {
displayName = displayNamesManual.getProperty(propval);
}
if (displayName == null) {
displayName = displayNames.getProperty(propval);