+
+ /**
+ * Returns the current locale.
+ *
+ * @return The current locale
+ */
+ public static Locale getLocale() {
+ return currentLocale;
+ }
+
+ /**
+ * Finds all available locales.
+ *
+ * @return All available locales
+ */
+ public static List<Locale> findAvailableLanguages() {
+ List<Locale> availableLanguages = new ArrayList<Locale>();
+ availableLanguages.add(Locale.ENGLISH);
+ availableLanguages.add(Locale.GERMAN);
+ return availableLanguages;
+ }
+
+ /**
+ * Registers the given I18nable to be updated when the language is changed.
+ *
+ * @param i18nable
+ * The i18nable to register
+ */
+ public static void registerI18nable(I18nable i18nable) {
+ i18nables.add(i18nable);
+ }
+
+ /**
+ * Deregisters the given I18nable to be updated when the language is
+ * changed.
+ *
+ * @param i18nable
+ * The i18nable to register
+ */
+ public static void deregisterI18nable(I18nable i18nable) {
+ i18nables.remove(i18nable);
+ }
+
+ //
+ // PRIVATE METHODS
+ //
+
+ /**
+ * Notifies all registered {@link I18nable}s that the language was changed.
+ */
+ private static void notifyI18nables() {
+ for (I18nable i18nable: i18nables) {
+ i18nable.updateI18n();
+ }
+ }
+