=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java 2012-01-19 13:00:51 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/i18n/DefaultI18nService.java 2012-01-19 14:20:31 +0000 @@ -86,18 +86,22 @@ { internationaliseCollection( (Collection) object ); } - - internationalise( object, localeManager.getCurrentLocale() ); + else + { + internationalise( object, localeManager.getCurrentLocale() ); + } } - public void localise( Object object, Locale locale ) //TODO remove/rename? + public void localise( Object object, Locale locale ) { if ( isCollection( object ) ) { internationaliseCollection( (Collection) object, locale ); } - - internationalise( object, locale ); + else + { + internationalise( object, locale ); + } } private void internationalise( Object object, Locale locale ) @@ -175,9 +179,9 @@ public List getTranslationProperties( Object object ) { - if ( object == null || !( object instanceof IdentifiableObject ) ) + if ( !( object instanceof IdentifiableObject ) ) { - throw new IllegalArgumentException( "I18n objects must be not null and identifiable" ); + throw new IllegalArgumentException( "I18n object must be identifiable: " + object ); } return ( object instanceof NameableObject ) ? Arrays.asList( NameableObject.I18N_PROPERTIES ) : Arrays.asList( IdentifiableObject.I18N_PROPERTIES ); === modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ReflectionUtilsTest.java' --- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ReflectionUtilsTest.java 2011-12-26 10:07:59 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/ReflectionUtilsTest.java 2012-01-19 14:20:31 +0000 @@ -38,6 +38,8 @@ import static org.hisp.dhis.system.util.ReflectionUtils.setProperty; import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; import java.util.List; import org.hisp.dhis.dataelement.DataElement; @@ -97,9 +99,13 @@ @Test public void testIsCollection() { - List list = new ArrayList(); + List colA = new ArrayList(); + Collection colB = new HashSet(); + Collection colC = new ArrayList(); - assertTrue( isCollection( list ) ); + assertTrue( isCollection( colA ) ); + assertTrue( isCollection( colB ) ); + assertTrue( isCollection( colC ) ); assertFalse( isCollection( dataElementA ) ); } } === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm 2012-01-19 11:43:06 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/i18n/translate.vm 2012-01-19 14:20:31 +0000 @@ -21,8 +21,8 @@ === removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/ValidateAddDuplicatedTranslationAction.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/ValidateAddDuplicatedTranslationAction.java 2012-01-19 11:43:06 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/i18n/action/ValidateAddDuplicatedTranslationAction.java 1970-01-01 00:00:00 +0000 @@ -1,214 +0,0 @@ -package org.hisp.dhis.i18n.action; - -/* - * Copyright (c) 2004-2005, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -import java.util.Locale; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.hisp.dhis.i18n.I18n; -import org.hisp.dhis.i18n.I18nService; -import org.hisp.dhis.system.util.LocaleUtils; -import org.hisp.dhis.translation.TranslationService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Dang Duy Hieu - * @version $Id$ - * @since 2010-03-30 - */ -public class ValidateAddDuplicatedTranslationAction - implements Action -{ - private static final Log log = LogFactory.getLog( ValidateAddDuplicatedTranslationAction.class ); - - private static final String PROPERTY_NAME = "name"; - - private static final String PROPERTY_SHORTNAME = "shortname"; - - private static final String WARNING_MESSAGE = "translation_duplicated_"; - - private String className; - - private String id; - - private String loc; - - private String name; - - private String shortName; - - private String message; - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private I18nService i18nService; - - public void setI18nService( I18nService service ) - { - i18nService = service; - } - - private TranslationService translationService; - - public void setTranslationService( TranslationService translationService ) - { - this.translationService = translationService; - } - - // ------------------------------------------------------------------------- - // I18n Object - // ------------------------------------------------------------------------- - - private I18n i18n; - - public void setI18n( I18n i18n ) - { - this.i18n = i18n; - } - - // ------------------------------------------------------------------------- - // Input - // ------------------------------------------------------------------------- - - public void setClassName( String className ) - { - this.className = className; - } - - public void setId( String id ) - { - this.id = id; - } - - public void setLoc( String locale ) - { - this.loc = locale; - } - - public void setName( String name ) - { - this.name = name; - } - - public void setShortName( String shortName ) - { - this.shortName = shortName; - } - - // ------------------------------------------------------------------------- - // Output - // ------------------------------------------------------------------------- - - public String getMessage() - { - return message; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - log.info( "Classname: " + className + ", id: " + id + ", loc: " + loc ); - log.info( "name: " + name + ", shortName: " + shortName ); - - Locale thisLocale = LocaleUtils.getLocale( loc ); - - if ( name == null && shortName == null ) - { - return SUCCESS; - } - - if ( name != null ) - { - name = name.trim(); - } - if ( shortName != null ) - { - shortName = shortName.trim(); - } - if ( (name.length() == 0) && (shortName.length() == 0) ) - { - return SUCCESS; - } - - // ------------------------------------------------------------- - // Checking duplicated name - // ------------------------------------------------------------- - - /* - List propertyNames = i18nService.getPropertyNames( className ); - - for ( String propertyName : propertyNames ) - { - if ( propertyName.equalsIgnoreCase( PROPERTY_NAME ) ) - { - Translation objMatch = translationService.getTranslation( className, thisLocale, propertyName, name, - Integer.parseInt( id ) ); - - if ( objMatch != null ) - { - message = i18n.getString( WARNING_MESSAGE + PROPERTY_NAME + "_with" ) - + "

[ " + className + " ] - [ " - + i18n.getString( "translation_label_id" ) + ":= " + objMatch.getId() + " ] - [ " - + i18n.getString( "translation_label_name" ) + ":= " + objMatch.getValue() - + " ]
"; - - return INPUT; - } - } - else if ( propertyName.equalsIgnoreCase( PROPERTY_SHORTNAME ) ) - { - Translation objMatch = translationService.getTranslation( className, thisLocale, propertyName, - shortName, Integer.parseInt( id ) ); - - if ( objMatch != null ) - { - message = i18n.getString( WARNING_MESSAGE + PROPERTY_SHORTNAME + "_with" ) - + "

[ " + className + " ] - [ " - + i18n.getString( "translation_label_id" ) + ":= " + objMatch.getId() + " ] - [ " - + i18n.getString( "translation_label_short_name" ) + ":= " + objMatch.getValue() - + " ]
"; - - return INPUT; - } - } - } -*/ - message = "OK"; - - return SUCCESS; - } - -} === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2012-01-19 11:43:06 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2012-01-19 14:20:31 +0000 @@ -307,15 +307,6 @@ - - - - - - - - - === modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml' --- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2011-10-03 09:50:20 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2012-01-19 14:20:31 +0000 @@ -297,14 +297,6 @@ - - - /dhis-web-commons/ajax/jsonResponseSuccess.vm - - /dhis-web-commons/ajax/jsonResponseInput.vm - plainTextError - - /dhis-web-commons/i18n/jsonTranslations.vm === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm 2011-09-26 09:31:56 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElement.vm 2012-01-19 14:20:31 +0000 @@ -66,11 +66,11 @@ #foreach( $dataElement in $dataElements ) - $encoder.htmlEncode( $dataElement.name ) + $encoder.htmlEncode( $dataElement.displayName ) $i18n.getString( 'edit' ) $i18n.getString( 'translation_translate' ) - $i18n.getString( 'remove' ) + $i18n.getString( 'remove' ) $i18n.getString( 'show_details' )