← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5044: (mobile) added i18n for type validation messages

 

------------------------------------------------------------
revno: 5044
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-10-26 14:07:23 +0200
message:
  (mobile) added i18n for type validation messages
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties


--
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-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java	2011-10-26 11:58:19 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/SaveSectionFormAction.java	2011-10-26 12:07:23 +0000
@@ -47,6 +47,7 @@
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.datavalue.DeflatedDataValue;
+import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.light.dataentry.utils.SectionFormUtils;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -136,6 +137,13 @@
         return sectionFormUtils;
     }
 
+    private I18n i18n;
+
+    public void setI18n( I18n i18n )
+    {
+        this.i18n = i18n;
+    }
+
     // -------------------------------------------------------------------------
     // Input & Output
     // -------------------------------------------------------------------------
@@ -295,7 +303,7 @@
                         if ( !valueIsEmpty && !SectionFormUtils.isBoolean( value ) )
                         {
                             correctType = false;
-                            typeViolations.put( key, "Invalid boolean" );
+                            typeViolations.put( key, i18n.getString( "invalid_boolean" ) );
                         }
                     }
                     else if ( type.equals( DataElement.VALUE_TYPE_DATE ) )
@@ -303,7 +311,7 @@
                         if ( !SectionFormUtils.isDate( value ) )
                         {
                             correctType = false;
-                            typeViolations.put( key, "Invalid date (YYYY-MM-DD)" );
+                            typeViolations.put( key, i18n.getString( "invalid_date" ) );
                         }
                     }
                     else if ( type.equals( DataElement.VALUE_TYPE_INT )
@@ -312,7 +320,7 @@
                         if ( !SectionFormUtils.isNumber( value ) )
                         {
                             correctType = false;
-                            typeViolations.put( key, "Invalid number" );
+                            typeViolations.put( key, i18n.getString( "invalid_number" ) );
                         }
                     }
                     else if ( type.equals( DataElement.VALUE_TYPE_INT )
@@ -321,7 +329,7 @@
                         if ( !SectionFormUtils.isInteger( value ) )
                         {
                             correctType = false;
-                            typeViolations.put( key, "Invalid integer" );
+                            typeViolations.put( key, i18n.getString( "invalid_integer" ) );
                         }
                     }
                     else if ( type.equals( DataElement.VALUE_TYPE_INT )
@@ -330,7 +338,7 @@
                         if ( !SectionFormUtils.isPositiveInteger( value ) )
                         {
                             correctType = false;
-                            typeViolations.put( key, "Invalid positive integer" );
+                            typeViolations.put( key, i18n.getString( "invalid_positive_integer" ) );
                         }
                     }
                     else if ( type.equals( DataElement.VALUE_TYPE_INT )
@@ -339,7 +347,7 @@
                         if ( !SectionFormUtils.isNegativeInteger( value ) )
                         {
                             correctType = false;
-                            typeViolations.put( key, "Invalid negative integer" );
+                            typeViolations.put( key, i18n.getString( "invalid_negative_integer" ) );
                         }
                     }
                 }

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties	2011-10-14 12:46:59 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/resources/org/hisp/dhis/light/i18n_module.properties	2011-10-26 12:07:23 +0000
@@ -23,3 +23,11 @@
 settings = Settings
 language = Interface Language
 db_language = Database Language
+
+# validation messages
+invalid_boolean = Invalid boolean
+invalid_date = Invalid date (yyyy-MM-dd)
+invalid_number = Invalid boolean
+invalid_integer = Invalid integer
+invalid_positive_integer = Invalid positive integer
+invalid_negative_integer = Invalid negative integer