← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11373: changed to using 1.6 compatible Locale constructor

 

------------------------------------------------------------
revno: 11373
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-07-09 15:57:48 +0700
message:
  changed to using 1.6 compatible Locale constructor
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/locale/LocaleManager.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.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-api/src/main/java/org/hisp/dhis/i18n/locale/LocaleManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/locale/LocaleManager.java	2013-07-02 15:58:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/locale/LocaleManager.java	2013-07-09 08:57:48 +0000
@@ -37,8 +37,8 @@
 public interface LocaleManager
 {
     final String ID = LocaleManager.class.getName();
-    
-    final Locale DHIS_STANDARD_LOCALE = new Locale.Builder().setLanguage( "en" ).build();
+
+    final Locale DHIS_STANDARD_LOCALE = new Locale( "en" );
 
     Locale getCurrentLocale();
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java	2013-07-02 18:21:13 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetStringsFromLocaleAction.java	2013-07-09 08:57:48 +0000
@@ -27,14 +27,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Locale;
-import java.util.Locale.Builder;
-
+import com.opensymphony.xwork2.Action;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nManager;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.Locale;
 
 /**
  * @author Lars Helge Overland
@@ -44,9 +42,9 @@
 {
     @Autowired
     private I18nManager manager;
-    
+
     private String language;
-    
+
     public void setLanguage( String language )
     {
         this.language = language;
@@ -73,22 +71,26 @@
     public String execute()
         throws Exception
     {
-        Builder builder = new Locale.Builder();
-        
+        Locale locale;
+
         if ( language != null )
         {
-            builder.setLanguage( language );
+            if ( country != null )
+            {
+                locale = new Locale( language, country );
+            }
+            else
+            {
+                locale = new Locale( language );
+            }
         }
-        
-        if ( country != null )
+        else
         {
-            builder.setRegion( country );
+            locale = null;
         }
-        
-        Locale locale = builder.build();
-        
+
         i18nObject = manager.getI18n( this.getClass(), locale );
-        
+
         return SUCCESS;
     }
 }