dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42055
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21483: Analytics, fixed bug related to data items translations
------------------------------------------------------------
revno: 21483
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-12-17 15:29:34 +0100
message:
Analytics, fixed bug related to data items translations
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.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-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2015-12-14 16:33:02 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2015-12-17 14:29:34 +0000
@@ -54,6 +54,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Future;
@@ -921,9 +922,9 @@
for ( DimensionalObject dimension : dimensions )
{
+ i18nItems( dimension );
+
List<DimensionalItemObject> items = new ArrayList<>( dimension.getItems() );
-
- i18nService.internationalise( items );
for ( DimensionalItemObject object : items )
{
@@ -990,6 +991,29 @@
return metaData;
}
+
+ /**
+ * Translate the items of the given dimensional object.
+ *
+ * @param dimension the dimensional object.
+ * @param items the dimensional items.
+ */
+ private void i18nItems( DimensionalObject dimension )
+ {
+ Locale locale = i18nService.getCurrentLocale();
+
+ if ( DimensionalObject.DATA_X_DIM_ID.equals( dimension.getDimension() ) )
+ {
+ for ( DimensionalItemObject item : dimension.getItems() )
+ {
+ i18nService.internationalise( item, locale );
+ }
+ }
+ else
+ {
+ i18nService.internationalise( dimension.getItems(), locale );
+ }
+ }
/**
* Gets the number of available cores. Uses explicit number from system