← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5764: Gave i18n methods more descriptive names

 

------------------------------------------------------------
revno: 5764
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-01-20 11:00:50 +0100
message:
  Gave i18n methods more descriptive names
modified:
  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/java/org/hisp/dhis/i18n/I18nUtils.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java
  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/TranslateAction.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-20 09:47:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java	2012-01-20 10:00:50 +0000
@@ -88,11 +88,11 @@
         }
         else
         {
-            internationalise( object, localeManager.getCurrentLocale() );
+            internationaliseObject( object, localeManager.getCurrentLocale() );
         }
     }
 
-    public void localise( Object object, Locale locale )
+    public void internationalise( Object object, Locale locale )
     {
         if ( isCollection( object ) )
         {
@@ -100,18 +100,18 @@
         }
         else
         {
-            internationalise( object, locale );
+            internationaliseObject( object, locale );
         }
     }
 
-    private void internationalise( Object object, Locale locale )
+    private void internationaliseObject( Object object, Locale locale )
     {
         if ( object == null || DHIS_STANDARD_LOCALE.equals( locale ) )
         {
             return;
         }        
         
-        List<String> properties = getTranslationProperties( object );
+        List<String> properties = getObjectPropertyNames( object );
         
         Collection<Translation> translations = translationService.getTranslations( getClassName( object ),
             getId( object ), locale );
@@ -138,7 +138,7 @@
         
         Object peek = objects.iterator().next();
 
-        List<String> properties = getTranslationProperties( peek );
+        List<String> properties = getObjectPropertyNames( peek );
         
         Collection<Translation> translations = translationService.getTranslations( getClassName( peek ), locale );
 
@@ -158,9 +158,9 @@
         }
     }
     
-    public Map<String, String> getObjectTranslations( Object object )
+    public Map<String, String> getObjectPropertyValues( Object object )
     {
-        List<String> properties = getTranslationProperties( object );
+        List<String> properties = getObjectPropertyNames( object );
         
         Map<String, String> translations = new HashMap<String, String>();
         
@@ -172,7 +172,7 @@
         return translations;
     }
 
-    public List<String> getTranslationProperties( Object object )
+    public List<String> getObjectPropertyNames( Object object )
     {
         if ( !( object instanceof IdentifiableObject ) )
         {

=== 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-19 11:43:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nService.java	2012-01-20 10:00:50 +0000
@@ -46,11 +46,11 @@
 
     public void internationalise( Object object );
     
-    public void localise( Object object, Locale locale );
-    
-    Map<String, String> getObjectTranslations( Object object );
-    
-    List<String> getTranslationProperties( Object object );
+    public void internationalise( Object object, Locale locale );
+    
+    Map<String, String> getObjectPropertyValues( Object object );
+    
+    List<String> getObjectPropertyNames( Object object );
     
     // -------------------------------------------------------------------------
     // Object

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/I18nUtils.java	2012-01-20 10:00:50 +0000
@@ -51,13 +51,13 @@
     
     public static <T> T i18n( I18nService i18nService, Locale locale, T object )
     {
-        i18nService.localise( object, locale );        
+        i18nService.internationalise( object, locale );        
         return object;
     }
     
     public static <T> Collection<T> i18n( I18nService i18nService, Locale locale, Collection<T> objects )
     {
-        i18nService.localise( objects, locale );        
+        i18nService.internationalise( objects, locale );        
         return objects;
     }
 }

=== 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 09:47:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java	2012-01-20 10:00:50 +0000
@@ -122,7 +122,7 @@
         assertEquals( "DataElementShortA", dataElementA.getDisplayShortName() );
         assertEquals( "DataElementDescriptionA", dataElementA.getDisplayDescription() );
         
-        i18nService.localise( dataElementA, locale );
+        i18nService.internationalise( dataElementA, locale );
         
         assertEquals( "frenchNameA", dataElementA.getDisplayName() );
         assertEquals( "frenchShortNameA", dataElementA.getDisplayShortName() );
@@ -168,7 +168,7 @@
         i18nService.updateTranslation( className, idB, locale, translationsB );
         i18nService.updateTranslation( className, idC, locale, translationsC );
         
-        i18nService.localise( elements, locale );
+        i18nService.internationalise( elements, locale );
         
         Iterator<DataElement> elementIter = elements.iterator();
         
@@ -182,7 +182,7 @@
     {
         DataElement dataElementA = createDataElement( 'A' );
         
-        Map<String, String> values = i18nService.getObjectTranslations( dataElementA );
+        Map<String, String> values = i18nService.getObjectPropertyValues( dataElementA );
         
         assertNotNull( values );
         assertEquals( 3, values.size() );

=== 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-19 11:43:06 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/I18nAction.java	2012-01-20 10:00:50 +0000
@@ -171,9 +171,9 @@
 
         IdentifiableObject object = identifiableObjectManager.getObject( objectId, className );
 
-        referenceTranslations = i18nService.getObjectTranslations( object );
+        referenceTranslations = i18nService.getObjectPropertyValues( object );
 
-        propertyNames = i18nService.getTranslationProperties( object );
+        propertyNames = i18nService.getObjectPropertyNames( object );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/TranslateAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/TranslateAction.java	2012-01-19 11:43:06 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/TranslateAction.java	2012-01-20 10:00:50 +0000
@@ -145,7 +145,7 @@
 
         IdentifiableObject object = identifiableObjectManager.getObject( Integer.parseInt( objectId ), className );
 
-        List<String> propertyNames = i18nService.getTranslationProperties( object );
+        List<String> propertyNames = i18nService.getObjectPropertyNames( object );
         
         Locale thisLocale = LocaleUtils.getLocale( loc );