From 628f59ba547ceb3de3a9f048f2bdc7e2c57d44af Mon Sep 17 00:00:00 2001 From: ile123ile Date: Sun, 31 Aug 2014 17:14:25 -0700 Subject: [PATCH] Made localized normal bundle take precedence over default custom locale bundles --- .../gmail/nossr50/locale/LocaleLoader.java | 34 ++++++++----------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java b/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java index 2e083d58d..f65875b81 100644 --- a/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java +++ b/src/main/java/com/gmail/nossr50/locale/LocaleLoader.java @@ -37,31 +37,27 @@ public final class LocaleLoader { initialize(); } - for(ResourceBundle bundle : bundles) { - if(bundle.containsKey(key)) { - return getString(key, bundle, messageArguments); + for(ResourceBundle customBundle : bundles) { + if(customBundle.containsKey(key)) { + return getString(key, customBundle, messageArguments); } } - for(ResourceBundle bundle : defaultBundles) { - if(bundle.containsKey(key)) { - return getString(key, bundle, messageArguments); + if(bundle.containsKey(key)) { + return getString(key, bundle, messageArguments); + } + for(ResourceBundle defaultCustomBundle : defaultBundles) { + if(defaultCustomBundle.containsKey(key)) { + return getString(key, defaultCustomBundle, messageArguments); } } - try { - return getString(key, bundle, messageArguments); + if(enBundle.containsKey(key)) { + return getString(key, enBundle, messageArguments); + } + if (!key.contains("Guides")) { + mcMMO.p.getLogger().warning("Could not find locale string: " + key); } - catch (MissingResourceException ex) { - try { - return getString(key, enBundle, messageArguments); - } - catch (MissingResourceException ex2) { - if (!key.contains("Guides")) { - mcMMO.p.getLogger().warning("Could not find locale string: " + key); - } - return '!' + key + '!'; - } - } + return '!' + key + '!'; } private static String getString(String key, ResourceBundle bundle, Object... messageArguments) throws MissingResourceException {