use variable for recurring function call
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 28 May 2008 11:56:30 +0000 (13:56 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 28 May 2008 11:56:30 +0000 (13:56 +0200)
src/net/pterodactylus/jsite/gui/SwingInterface.java

index 9531717..eef499b 100644 (file)
@@ -547,7 +547,8 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh
                };
                List<Locale> availableLanguages = I18n.findAvailableLanguages();
                for (final Locale locale: availableLanguages) {
-                       I18nAction languageAction = new I18nAction("general.language." + locale.getLanguage(), IconLoader.loadIcon("/flag-" + locale.getLanguage() + ".png")) {
+                       String language = locale.getLanguage();
+                       I18nAction languageAction = new I18nAction("general.language." + language, IconLoader.loadIcon("/flag-" + language + ".png")) {
 
                                @SuppressWarnings("synthetic-access")
                                public void actionPerformed(ActionEvent e) {
@@ -555,7 +556,7 @@ public class SwingInterface implements CoreListener, LoggingListener, PropertyCh
                                }
 
                        };
-                       if (I18n.getLocale().getLanguage().equals(locale.getLanguage())) {
+                       if (I18n.getLocale().getLanguage().equals(language)) {
                                languageAction.setEnabled(false);
                        }
                        languageActions.add(languageAction);