dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10956
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3024: Fixed translation in data browser.
------------------------------------------------------------
revno: 3024
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-03-14 16:16:45 +0700
message:
Fixed translation in data browser.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/databrowser/DataBrowserGridService.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserGridService.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/util/DataBrowserUtils.java
dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java
dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserTest.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/ActionSupport.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserGrid.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserResult.vm
--
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/databrowser/DataBrowserGridService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/databrowser/DataBrowserGridService.java 2011-03-12 10:25:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/databrowser/DataBrowserGridService.java 2011-03-14 09:16:45 +0000
@@ -28,6 +28,7 @@
*/
import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.period.PeriodType;
@@ -166,7 +167,7 @@
* @return converted string if the date is valid, else the original string
* is returned
*/
- String convertDate( PeriodType periodType, String dateString, I18nFormat format );
+ String convertDate( PeriodType periodType, String dateString, I18n i18n, I18nFormat format );
/**
* This method returns the string of name of periods in the list which
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserGridService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserGridService.java 2011-03-12 10:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/DefaultDataBrowserGridService.java 2011-03-14 09:16:45 +0000
@@ -37,6 +37,7 @@
import java.util.List;
import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.i18n.I18nFormat;
import org.hisp.dhis.period.CalendarPeriodType;
import org.hisp.dhis.period.Period;
@@ -209,11 +210,11 @@
// Others
// -------------------------------------------------------------------------
- public String convertDate( PeriodType periodType, String dateString, I18nFormat format )
+ public String convertDate( PeriodType periodType, String dateString, I18n i18n, I18nFormat format )
{
if ( !DateUtils.dateIsValid( dateString ) )
{
- return dateString;
+ return i18n.getString( dateString );
}
SimpleDateFormat dateFormat = new SimpleDateFormat( Period.DEFAULT_DATE_FORMAT );
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/util/DataBrowserUtils.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/util/DataBrowserUtils.java 2011-03-12 10:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/util/DataBrowserUtils.java 2011-03-14 09:16:45 +0000
@@ -75,7 +75,7 @@
}
catch ( Exception e )
{
- throw new RuntimeException( "Oops. Somthing else went wrong in setMetaStructure()", e );
+ throw new RuntimeException( "Oops. Something else went wrong in setMetaStructure()", e );
}
finally
{
@@ -116,7 +116,7 @@
}
catch ( Exception e )
{
- throw new RuntimeException( "Oops. Somthing else went wrong in setHeaderStructure()", e );
+ throw new RuntimeException( "Oops. Something else went wrong in setHeaderStructure()", e );
}
}
@@ -144,7 +144,7 @@
}
catch ( Exception e )
{
- throw new RuntimeException( "Oops. Somthing else went wrong", e );
+ throw new RuntimeException( "Oops. Something else went wrong", e );
}
finally
{
@@ -217,7 +217,7 @@
}
catch ( IOException e )
{
- System.out.println( "Error while writing file : " + e );
+ throw new RuntimeException( "Error while writing file : " + e );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java'
--- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java 2011-03-12 10:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java 2011-03-14 09:16:45 +0000
@@ -467,11 +467,11 @@
assertEquals( "drilldown_data_element_group", grid.getVisibleHeaders().get( 0 ).getName() );
assertEquals( "drilldown_data_element_group", dataBrowserService.convertDate( periodA.getPeriodType(), grid
- .getVisibleHeaders().get( 0 ).getName(), mockFormat ) );
+ .getVisibleHeaders().get( 0 ).getName(), mockI18n, mockFormat ) );
assertTrue( "Period column header 2005-03-01", dataBrowserService.convertDate( periodA.getPeriodType(),
- grid.getVisibleHeaders().get( 1 ).getName(), mockFormat ).startsWith( "Period_2005-03-01" ) );
+ grid.getVisibleHeaders().get( 1 ).getName(), mockI18n, mockFormat ).startsWith( "Period_2005-03-01" ) );
assertTrue( "Period column header 2005-04-01", dataBrowserService.convertDate( periodA.getPeriodType(),
- grid.getVisibleHeaders().get( 2 ).getName(), mockFormat ).startsWith( "Period_2005-04-01" ) );
+ grid.getVisibleHeaders().get( 2 ).getName(), mockI18n, mockFormat ).startsWith( "Period_2005-04-01" ) );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserTest.java'
--- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserTest.java 2010-11-17 06:42:38 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserTest.java 2011-03-14 09:16:45 +0000
@@ -44,6 +44,7 @@
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.datavalue.DataValueService;
import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.mock.MockI18n;
import org.hisp.dhis.mock.MockI18nFormat;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
@@ -108,11 +109,15 @@
protected OrganisationUnitGroup unitGroupA;
protected OrganisationUnitGroup unitGroupB;
+ protected MockI18n mockI18n;
+
protected MockI18nFormat mockFormat;
public void setUpDataBrowserTest()
throws Exception
{
+ mockI18n = new MockI18n();
+
mockFormat = new MockI18nFormat();
categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/ActionSupport.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/ActionSupport.java 2011-03-12 10:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/ActionSupport.java 2011-03-14 09:16:45 +0000
@@ -421,7 +421,7 @@
for ( GridHeader col : grid.getVisibleHeaders() )
{
- col.setName( dataBrowserGridService.convertDate( periodType, col.getName(), format ) );
+ col.setName( dataBrowserGridService.convertDate( periodType, col.getName(), i18n, format ) );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserGrid.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserGrid.vm 2011-03-14 05:00:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserGrid.vm 2011-03-14 09:16:45 +0000
@@ -7,18 +7,12 @@
<thead>
<tr>
#foreach( $header in $grid.getVisibleHeaders() )
- <th #if( $header.meta )style="text-align:left"#else style="text-align:center"#end>$i18n.getString( $!encoder.htmlEncode( $header.name ) )</th>
+ <th #if( $header.meta )style="text-align:left"#else style="text-align:center"#end>$!encoder.htmlEncode( $header.name )</th>
#end
</tr>
</thead>
- <tbody>
- #if ( $summary )
- #set( $title = "$!item $i18n.getString( 'no_hits' )" )
- #else
- #set( $title = "$i18n.getString( 'raw_data' )" )
- #end
-
+ <tbody>
#foreach( $meta in $!MetaValues )
#set( $list = $!MetaValueMaps.get( $meta ) )
<tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserResult.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserResult.vm 2011-03-14 05:00:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserResult.vm 2011-03-14 09:16:45 +0000
@@ -19,13 +19,19 @@
<h6>$i18n.getString( "navigation" )</h6>
+#if ( $summary )
+#set( $title = "$!item $i18n.getString( 'no_hits' )" )
+#else
+#set( $title = "$i18n.getString( 'raw_data' )" )
+#end
+
<!-- ORGANISATIONUNIT -->
#if ( $mode == "OU" )
<div>
<a href="displayDataBrowserForm.action">$i18n.getString( "start" )</a>
#foreach( $parent in $BreadCrumbOrgUnit )
#if( $parent.name == $ParentName )
- » <span style="font-weight:bold;">$parent.name</span>
+ » <span style="font-weight:bold;">$ParentName</span> ( $title )
#else
» <a style="$tmpStyle" href="?mode=$mode&periodTypeId=$periodTypeId&fromDate=$fromDate&toDate=$toDate&showZeroCheckBox=$!showZeroCheckBox&selectedUnitChanger=$parent.id">$parent.name</a>
#end
@@ -39,7 +45,7 @@
<a href="displayDataBrowserForm.action">$i18n.getString( "start" )</a>
#if( $parent != "" )
» <a style="$tmpStyle" href="?mode=DEG&periodTypeId=$periodTypeId&fromDate=$fromDate&toDate=$toDate&showZeroCheckBox=$!showZeroCheckBox">$i18n.getString( "data_element_group_list" )</a>
- » <span style="font-weight:bold;">$ParentName</span>
+ » <span style="font-weight:bold;">$ParentName</span> ( $title )
#else
» <span style="font-weight:bold;">$i18n.getString( "data_element_group_list" )</span>
#end
@@ -53,7 +59,7 @@
<a href="displayDataBrowserForm.action">$i18n.getString( "start" )</a>
#if( $parent != "" )
» <a style="$tmpStyle" href="?mode=OUG&periodTypeId=$periodTypeId&fromDate=$fromDate&toDate=$toDate&showZeroCheckBox=$!showZeroCheckBox">$i18n.getString( "orgunit_group_list" )</a>
- » <span style="font-weight:bold;">$ParentName</span>
+ » <span style="font-weight:bold;">$ParentName</span> ( $title )
#else
» <span style="font-weight:bold;">$i18n.getString( "orgunit_group_list" )</span>
#end
@@ -67,7 +73,7 @@
<a href="displayDataBrowserForm.action">$i18n.getString( "start" )</a>
#if( $parent != "" )
» <a style="$tmpStyle" href="?mode=DS&periodTypeId=$periodTypeId&fromDate=$fromDate&toDate=$toDate&showZeroCheckBox=$!showZeroCheckBox">$i18n.getString( "data_set_list" )</a>
- » <span style="font-weight:bold;">$ParentName</span>
+ » <span style="font-weight:bold;">$ParentName</span> ( $title )
#else
» <span style="font-weight:bold;">$i18n.getString( "data_set_list" )</span>
#end