← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5755: WIP db i18n

 

------------------------------------------------------------
revno: 5755
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-01-19 14:00:51 +0100
message:
  WIP db i18n
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java	2012-01-19 11:43:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java	2012-01-19 13:00:51 +0000
@@ -38,6 +38,8 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.List;
@@ -233,7 +235,17 @@
     
     public List<Locale> getAvailableLocales()
     {
-        return Arrays.asList( DateFormat.getAvailableLocales() );
+        List<Locale> locales = Arrays.asList( DateFormat.getAvailableLocales() );
+        
+        Collections.sort( locales, new Comparator<Locale>()
+            {
+                public int compare( Locale l1, Locale l2 )
+                {
+                    return l1.getDisplayName().compareTo( l2.getDisplayName() );
+                }
+            } );
+        
+        return locales;
     }
 
     // -------------------------------------------------------------------------