Author: nextgens
Date: 2007-05-30 23:22:43 +0000 (Wed, 30 May 2007)
New Revision: 13406

Modified:
   trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
Log:
Now the wizard will auto-detect the l10n file to use depending on the Locale

Modified: trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2007-05-30 22:57:52 UTC (rev 13405)
+++ trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2007-05-30 23:22:43 UTC (rev 13406)
@@ -8,6 +8,7 @@
 import java.net.NetworkInterface;
 import java.net.URI;
 import java.util.Enumeration;
+import java.util.Locale;

 import freenet.client.HighLevelSimpleClient;
 import freenet.config.Config;
@@ -61,7 +62,18 @@
                        HTMLNode languageForm = 
ctx.addFormChild(languageInfoboxContent, ".", "languageForm");
                        HTMLNode result = languageForm.addChild("select", 
"name", "language");

-                       result.addChild("option", new String[] { "value", 
"selected" }, new String[] { "en", "selected" }, "English");
+                       Locale currentLocale = Locale.getDefault();
+                       boolean isTranslationFound = false;
+                       for(int i=0; i<L10n.AVAILABLE_LANGUAGES.length; i++) {
+                               if(isTranslationFound = 
L10n.AVAILABLE_LANGUAGES[i].equals(currentLocale.getCountry().toLowerCase()))
+                                       break;
+                       }
+                       
+                       if(isTranslationFound) {
+                               result.addChild("option", new String[] { 
"value", "selected" }, new String[] { 
Locale.getDefault().getCountry().toLowerCase(), "selected" }, 
Locale.getDefault().getDisplayName());
+                               result.addChild("option", "value", "en", 
"English");
+                       } else
+                               result.addChild("option", new String[] { 
"value", "selected" }, new String[] { "en" , "selected" }, "English");          
               
                        result.addChild("option", "value", "fr", "Fran?ais");
                        result.addChild("option", "value", "pl", "Polski");
                        result.addChild("option", "value", "it", "Italiano");


Reply via email to