← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5781: Removed DataBaseLocaleManager. Simplified i18n db logic

 

------------------------------------------------------------
revno: 5781
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-01-22 10:58:04 +0100
message:
  Removed DataBaseLocaleManager. Simplified i18n db logic
removed:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/locale/
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/locale/DatabaseLocaleManager.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mock/
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mock/MockLocaleManager.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java
  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/I18nService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/I18nAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
  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-api/src/main/java/org/hisp/dhis/user/UserSettingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java	2012-01-22 09:58:04 +0000
@@ -50,6 +50,7 @@
     final String KEY_STYLE_DIRECTORY = "stylesheetDirectory";
     final String KEY_MESSAGE_EMAIL_NOTIFICATION = "keyMessageEmailNotification";
     final String KEY_MESSAGE_SMS_NOTIFICATION = "keyMessageSmsNotification";
+    final String KEY_DB_LOCALE = "localeUserSetting";
 
     final int DEFAULT_CHARTS_IN_DASHBOARD = 4;
     final List<Integer> DASHBOARD_CHARTS_TO_DISPLAY = Arrays.asList( 4, 6, 8 );

=== 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-22 04:37:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java	2012-01-22 09:58:04 +0000
@@ -47,9 +47,9 @@
 
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.NameableObject;
-import org.hisp.dhis.i18n.locale.LocaleManager;
 import org.hisp.dhis.translation.Translation;
 import org.hisp.dhis.translation.TranslationService;
