dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15695
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5754: WIP db i18n
------------------------------------------------------------
revno: 5754
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-01-19 13:47:18 +0100
message:
WIP db i18n
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetTranslationsAction.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-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js 2012-01-19 11:43:06 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/i18n.js 2012-01-19 12:47:18 +0000
@@ -2,34 +2,38 @@
{
clearFields();
- var loc = getFieldValue( 'loc' );
+ var loc = $( '#loc :selected' ).val();
- if ( loc != "heading" )
+ if ( loc != 'NONE' )
{
jQuery.postJSON( 'getTranslations.action', {
id: getFieldValue( 'objectId' ),
className: getFieldValue( 'className' ),
loc: loc
- }, function ( json ) {
-
+ },
+ function ( json )
+ {
var translations = json.translations;
for ( var i = 0; i < translations.length; i++ )
{
- var field = byId( translations[i].key );
-
- if ( field != null ) field.value = translations[i].value;
+ var fieldId = '#' + translations[i].key;
+
+ if ( $( fieldId ).length )
+ {
+ var fieldValue = translations[i].value;
+
+ $( fieldId ).val( fieldValue );
+ }
}
- });
+ } );
}
}
function clearFields( prefix )
{
- prefix = prefix ? prefix : '';
-
for ( var i = 0; i < propNames.length; i++ )
{
- byId( propNames[i] + prefix ).innerHTML = "";
+ $( '#' + propNames[i] ).val( '' );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetTranslationsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetTranslationsAction.java 2010-05-11 14:20:51 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/GetTranslationsAction.java 2012-01-19 12:47:18 +0000
@@ -38,13 +38,12 @@
/**
* @author Oyvind Brucker
*/
-@SuppressWarnings("serial")
public class GetTranslationsAction
extends ActionSupport
{
private String className;
- private String id;
+ private Integer id;
private String loc;
@@ -70,7 +69,7 @@
this.className = className;
}
- public void setId( String id )
+ public void setId( Integer id )
{
this.id = id;
}
@@ -94,7 +93,7 @@
{
Locale locale = LocaleUtils.getLocale( loc );
- translations = i18nService.getTranslations( className, Integer.parseInt( id ), locale );
+ translations = i18nService.getTranslations( className, id, locale );
return SUCCESS;
}