dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06950
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1955: Fix bug: Translation operation for dataset section.
------------------------------------------------------------
revno: 1955
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-08-23 17:23:35 +0700
message:
Fix bug: Translation operation for dataset section.
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultSectionService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sectionList.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/dataset/DefaultSectionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultSectionService.java 2010-06-23 12:06:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultSectionService.java 2010-08-23 10:23:35 +0000
@@ -23,8 +23,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.i18n.I18nUtils.i18n;
+
import java.util.Collection;
import org.hisp.dhis.dataset.Section;
+import org.hisp.dhis.i18n.I18nService;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -46,37 +49,52 @@
this.sectionStore = sectionStore;
}
+ private I18nService i18nService;
+
+ public void setI18nService( I18nService service )
+ {
+ i18nService = service;
+ }
+
// -------------------------------------------------------------------------
// SectionService implementation
// -------------------------------------------------------------------------
public int addSection( Section section )
{
- return sectionStore.addSection( section );
+ int id = sectionStore.addSection( section );
+
+ i18nService.addObject( section );
+
+ return id;
}
public void deleteSection( Section section )
{
+ i18nService.removeObject( section );
+
sectionStore.deleteSection( section );
}
public Collection<Section> getAllSections()
{
- return sectionStore.getAllSections();
+ return i18n( i18nService, sectionStore.getAllSections());
}
public Section getSection( int id )
{
- return sectionStore.getSection( id );
+ return i18n( i18nService, sectionStore.getSection( id ));
}
public Section getSectionByName( String name )
{
- return sectionStore.getSectionByName( name );
+ return i18n( i18nService, sectionStore.getSectionByName( name ));
}
public void updateSection( Section section )
{
sectionStore.updateSection( section );
+
+ i18nService.verify( section );
}
}
=== 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 2010-08-20 07:54:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-08-23 10:23:35 +0000
@@ -271,6 +271,8 @@
class="org.hisp.dhis.dataset.DefaultSectionService">
<property name="sectionStore"
ref="org.hisp.dhis.dataset.SectionStore"/>
+ <property name="i18nService"
+ ref="org.hisp.dhis.i18n.I18nService"/>
</bean>
<bean id="org.hisp.dhis.dataentryform.DataEntryFormService"
@@ -473,6 +475,7 @@
<ref bean="I18nReportExcelItem" />
<ref bean="I18nExcelItemGroup" />
<ref bean="I18nExcelItem" />
+ <ref bean="I18nSection" />
</list>
</property>
</bean>
@@ -1092,6 +1095,42 @@
</property>
</bean>
+ <bean id="I18nSection" class="org.hisp.dhis.i18n.I18nObject">
+ <property name="className" value="Section" />
+ <property name="propertyNames">
+ <list>
+ <value>name</value>
+ <value>title</value>
+ </list>
+ </property>
+
+ <property name="rulePropertyNames">
+ <map>
+ <entry key="name">
+ <map>
+ <entry key="unique" value="true" />
+ <entry key="required" value="true" />
+ <entry key="minlength" value="2" />
+ <entry key="maxlength" value="160" />
+ <entry key="regex" value="''" />
+ <entry key="message" value="" />
+ </map>
+ </entry>
+ <entry key="title">
+ <map>
+ <entry key="unique" value="true" />
+ <entry key="required" value="true" />
+ <entry key="minlength" value="2" />
+ <entry key="maxlength" value="160" />
+ <entry key="regex" value="''" />
+ <entry key="message" value="" />
+ </map>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+
<!-- Startup routine definitions -->
<bean id="org.hisp.dhis.startup.TableAlteror"
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2010-08-23 08:51:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2010-08-23 10:23:35 +0000
@@ -174,6 +174,7 @@
translation_label_description = Description
translation_label_comment = Comment
translation_label_region = Region
+translation_label_title = Title
translation_variant = Variant
translation_countrycode = Country code
translation_languagecode = Language code
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sectionList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sectionList.vm 2010-07-09 10:14:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sectionList.vm 2010-08-23 10:23:35 +0000
@@ -45,7 +45,8 @@
<tr id="tr${section.id}">
<td>$encoder.htmlEncode( $section.name )</td>
<td>$encoder.htmlEncode( $section.title )</td>
- <td style="text-align:center"><a href="javascript:removeSection( '$section.id', '$encoder.jsEncode( $section.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a></td>
+ <td style="text-align:center"><a href="javascript:translate( '$section.getClass().getSimpleName()', '$section.id' )" title="$i18n.getString( "translation_translate" )"><img src="../images/i18n.png" alt="$i18n.getString( "translation_translate" )"></a></td>
+ <td style="text-align:center"><a href="javascript:removeSection( '$section.id', '$encoder.jsEncode( $section.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a></td>
<td style="text-align:center"><a href="editSectionAction.action?sectionId=$section.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a></td>
<td style="text-align:center"><a href="greySection.action?sectionId=$section.id" title="$i18n.getString( "section_grey_field_managment" )"><img src="../images/edit_layout.png" alt="$i18n.getString( "section_grey_field_managment" )"></a></td>
<td style="text-align:center"><a href="javascript:showSectionDetails( $section.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a>