You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2010/08/10 08:39:10 UTC

svn commit: r983869 - /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java

Author: lofwyr
Date: Tue Aug 10 06:39:10 2010
New Revision: 983869

URL: http://svn.apache.org/viewvc?rev=983869&view=rev
Log:
Must the default locale be in the supported list? This question is not specified explicit and diffent implemented in the RI and MyFaces

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java?rev=983869&r1=983868&r2=983869&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/clientConfig/ClientConfigController.java Tue Aug 10 06:39:10 2010
@@ -129,11 +129,20 @@ public class ClientConfigController {
     Locale defaultLocale = application.getDefaultLocale();
     Iterator supportedLocales = application.getSupportedLocales();
 
+    boolean defaultInList = false;
     List<SelectItem> localeItems = new ArrayList<SelectItem>();
-    localeItems.add(createLocaleItem(defaultLocale));
     while (supportedLocales.hasNext()) {
       Locale locale = (Locale) supportedLocales.next();
       localeItems.add(createLocaleItem(locale));
+      if (locale.equals(defaultLocale)) {
+        defaultInList = true;
+      }
+    }
+    // If the default is already in the list, don't add it.
+    // Background: Must the default be in the supported list? Yes or No?
+    // This question is not specified explicit and different implemented in the RI and MyFaces
+    if (! defaultInList) {
+      localeItems.add(0, createLocaleItem(defaultLocale));
     }
     return localeItems;
   }