dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20742
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9626: Translation for Dynamic Attribute object
------------------------------------------------------------
revno: 9626
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-01-28 13:07:57 +0700
message:
Translation for Dynamic Attribute object
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/attribute.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/attribute/DefaultAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2013-01-14 21:35:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2013-01-28 06:07:57 +0000
@@ -23,7 +23,10 @@
package org.hisp.dhis.attribute;
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
import org.hisp.dhis.common.GenericStore;
+import org.hisp.dhis.i18n.I18nService;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashSet;
@@ -54,6 +57,13 @@
this.attributeValueStore = attributeValueStore;
}
+ private I18nService i18nService;
+
+ public void setI18nService( I18nService service )
+ {
+ i18nService = service;
+ }
+
// -------------------------------------------------------------------------
// Attribute implementation
// -------------------------------------------------------------------------
@@ -79,73 +89,73 @@
@Override
public Attribute getAttribute( int id )
{
- return attributeStore.get( id );
+ return i18n( i18nService, attributeStore.get( id ) );
}
@Override
public Attribute getAttribute( String uid )
{
- return attributeStore.getByUid( uid );
+ return i18n( i18nService, attributeStore.getByUid( uid ) );
}
@Override
public Attribute getAttributeByName( String name )
{
- return attributeStore.getByName( name );
+ return i18n( i18nService, attributeStore.getByName( name ) );
}
@Override
public Set<Attribute> getAllAttributes()
{
- return new HashSet<Attribute>( attributeStore.getAll() );
+ return new HashSet<Attribute>( i18n( i18nService, attributeStore.getAll() ) );
}
@Override
public Set<Attribute> getDataElementAttributes()
{
- return attributeStore.getDataElementAttributes();
+ return new HashSet<Attribute>( i18n( i18nService, attributeStore.getDataElementAttributes() ) );
}
@Override
public Set<Attribute> getDataElementGroupAttributes()
{
- return attributeStore.getDataElementGroupAttributes();
+ return new HashSet<Attribute>( i18n( i18nService,attributeStore.getDataElementGroupAttributes()));
}
@Override
public Set<Attribute> getIndicatorAttributes()
{
- return attributeStore.getIndicatorAttributes();
+ return new HashSet<Attribute>( i18n( i18nService,attributeStore.getIndicatorAttributes()));
}
@Override
public Set<Attribute> getIndicatorGroupAttributes()
{
- return attributeStore.getIndicatorGroupAttributes();
+ return new HashSet<Attribute>( i18n( i18nService,attributeStore.getIndicatorGroupAttributes()));
}
@Override
public Set<Attribute> getOrganisationUnitAttributes()
{
- return attributeStore.getOrganisationUnitAttributes();
+ return new HashSet<Attribute>( i18n( i18nService,attributeStore.getOrganisationUnitAttributes()));
}
@Override
public Set<Attribute> getOrganisationUnitGroupAttributes()
{
- return attributeStore.getOrganisationUnitGroupAttributes();
+ return new HashSet<Attribute>( i18n( i18nService,attributeStore.getOrganisationUnitGroupAttributes()));
}
@Override
public Set<Attribute> getUserAttributes()
{
- return attributeStore.getUserAttributes();
+ return new HashSet<Attribute>( i18n( i18nService,attributeStore.getUserAttributes()));
}
@Override
public Set<Attribute> getUserGroupAttributes()
{
- return attributeStore.getUserGroupAttributes();
+ return new HashSet<Attribute>( i18n( i18nService,attributeStore.getUserGroupAttributes()));
}
@Override
@@ -163,13 +173,13 @@
@Override
public Set<Attribute> getAttributesBetween( int first, int max )
{
- return new HashSet<Attribute>( attributeStore.getAllOrderedName( first, max ) );
+ return new HashSet<Attribute>( i18n( i18nService, attributeStore.getAllOrderedName( first, max ) ));
}
@Override
public Set<Attribute> getAttributesBetweenByName( String name, int first, int max )
{
- return new HashSet<Attribute>( attributeStore.getAllLikeNameOrderedName( name, first, max ) );
+ return new HashSet<Attribute>( i18n( i18nService, attributeStore.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-05 15:23:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-01-28 06:07:57 +0000
@@ -549,6 +549,7 @@
<bean id="org.hisp.dhis.attribute.AttributeService" class="org.hisp.dhis.attribute.DefaultAttributeService">
<property name="attributeStore" ref="org.hisp.dhis.attribute.AttributeStore" />
<property name="attributeValueStore" ref="org.hisp.dhis.attribute.AttributeValueStore" />
+ <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />
</bean>
<bean id="org.hisp.dhis.option.OptionService" class="org.hisp.dhis.option.DefaultOptionService">
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm 2013-01-18 15:54:53 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/macros.vm 2013-01-28 06:07:57 +0000
@@ -282,7 +282,7 @@
<div id="dynamicAttributesContainer" style="margin-bottom: 10px;">
<table>
#foreach( $attribute in $args.attributes )
- #set( $text = $attribute.name )
+ #set( $text = $attribute.displayName )
#set( $id = $attribute.id )
#set( $mandatory = $attribute.mandatory )
#if( $!args.attributeValues.get( $attribute.id ) )
=== 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 2012-10-18 13:27:17 +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:07:57 +0000
@@ -43,7 +43,7 @@
</table>
<table class="listTable" id="listTable">
<col/>
- <col width="96px"/>
+ <col width="120px"/>
<thead>
<tr>
<th>$i18n.getString( "name" )</th>
@@ -53,9 +53,10 @@
<tbody id="list">
#foreach( $attribute in $attributes )
<tr id="tr${attribute.id}">
- <td onclick="javascript:showAttributeDetails( $attribute.id )">$encoder.htmlEncode( $attribute.name )</td>
+ <td onclick="javascript:showAttributeDetails( $attribute.id )">$encoder.htmlEncode( $attribute.displayName )</td>
<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:showAttributeDetails( $attribute.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
</td>