+import org.hisp.dhis.user.UserSettingService;
 
 /**
  * @author Oyvind Brucker
@@ -61,13 +61,6 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private LocaleManager localeManager;
-
-    public void setLocaleManager( LocaleManager localeManager )
-    {
-        this.localeManager = localeManager;
-    }
-
     private TranslationService translationService;
 
     public void setTranslationService( TranslationService translationService )
@@ -75,6 +68,13 @@
         this.translationService = translationService;
     }
 
+    private UserSettingService userSettingService;
+
+    public void setUserSettingService( UserSettingService userSettingService )
+    {
+        this.userSettingService = userSettingService;
+    }
+
     // -------------------------------------------------------------------------
     // Internationalise
     // -------------------------------------------------------------------------
@@ -83,11 +83,11 @@
     {
         if ( isCollection( object ) )
         {
-            internationaliseCollection( (Collection<?>) object, localeManager.getCurrentLocale() );
+            internationaliseCollection( (Collection<?>) object, getCurrentLocale() );
         }
         else
         {
-            internationaliseObject( object, localeManager.getCurrentLocale() );
+            internationaliseObject( object, getCurrentLocale() );
         }
     }
 
@@ -229,6 +229,11 @@
         }
     }
 
+    public Map<String, String> getTranslations( String className, int id )
+    {
+        return getTranslations( className, id, getCurrentLocale() );
+    }
+    
     public Map<String, String> getTranslations( String className, int id, Locale locale )
     {
         if ( locale != null && className != null )
@@ -238,6 +243,15 @@
         
         return new HashMap<String, String>();
     }
+
+    // -------------------------------------------------------------------------
+    // Locale
+    // -------------------------------------------------------------------------
+    
+    public Locale getCurrentLocale()
+    {
+        return (Locale) userSettingService.getUserSetting( UserSettingService.KEY_DB_LOCALE );
+    }
     
     public List<Locale> getAvailableLocales()
     {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nService.java	2012-01-20 10:00:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nService.java	2012-01-22 09:58:04 +0000
@@ -44,9 +44,9 @@
     // Internationalise
     // -------------------------------------------------------------------------
 
-    public void internationalise( Object object );
+    void internationalise( Object object );
     
-    public void internationalise( Object object, Locale locale );
+    void internationalise( Object object, Locale locale );
     
     Map<String, String> getObjectPropertyValues( Object object );
     
@@ -56,15 +56,23 @@
     // Object
     // -------------------------------------------------------------------------
 
-    public void removeObject( Object object );
+    void removeObject( Object object );
 
     // -------------------------------------------------------------------------
     // Translation
     // -------------------------------------------------------------------------
 
-    public void updateTranslation( String className, int id, Locale thisLocale, Map<String, String> translations );
-
-    public Map<String, String> getTranslations( String className, int id, Locale locale );
+    void updateTranslation( String className, int id, Locale thisLocale, Map<String, String> translations );
+
+    Map<String, String> getTranslations( String className, int id );
+
+    Map<String, String> getTranslations( String className, int id, Locale locale );
+    
+    // -------------------------------------------------------------------------
+    // Locale
+    // -------------------------------------------------------------------------
+
+    Locale getCurrentLocale();
     
     List<Locale> getAvailableLocales();
 }

=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/locale'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/locale/DatabaseLocaleManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/locale/DatabaseLocaleManager.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/locale/DatabaseLocaleManager.java	1970-01-01 00:00:00 +0000
@@ -1,94 +0,0 @@
-package org.hisp.dhis.i18n.locale;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import org.hisp.dhis.user.UserSettingService;
-
-/**
- * @author Tran Thanh Tri
- * @version $Id
- */
-public class DatabaseLocaleManager
-    implements LocaleManager
-{
-    private static final String KEY_USER_SETTING = "localeUserSetting";
-
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private UserSettingService userSettingService;
-
-    public void setUserSettingService( UserSettingService userSettingService )
-    {
-        this.userSettingService = userSettingService;
-    }
-
-    // -------------------------------------------------------------------------
-    // LocaleManager implementation
-    // -------------------------------------------------------------------------
-
-    @Override
-    public Locale getCurrentLocale()
-    {
-        return (Locale) userSettingService.getUserSetting( KEY_USER_SETTING, DHIS_STANDARD_LOCALE );
-    }
-
-    @Override
-    public void setCurrentLocale( Locale locale )
-    {
-        userSettingService.saveUserSetting( KEY_USER_SETTING, locale );
-    }
-
-    @Override
-    public List<Locale> getLocalesOrderedByPriority()
-    {
-        List<Locale> locales = new ArrayList<Locale>();
-
-        Locale userLocale = (Locale) userSettingService.getUserSetting( KEY_USER_SETTING, null );
-
-        if ( userLocale != null )
-        {
-            locales.add( userLocale );
-        }
-
-        locales.add( DHIS_STANDARD_LOCALE );
-
-        return locales;
-    }
-
-    @Override
-    public Locale getFallbackLocale()
-    {
-        return DHIS_STANDARD_LOCALE;
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-01-22 08:38:11 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-01-22 09:58:04 +0000
@@ -445,10 +445,6 @@
     <property name="translationStore" ref="org.hisp.dhis.translation.TranslationStore" />
   </bean>
 
-  <bean id="org.hisp.dhis.i18n.locale.LocaleManagerDb" class="org.hisp.dhis.i18n.locale.DatabaseLocaleManager">
-    <property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
-  </bean>
-
   <bean id="org.hisp.dhis.aggregation.AggregatedDataValueService" class="org.hisp.dhis.aggregation.DefaultAggregatedDataValueService">
     <property name="aggregatedDataValueStore" ref="org.hisp.dhis.aggregation.AggregatedDataValueStore" />
   </bean>
@@ -590,12 +586,8 @@
   <!-- I18nService -->
 
   <bean id="org.hisp.dhis.i18n.I18nService" class="org.hisp.dhis.i18n.DefaultI18nService">
-    <property name="localeManager">
-      <ref bean="org.hisp.dhis.i18n.locale.LocaleManagerDb" />
-    </property>
-    <property name="translationService">
-      <ref bean="org.hisp.dhis.translation.TranslationService" />
-    </property>
+    <property name="translationService" ref="org.hisp.dhis.translation.TranslationService" />
+	<property name="userSettingService" ref="org.hisp.dhis.user.UserSettingService" />
   </bean>
   
   <!-- Startup routine definitions -->

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java	2012-01-20 10:00:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java	2012-01-22 09:58:04 +0000
@@ -41,8 +41,6 @@
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.i18n.locale.LocaleManager;
-import org.hisp.dhis.mock.MockLocaleManager;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -54,8 +52,6 @@
 {
     private I18nService i18nService;
 
-    private LocaleManager localeManager;
-
     // -------------------------------------------------------------------------
     // Set up/tear down
     // -------------------------------------------------------------------------
@@ -66,11 +62,7 @@
     {
         i18nService = (I18nService) getBean( I18nService.ID );
         
-        localeManager = new MockLocaleManager();
-        
         dataElementService = (DataElementService) getBean( DataElementService.ID );
-        
-        setDependency( i18nService, "localeManager", localeManager );
     }
 
     // -------------------------------------------------------------------------

=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mock'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mock/MockLocaleManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mock/MockLocaleManager.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mock/MockLocaleManager.java	1970-01-01 00:00:00 +0000
@@ -1,79 +0,0 @@
-package org.hisp.dhis.mock;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import org.hisp.dhis.i18n.locale.LocaleManager;
-
-/**
- * @author Oyvind Brucker
- */
-public class MockLocaleManager
-    implements LocaleManager
-{
-    private Locale locale = null;
-
-    // -------------------------------------------------------------------------
-    // LocaleManager implementation
-    // -------------------------------------------------------------------------
-
-    public Locale getCurrentLocale()
-    {
-        return locale != null ? locale : DHIS_STANDARD_LOCALE;
-    }
-
-    public void setCurrentLocale( Locale locale )
-    {
-        this.locale = locale;
-    }
-
-    public List<Locale> getLocalesOrderedByPriority()
-    {
-        List<Locale> locales = new ArrayList<Locale>();
-
-        locales.add( DHIS_STANDARD_LOCALE );
-
-        if ( locale != null )
-        {
-            if ( !locale.equals( DHIS_STANDARD_LOCALE ) )
-            {
-                locales.add( locale );
-            }
-        }
-
-        return locales;
-    }
-
-    public Locale getFallbackLocale()
-    {
-        return DHIS_STANDARD_LOCALE;
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm	2012-01-19 14:20:31 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm	2012-01-22 09:58:04 +0000
@@ -22,7 +22,7 @@
         <select id="loc" name="loc" onchange="getTranslation()" style="min-width:20em">
             <option value="NONE">$i18n.getString( "translation_select_locale" )</option>
 			#foreach ( $loc in $availableLocales )
-				<option value="$loc" #if( $locale == $loc ) selected="selected" #end>$!loc.displayName</option>
+				<option value="$loc" #if( $currentLocale && $loc == $currentLocale ) selected="selected" #end>$!loc.displayName</option>
 			#end
 		</select>
     </td>

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/I18nAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/I18nAction.java	2012-01-20 10:00:50 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/I18nAction.java	2012-01-22 09:58:04 +0000
@@ -36,7 +36,6 @@
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.i18n.I18nService;
-import org.hisp.dhis.i18n.locale.LocaleManager;
 
 import com.opensymphony.xwork2.Action;
 
@@ -57,6 +56,8 @@
 
     private String message;
 
+    private Locale currentLocale;
+    
     private List<Locale> availableLocales = new ArrayList<Locale>();
     
     private Map<String, String> translations = new Hashtable<String, String>();
@@ -75,13 +76,6 @@
     {
         this.i18nService = i18nService;
     }
-
-    private LocaleManager localeManager;
-
-    public void setLocaleManager( LocaleManager localeManager )
-    {
-        this.localeManager = localeManager;
-    }
     
     private IdentifiableObjectManager identifiableObjectManager;
 
@@ -138,6 +132,11 @@
         return message;
     }
 
+    public Locale getCurrentLocale()
+    {
+        return currentLocale;
+    }
+
     public List<Locale> getAvailableLocales()
     {
         return availableLocales;
@@ -165,9 +164,11 @@
     public String execute()
         throws Exception
     {
+        currentLocale = i18nService.getCurrentLocale();
+        
         availableLocales = i18nService.getAvailableLocales();
         
-        translations = i18nService.getTranslations( className, objectId, localeManager.getCurrentLocale() );
+        translations = i18nService.getTranslations( className, objectId );
 
         IdentifiableObject object = identifiableObjectManager.getObject( objectId, className );
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2012-01-22 05:29:27 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2012-01-22 09:58:04 +0000
@@ -281,30 +281,17 @@
   <!-- i18n -->
 
   <bean id="org.hisp.dhis.i18n.action.I18nAction" class="org.hisp.dhis.i18n.action.I18nAction" scope="prototype">
-    <property name="i18nService">
-      <ref bean="org.hisp.dhis.i18n.I18nService" />
-    </property>
-    <property name="localeManager">
-      <ref bean="org.hisp.dhis.i18n.locale.LocaleManagerDb" />
-    </property>
-	<property name="identifiableObjectManager">
-	  <ref bean="org.hisp.dhis.common.IdentifiableObjectManager" />
-	</property>
+    <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
+	<property name="identifiableObjectManager" ref="org.hisp.dhis.common.IdentifiableObjectManager" />
   </bean>
 
   <bean id="org.hisp.dhis.i18n.action.GetTranslationsAction" class="org.hisp.dhis.i18n.action.GetTranslationsAction">
-    <property name="i18nService">
-      <ref bean="org.hisp.dhis.i18n.I18nService" />
-    </property>
+    <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
   </bean>
 
   <bean id="org.hisp.dhis.i18n.action.TranslateAction" class="org.hisp.dhis.i18n.action.TranslateAction">
-    <property name="i18nService">
-      <ref bean="org.hisp.dhis.i18n.I18nService" />
-    </property>
-	<property name="identifiableObjectManager">
-	  <ref bean="org.hisp.dhis.common.IdentifiableObjectManager" />
-	</property>
+    <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
+	<property name="identifiableObjectManager" ref="org.hisp.dhis.common.IdentifiableObjectManager" />
   </bean>
 
   <!-- About -->

=== 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	2012-01-22 05:29:27 +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-22 09:58:04 +0000
@@ -72,18 +72,11 @@
         this.i18nService = i18nService;
     }
 
-    private LocaleManager localeManagerDB;
-
-    public void setLocaleManagerDB( LocaleManager localeManagerDB )
-    {
-        this.localeManagerDB = localeManagerDB;
-    }
-
-    private LocaleManager localeManagerInterface;
-
-    public void setLocaleManagerInterface( LocaleManager localeManagerInterface )
-    {
-        this.localeManagerInterface = localeManagerInterface;
+    private LocaleManager localeManager;
+
+    public void setLocaleManager( LocaleManager localeManager )
+    {
+        this.localeManager = localeManager;
     }
 
     private UserSettingService userSettingService;
@@ -216,7 +209,7 @@
             }
         } );
 
-        currentLocale = localeManagerInterface.getCurrentLocale();
+        currentLocale = localeManager.getCurrentLocale();
 
         // ---------------------------------------------------------------------
         // Get available locales in db
@@ -224,11 +217,6 @@
 
         availableLocalesDb = new ArrayList<Locale>( i18nService.getAvailableLocales() );
 
-        if ( !availableLocalesDb.contains( localeManagerDB.getFallbackLocale() ) )
-        {
-            availableLocalesDb.add( localeManagerDB.getFallbackLocale() );
-        }
-
         Collections.sort( availableLocalesDb, new Comparator<Locale>()
         {
             public int compare( Locale locale0, Locale locale1 )
@@ -237,7 +225,7 @@
             }
         } );
 
-        currentLocaleDb = localeManagerDB.getCurrentLocale();
+        currentLocaleDb = i18nService.getCurrentLocale();
 
         // ---------------------------------------------------------------------
         // Get Charts in Dashboard

=== 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	2012-01-22 05:29:27 +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-22 09:58:04 +0000
@@ -29,6 +29,7 @@
 
 import static org.hisp.dhis.user.UserSettingService.AUTO_SAVE_DATA_ENTRY_FORM;
 import static org.hisp.dhis.user.UserSettingService.KEY_CHARTS_IN_DASHBOARD;
+import static org.hisp.dhis.user.UserSettingService.KEY_DB_LOCALE;
 
 import java.util.Locale;
 
@@ -50,18 +51,11 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private LocaleManager localeManagerInterface;
-
-    public void setLocaleManagerInterface( LocaleManager localeManagerInterface )
-    {
-        this.localeManagerInterface = localeManagerInterface;
-    }
-
-    private LocaleManager localeManagerDB;
-
-    public void setLocaleManagerDB( LocaleManager localeManagerDB )
-    {
-        this.localeManagerDB = localeManagerDB;
+    private LocaleManager localeManager;
+
+    public void setLocaleManager( LocaleManager localeManager )
+    {
+        this.localeManager = localeManager;
     }
 
     private StyleManager styleManager;
@@ -124,9 +118,9 @@
     public String execute()
         throws Exception
     {
-        localeManagerInterface.setCurrentLocale( getRespectiveLocale( currentLocale ) );
+        localeManager.setCurrentLocale( getRespectiveLocale( currentLocale ) );
 
-        localeManagerDB.setCurrentLocale( getRespectiveLocale( StringUtils.trimToNull( currentLocaleDb ) ) );
+        userSettingService.saveUserSetting( KEY_DB_LOCALE, getRespectiveLocale( StringUtils.trimToNull( currentLocaleDb ) ) );
 
         styleManager.setUserStyle( currentStyle );
 

=== 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	2012-01-22 05:29:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/META-INF/dhis/beans.xml	2012-01-22 09:58:04 +0000
@@ -3,7 +3,7 @@
   xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd";>
 
-	<!-- System settings -->
+  <!-- System settings -->
 
   <bean id="org.hisp.dhis.settings.action.system.GetGeneralSettingsAction" class="org.hisp.dhis.settings.action.system.GetGeneralSettingsAction"
     scope="prototype">
@@ -46,9 +46,7 @@
 	<property name="systemSettingManager" ref="org.hisp.dhis.options.SystemSettingManager" />
   </bean>
 
-	<!-- User settings -->
-	
-	<!-- General settings -->
+  <!-- User settings -->
 	
   <bean id="org.hisp.dhis.settings.action.user.GetGeneralSettingsAction" class="org.hisp.dhis.settings.action.user.GetGeneralSettingsAction"
     scope="prototype">
@@ -58,12 +56,9 @@
     <property name="i18nService">
       <ref bean="org.hisp.dhis.i18n.I18nService" />
     </property>
-    <property name="localeManagerInterface">
+    <property name="localeManager">
       <ref bean="org.hisp.dhis.i18n.locale.LocaleManager" />
     </property>
-    <property name="localeManagerDB">
-      <ref bean="org.hisp.dhis.i18n.locale.LocaleManagerDb" />
-    </property>
     <property name="userSettingService">
       <ref bean="org.hisp.dhis.user.UserSettingService" />
     </property>
@@ -74,12 +69,9 @@
 
   <bean id="org.hisp.dhis.settings.action.user.SetGeneralSettingsAction" class="org.hisp.dhis.settings.action.user.SetGeneralSettingsAction"
     scope="prototype">
-    <property name="localeManagerInterface">
+    <property name="localeManager">
       <ref bean="org.hisp.dhis.i18n.locale.LocaleManager" />
     </property>
-    <property name="localeManagerDB">
-      <ref bean="org.hisp.dhis.i18n.locale.LocaleManagerDb" />
-    </property>
     <property name="userSettingService">
       <ref bean="org.hisp.dhis.user.UserSettingService" />
     </property>
@@ -88,7 +80,6 @@
     </property>
   </bean>
   
-  <!-- Message settings -->
   <bean id="org.hisp.dhis.settings.action.user.GetMessageSettingsAction" class="org.hisp.dhis.settings.action.user.GetMessageSettingsAction"
     scope="prototype">
     <property name="userSettingService">