I've created a localization table in my project's res-file using LWUIT Resource editor. But it turns out, that I don't know how to switch through different localizations. How can I set up a global language for my program?
This code can merge two diffrent localizations to one.(the default save in bundle and merge with new localization mergeL10N(these objects are hashTable))
if (themeName != null && !themeName.equals(this.currThemeName)) {
try {
if (themeName.equals(DEFAULT_THEME_NAME)) {
defaultTheme = Resources.open(DEFAULT_THEME_NAME);
bundle = null;
} else {
defaultTheme = Resources.open(DEFAULT_THEME_NAME);
bundle = Resources.open(themeName);
}
mergeL10N = defaultTheme.getL10N("Localization (L10N) 1", "iw");
if (bundle != null) {
mergeHashtable(mergeL10N, bundle.getL10N("Localization (L10N) 1", "iw"));
}
UIManager.getInstance().setResourceBundle(mergeL10N);
}
} catch (Exception e) {
e.printStackTrace();
}
}