Author: nextgens
Date: 2007-04-20 23:05:58 +0000 (Fri, 20 Apr 2007)
New Revision: 12833

Modified:
   trunk/freenet/src/freenet/l10n/L10n.java
Log:
Rename (current|fallback)Properties => Translation; add a new getter

Modified: trunk/freenet/src/freenet/l10n/L10n.java
===================================================================
--- trunk/freenet/src/freenet/l10n/L10n.java    2007-04-20 22:58:43 UTC (rev 
12832)
+++ trunk/freenet/src/freenet/l10n/L10n.java    2007-04-20 23:05:58 UTC (rev 
12833)
@@ -30,13 +30,13 @@
        public static final String[] availableLanguages = { "en", "fr", "pl"};
        private String selectedLanguage = availableLanguages[0];

-       private static SimpleFieldSet currentProperties = null;
-       private static SimpleFieldSet fallbackProperties = null;
+       private static SimpleFieldSet currentTranslation = null;
+       private static SimpleFieldSet fallbackTranslation = null;
        private static L10n currentClass = null;

        L10n(String selected) {
                selectedLanguage = selected;
-               currentProperties = loadTranslation(selectedLanguage);
+               currentTranslation = loadTranslation(selectedLanguage);
        }

        /**
@@ -51,7 +51,7 @@
                                selectedLanguage = availableLanguages[i];
                                Logger.normal(CLASS_NAME, "Changing the current 
language to : " + selectedLanguage);
                                currentClass = new L10n(selectedLanguage);
-                               if(currentProperties == null) {
+                               if(currentTranslation == null) {
                                        currentClass = new 
L10n(availableLanguages[0]);
                                        throw new 
MissingResourceException("Unable to load the translation file for 
"+selectedLanguage, "l10n", selectedLanguage);
                                }
@@ -70,9 +70,13 @@
         * @param a property file
         */
        public static void setLanguage(SimpleFieldSet customLanguage) {
-               currentProperties = customLanguage;
+               currentTranslation = customLanguage;
        }

+       public static SimpleFieldSet getLanguage() {
+               return currentTranslation;
+       }
+       
        /**
         * The real meat
         * 
@@ -91,7 +95,7 @@
         * @see getString(String)
         */
        public static String getString(String key, boolean 
returnNullIfNotFound) {
-               String result = currentProperties.get(key);
+               String result = currentTranslation.get(key);
                if(result != null)
                        return result;
                else
@@ -117,9 +121,9 @@
        public static String getDefaultString(String key) {
                String result = null;
                // We instanciate it only if necessary
-               if(fallbackProperties == null) fallbackProperties = 
loadTranslation(availableLanguages[0]);
+               if(fallbackTranslation == null) fallbackTranslation = 
loadTranslation(availableLanguages[0]);

-               result = fallbackProperties.get(key);
+               result = fallbackTranslation.get(key);

                if(result != null) {
                        Logger.normal(CLASS_NAME, "The translation for " + key 
+ " hasn't been found! please tell the maintainer.");


Reply via email to