dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20745
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9629: Translation for Category and CategoryCombo objects.
------------------------------------------------------------
revno: 9629
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-01-28 13:47:36 +0700
message:
Translation for Category and CategoryCombo objects.
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryCombo.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryComboForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2013-01-14 21:35:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2013-01-28 06:47:36 +0000
@@ -27,10 +27,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
import org.apache.commons.collections.CollectionUtils;
import org.hisp.dhis.common.GenericDimensionalObjectStore;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.concept.Concept;
+import org.hisp.dhis.i18n.I18nService;
import org.hisp.dhis.system.util.Filter;
import org.hisp.dhis.system.util.FilterUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -51,8 +54,7 @@
private GenericDimensionalObjectStore<DataElementCategory> dataElementCategoryStore;
- public void setDataElementCategoryStore(
- GenericDimensionalObjectStore<DataElementCategory> dataElementCategoryStore )
+ public void setDataElementCategoryStore( GenericDimensionalObjectStore<DataElementCategory> dataElementCategoryStore )
{
this.dataElementCategoryStore = dataElementCategoryStore;
}
@@ -88,6 +90,13 @@
this.dataElementService = dataElementService;
}
+ private I18nService i18nService;
+
+ public void setI18nService( I18nService service )
+ {
+ i18nService = service;
+ }
+
// -------------------------------------------------------------------------
// Category
// -------------------------------------------------------------------------
@@ -109,17 +118,17 @@
public Collection<DataElementCategory> getAllDataElementCategories()
{
- return dataElementCategoryStore.getAll();
+ return i18n( i18nService, dataElementCategoryStore.getAll());
}
public DataElementCategory getDataElementCategory( int id )
{
- return dataElementCategoryStore.get( id );
+ return i18n( i18nService, dataElementCategoryStore.get( id ));
}
public DataElementCategory getDataElementCategory( String uid )
{
- return dataElementCategoryStore.getByUid( uid );
+ return i18n( i18nService, dataElementCategoryStore.getByUid( uid ));
}
public Collection<DataElementCategory> getDataElementCategories( final Collection<Integer> identifiers )
@@ -137,7 +146,7 @@
public DataElementCategory getDataElementCategoryByName( String name )
{
- return dataElementCategoryStore.getByName( name );
+ return i18n( i18nService, dataElementCategoryStore.getByName( name ));
}
// -------------------------------------------------------------------------
@@ -214,17 +223,17 @@
public Collection<DataElementCategoryCombo> getAllDataElementCategoryCombos()
{
- return dataElementCategoryComboStore.getAll();
+ return i18n( i18nService, dataElementCategoryComboStore.getAll());
}
public DataElementCategoryCombo getDataElementCategoryCombo( int id )
{
- return dataElementCategoryComboStore.get( id );
+ return i18n( i18nService, dataElementCategoryComboStore.get( id ));
}
public DataElementCategoryCombo getDataElementCategoryCombo( String uid )
{
- return dataElementCategoryComboStore.getByUid( uid );
+ return i18n( i18nService, dataElementCategoryComboStore.getByUid( uid ));
}
public Collection<DataElementCategoryCombo> getDataElementCategoryCombos( final Collection<Integer> identifiers )
@@ -243,7 +252,7 @@
public DataElementCategoryCombo getDataElementCategoryComboByName( String name )
{
- return dataElementCategoryComboStore.getByName( name );
+ return i18n( i18nService, dataElementCategoryComboStore.getByName( name ));
}
// -------------------------------------------------------------------------
@@ -356,7 +365,8 @@
// DataElementCategoryCombo
// ---------------------------------------------------------------------
- DataElementCategoryCombo categoryCombo = new DataElementCategoryCombo( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
+ DataElementCategoryCombo categoryCombo = new DataElementCategoryCombo(
+ DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
List<DataElementCategory> categories = new ArrayList<DataElementCategory>();
categories.add( category );
@@ -397,7 +407,8 @@
for ( DataElementOperand operand : operands )
{
DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
- DataElementCategoryOptionCombo categoryOptionCombo = getDataElementCategoryOptionCombo( operand.getOptionComboId() );
+ DataElementCategoryOptionCombo categoryOptionCombo = getDataElementCategoryOptionCombo( operand
+ .getOptionComboId() );
operand.updateProperties( dataElement, categoryOptionCombo );
}
@@ -419,7 +430,8 @@
operands.add( operand );
}
- for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo().getSortedOptionCombos() )
+ for ( DataElementCategoryOptionCombo categoryOptionCombo : dataElement.getCategoryCombo()
+ .getSortedOptionCombos() )
{
DataElementOperand operand = new DataElementOperand();
operand.updateProperties( dataElement, categoryOptionCombo );
@@ -501,19 +513,19 @@
updateDataElementCategoryCombo( categoryCombo );
}
-
+
public Map<String, Integer> getDataElementCategoryOptionComboUidIdMap()
{
Map<String, Integer> map = new HashMap<String, Integer>();
-
+
for ( DataElementCategoryOptionCombo coc : getAllDataElementCategoryOptionCombos() )
{
map.put( coc.getUid(), coc.getId() );
}
-
+
return map;
}
-
+
public int getDataElementCategoryCount()
{
return dataElementCategoryStore.getCount();
@@ -550,12 +562,12 @@
public Collection<DataElementCategory> getDataElementCategorysBetween( int first, int max )
{
- return dataElementCategoryStore.getAllOrderedName( first, max );
+ return i18n( i18nService, dataElementCategoryStore.getAllOrderedName( first, max ));
}
public Collection<DataElementCategory> getDataElementCategorysBetweenByName( String name, int first, int max )
{
- return dataElementCategoryStore.getAllLikeNameOrderedName( name, first, max );
+ return i18n( i18nService, dataElementCategoryStore.getAllLikeNameOrderedName( name, first, max ));
}
public int getDataElementCategoryComboCount()
@@ -570,13 +582,13 @@
public Collection<DataElementCategoryCombo> getDataElementCategoryCombosBetween( int first, int max )
{
- return dataElementCategoryComboStore.getAllOrderedName( first, max );
+ return i18n( i18nService, dataElementCategoryComboStore.getAllOrderedName( first, max ));
}
public Collection<DataElementCategoryCombo> getDataElementCategoryCombosBetweenByName( String name, int first,
- int max )
+ int max )
{
- return dataElementCategoryComboStore.getAllLikeNameOrderedName( name, first, max );
+ return i18n( i18nService, dataElementCategoryComboStore.getAllLikeNameOrderedName( name, first, max ) );
}
@Override
@@ -588,19 +600,19 @@
@Override
public Collection<DataElementCategory> getDataElementCategorysByConcept( Concept concept )
{
- return dataElementCategoryStore.getByConcept( concept );
+ return i18n( i18nService, dataElementCategoryStore.getByConcept( concept ));
}
@Override
public Collection<DataElementCategory> getDataElementCategoryBetween( int first, int max )
{
- return dataElementCategoryStore.getAllOrderedName( first, max );
+ return i18n( i18nService, dataElementCategoryStore.getAllOrderedName( first, max ));
}
@Override
public Collection<DataElementCategory> getDataElementCategoryBetweenByName( String name, int first, int max )
{
- return dataElementCategoryStore.getAllLikeNameOrderedName( name, first, max );
+ return i18n( i18nService, dataElementCategoryStore.getAllLikeNameOrderedName( name, first, max ));
}
@Override
@@ -610,7 +622,8 @@
}
@Override
- public Collection<DataElementCategoryOption> getDataElementCategoryOptionsBetweenByName( String name, int first, int max )
+ public Collection<DataElementCategoryOption> getDataElementCategoryOptionsBetweenByName( String name, int first,
+ int max )
{
return dataElementCategoryOptionStore.getAllLikeNameOrderedName( name, first, max );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-01-28 06:30:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-01-28 06:47:36 +0000
@@ -423,6 +423,7 @@
<property name="dataElementCategoryComboStore" ref="org.hisp.dhis.dataelement.DataElementCategoryComboStore" />
<property name="dataElementCategoryOptionComboStore" ref="org.hisp.dhis.dataelement.DataElementCategoryOptionComboStore" />
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
</bean>
<bean id="org.hisp.dhis.organisationunit.OrganisationUnitService" class="org.hisp.dhis.organisationunit.DefaultOrganisationUnitService">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm 2013-01-28 06:07:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.vm 2013-01-28 06:47:36 +0000
@@ -57,7 +57,7 @@
<td style="text-align:right">
<a href="showUpdateAttributeForm.action?id=$attribute.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
<a href="javascript:translate( 'Attribute', '$attribute.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
- <a href="javascript:removeAttribute( $attribute.id, '$encoder.jsEncode( $attribute.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ <a href="javascript:removeAttribute( $attribute.id, '$encoder.jsEncode( $attribute.displayName )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
<a href="javascript:showAttributeDetails( $attribute.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2013-01-28 06:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2013-01-28 06:47:36 +0000
@@ -124,7 +124,7 @@
<td>
<select id="selectedCategoryComboId">
#foreach( $dataElementCategoryCombo in $dataElementCategoryCombos )
- <option value="$dataElementCategoryCombo.id" #if( $dataElementCategoryCombo.id == $defaultCategoryCombo.id ) selected="selected" #end>$encoder.htmlEncode( $dataElementCategoryCombo.name )</option>
+ <option value="$dataElementCategoryCombo.id" #if( $dataElementCategoryCombo.id == $defaultCategoryCombo.id ) selected="selected" #end>$encoder.htmlEncode( $dataElementCategoryCombo.displayName )</option>
#end
</select>
<input type="hidden" id="submitCategoryComboId" name="selectedCategoryComboId"/>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm 2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/category.vm 2013-01-28 06:47:36 +0000
@@ -47,10 +47,11 @@
#foreach( $dataElementCategory in $dataElementCategories )
#if( $dataElementCategory.id != $defaultCategory.id )
<tr id="tr${dataElementCategory.id}">
- <td onclick="showDataElementCategoryDetails( $dataElementCategory.id )">$encoder.htmlEncode( $dataElementCategory.name )</td>
+ <td onclick="showDataElementCategoryDetails( $dataElementCategory.id )">$encoder.htmlEncode( $dataElementCategory.displayName )</td>
<td style="text-align:right">
<a href="showUpdateDataElementCategoryForm.action?id=$dataElementCategory.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
- <a href="javascript:removeDataElementCategory( '$dataElementCategory.id', '$encoder.jsEncode( $dataElementCategory.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ <a href="javascript:translate( 'DataElementCategory', '$dataElementCategory.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+ <a href="javascript:removeDataElementCategory( '$dataElementCategory.id', '$encoder.jsEncode( $dataElementCategory.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
<a href="javascript:showDataElementCategoryDetails( $dataElementCategory.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryCombo.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryCombo.vm 2012-10-18 13:27:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/categoryCombo.vm 2013-01-28 06:47:36 +0000
@@ -30,10 +30,11 @@
#foreach( $dataElementCategoryCombo in $dataElementCategoryCombos )
#if( $dataElementCategoryCombo.id != $defaultCombo.id )
<tr id="tr${dataElementCategoryCombo.id}">
- <td onclick="showDataElementCategoryComboDetails( $dataElementCategoryCombo.id )">$encoder.htmlEncode( $dataElementCategoryCombo.name )</td>
+ <td onclick="showDataElementCategoryComboDetails( $dataElementCategoryCombo.id )">$encoder.htmlEncode( $dataElementCategoryCombo.displayName )</td>
<td style="text-align:right">
<a href="showUpdateDataElementCategoryComboForm.action?id=$dataElementCategoryCombo.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
- <a href="javascript:removeDataElementCategoryCombo( '$dataElementCategoryCombo.id', '$encoder.jsEncode( $dataElementCategoryCombo.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ <a href="javascript:translate( 'DataElementCategoryCombo', '$dataElementCategoryCombo.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+ <a href="javascript:removeDataElementCategoryCombo( '$dataElementCategoryCombo.id', '$encoder.jsEncode( $dataElementCategoryCombo.displayName )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
<a href="javascript:showDataElementCategoryComboDetails( $dataElementCategoryCombo.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryComboForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryComboForm.vm 2012-11-07 14:39:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/multidimensional/updateDataElementCategoryComboForm.vm 2013-01-28 06:47:36 +0000
@@ -42,7 +42,7 @@
<tbody>
<tr>
<td style="width:120px"><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" style="width:20em" value="$encoder.htmlEncode( $dataElementCategoryCombo.name )"/></td>
+ <td><input type="text" id="name" name="name" style="width:20em" value="$encoder.htmlEncode( $dataElementCategoryCombo.displayName )"/></td>
</tr>
<tr>
<td><label>$i18n.getString( "skip_total_in_reports" )</label></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2013-01-28 06:30:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2013-01-28 06:47:36 +0000
@@ -143,7 +143,7 @@
<td>
<select id="selectedCategoryComboId" #if( $dataElement.getDomainTypeNullSafe()=='patient') disabled #end>>
#foreach( $dataElementCategoryCombo in $dataElementCategoryCombos )
- <option value="$dataElementCategoryCombo.id" #if( $dataElementCategoryCombo.id == $dataElement.categoryCombo.id ) selected="selected" #end>$encoder.htmlEncode( $dataElementCategoryCombo.name )</option>
+ <option value="$dataElementCategoryCombo.id" #if( $dataElementCategoryCombo.id == $dataElement.categoryCombo.id ) selected="selected" #end>$encoder.htmlEncode( $dataElementCategoryCombo.displayName )</option>
#end
</select>
<input type="hidden" id="submitCategoryComboId" name="selectedCategoryComboId"/>