Skip to content

Commit

Permalink
No partial fallbacks for bundles are allowed anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-kolb committed Sep 24, 2015
1 parent 7ca13c3 commit 4a1c4fa
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/main/java/net/sf/jabref/logic/l10n/Localization.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,17 @@ public static void setLanguage(String language) {

// silent fallback to system locale when bundle is not found
if(!messages.getLocale().equals(locale)) {
LOGGER.warn("Tried loading <" + RESOURCE_PREFIX + "> for locale <" + locale + "> but had to fall back to default locale <" + defaultLocale + ">");
}

if(!menuTitles.getLocale().equals(locale)) {
LOGGER.warn("Tried loading <" + MENU_RESOURCE_PREFIX + "> for locale <" + locale + "> but had to fall back to default locale <" + defaultLocale + ">");
}

if(!intMessages.getLocale().equals(locale)) {
LOGGER.warn("Tried loading <" + INTEGRITY_RESOURCE_PREFIX + "> for locale <" + locale + "> but had to fall back to default locale <" + defaultLocale + ">");
LOGGER.warn("Bundle for locale <" + locale + "> not found. Falling back to system locale <" + defaultLocale + ">");
}
} catch(MissingResourceException e) {
LOGGER.warn("Fallback to system locale <" + defaultLocale + "> failed, using locale <en> instead");
LOGGER.warn("Bundle for locale <" + locale + "> not found. Fallback to system locale <" + defaultLocale + "> failed, using locale <en> instead");

locale = new Locale("en");
messages = ResourceBundle.getBundle(RESOURCE_PREFIX, locale, new EncodingControl("UTF-8"));
menuTitles = ResourceBundle.getBundle(MENU_RESOURCE_PREFIX, locale, new EncodingControl("UTF-8"));
intMessages = ResourceBundle.getBundle(INTEGRITY_RESOURCE_PREFIX, locale, new EncodingControl("UTF-8"));
} finally {
// Set consistent VM locales
Locale.setDefault(locale);
javax.swing.JComponent.setDefaultLocale(locale);
}
Expand Down

0 comments on commit 4a1c4fa

Please sign in to comment.