← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5658: Fixed problem in loading the Locales in User settings and code style stuff.

 

------------------------------------------------------------
revno: 5658
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-01-04 17:03:24 +0700
message:
  Fixed problem in loading the Locales in User settings and code style stuff.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java
  dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/locale/UserSettingLocaleManager.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetGeneralSettingsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetGeneralSettingsAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml


--
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-04 07:00:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java	2012-01-04 10:03:24 +0000
@@ -115,14 +115,8 @@
 
             Map<String, String> translationsCurrentLocale = convertTranslations( translations );
 
-            Collection<Translation> translationsFallback = null; // Not
-                                                                    // initialized
-                                                                    // unless
-                                                                    // needed
-            Map<String, String> translationsFallbackLocale = null; // Not
-                                                                    // initialized
-                                                                    // unless
-                                                                    // needed
+            Collection<Translation> translationsFallback = null; // Not initialized unless needed
+            Map<String, String> translationsFallbackLocale = null; // Not initialized unless needed
 
             List<String> propertyNames = i18nObject.getPropertyNames();
 
@@ -171,16 +165,10 @@
 
         if ( i18nObject != null && locale != null )
         {
-            Collection<Translation> allTranslations = translationService.getTranslations( i18nObject.getClassName(),
-                locale );
+            Collection<Translation> allTranslations = translationService.getTranslations( i18nObject.getClassName(), locale );
 
-            Collection<Translation> fallbackTranslations = null; // Not
-                                                                    // initialized
-                                                                    // unless
-                                                                    // needed
-            Map<String, String> fallbackTranslationsMap = null; // Not
-                                                                // initialized
-                                                                // unless needed
+            Collection<Translation> fallbackTranslations = null; // Not initialized unless needed
+            Map<String, String> fallbackTranslationsMap = null; // Not initialized unless needed
 
             for ( Object object : intObjects )
             {

=== modified file 'dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/locale/UserSettingLocaleManager.java'
--- dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/locale/UserSettingLocaleManager.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-i18n/src/main/java/org/hisp/dhis/i18n/locale/UserSettingLocaleManager.java	2012-01-04 10:03:24 +0000
@@ -35,7 +35,8 @@
 
 /**
  * @author Torgeir Lorange Ostby
- * @version $Id: UserSettingLocaleManager.java 6335 2008-11-20 11:11:26Z larshelg $
+ * @version $Id: UserSettingLocaleManager.java 6335 2008-11-20 11:11:26Z
+ *          larshelg $
  */
 public class UserSettingLocaleManager
     implements LocaleManager

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetGeneralSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetGeneralSettingsAction.java	2011-10-06 09:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/GetGeneralSettingsAction.java	2012-01-04 10:03:24 +0000
@@ -74,11 +74,18 @@
         this.i18nService = i18nService;
     }
 
-    private LocaleManager localeManager;
-
-    public void setLocaleManager( LocaleManager localeManager )
-    {
-        this.localeManager = localeManager;
+    private LocaleManager localeManagerDB;
+
+    public void setLocaleManagerDB( LocaleManager localeManagerDB )
+    {
+        this.localeManagerDB = localeManagerDB;
+    }
+
+    private LocaleManager localeManagerInterface;
+
+    public void setLocaleManagerInterface( LocaleManager localeManagerInterface )
+    {
+        this.localeManagerInterface = localeManagerInterface;
     }
 
     private SortOrderManager sortOrderManager;
@@ -189,7 +196,7 @@
     {
         return autoSave;
     }
-    
+
     private String currentStyle;
 
     public String getCurrentStyle()
@@ -225,7 +232,7 @@
             }
         } );
 
-        currentLocale = localeManager.getCurrentLocale();
+        currentLocale = localeManagerInterface.getCurrentLocale();
 
         // ---------------------------------------------------------------------
         // Get available locales in db
@@ -233,12 +240,12 @@
 
         availableLocalesDb = new ArrayList<Locale>( i18nService.getAvailableLocales() );
 
-        if ( !availableLocales.contains( localeManager.getFallbackLocale() ) )
+        if ( !availableLocalesDb.contains( localeManagerDB.getFallbackLocale() ) )
         {
-            availableLocales.add( localeManager.getFallbackLocale() );
+            availableLocalesDb.add( localeManagerDB.getFallbackLocale() );
         }
 
-        Collections.sort( availableLocales, new Comparator<Locale>()
+        Collections.sort( availableLocalesDb, new Comparator<Locale>()
         {
             public int compare( Locale locale0, Locale locale1 )
             {
@@ -246,7 +253,7 @@
             }
         } );
 
-        currentLocaleDb = localeManager.getCurrentLocale();
+        currentLocaleDb = localeManagerDB.getCurrentLocale();
 
         // ---------------------------------------------------------------------
         // Get Sort orders

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetGeneralSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetGeneralSettingsAction.java	2011-10-06 09:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/user/SetGeneralSettingsAction.java	2012-01-04 10:03:24 +0000
@@ -166,7 +166,7 @@
         userSettingService.saveUserSetting( KEY_CHARTS_IN_DASHBOARD, chartsInDashboard );
 
         userSettingService.saveUserSetting( AUTO_SAVE_DATA_ENTRY_FORM, autoSave );
-        
+
         return SUCCESS;
     }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2011-12-10 12:23:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2012-01-04 10:03:24 +0000
@@ -56,9 +56,12 @@
     <property name="i18nService">
       <ref bean="org.hisp.dhis.i18n.I18nService" />
     </property>
-    <property name="localeManager">
+    <property name="localeManagerInterface">
       <ref bean="org.hisp.dhis.i18n.locale.LocaleManager" />
     </property>
+    <property name="localeManagerDB">
+      <ref bean="org.hisp.dhis.i18n.locale.LocaleManagerDb" />
+    </property>
     <property name="sortOrderManager">
       <ref bean="org.hisp.dhis.options.sortorder.SortOrderManager" />
     </property>