=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/TranslateSystemSettingManager.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/TranslateSystemSettingManager.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/TranslateSystemSettingManager.java 2013-10-10 12:00:38 +0000 @@ -0,0 +1,40 @@ +package org.hisp.dhis.setting; + +/* + * Copyright (c) 2004-2013, 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 HISP project 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.Map; + +/** + * @author James Chang + */ + +public interface TranslateSystemSettingManager +{ + Map getTranslation_SystemAppearanceSetting( String localeStr ); +} === added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/setting/DefaultTranslateSystemSettingManager.java 2013-10-10 12:00:38 +0000 @@ -0,0 +1,98 @@ +package org.hisp.dhis.setting; + +/* + * Copyright (c) 2004-2013, 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 HISP project 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 static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_APPLICATION_TITLE; +import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_FOOTER; +import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_INTRO; +import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_NOTIFICATION; +import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_TITLE; + +import java.util.Hashtable; +import java.util.Map; + +/** + * @author James Chang + */ + +public class DefaultTranslateSystemSettingManager + implements TranslateSystemSettingManager +{ + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private SystemSettingManager systemSettingManager; + + public void setSystemSettingManager( SystemSettingManager systemSettingManager ) + { + this.systemSettingManager = systemSettingManager; + } + + // ------------------------------------------------------------------------- + // Method implementation + // ------------------------------------------------------------------------- + + @Override + public Map getTranslation_SystemAppearanceSetting( String localeStr ) + { + Map translations = new Hashtable(); + + // Add the key application data (with localeCode name) into translations map object + translations.put( KEY_APPLICATION_TITLE, getSystemSettingWithFallbacks( KEY_APPLICATION_TITLE, localeStr, DEFAULT_APPLICATION_TITLE ) ); + translations.put( KEY_APPLICATION_INTRO, getSystemSettingWithFallbacks( KEY_APPLICATION_INTRO, localeStr, "" ) ); + translations.put( KEY_APPLICATION_NOTIFICATION, getSystemSettingWithFallbacks( KEY_APPLICATION_NOTIFICATION, localeStr, "" ) ); + translations.put( KEY_APPLICATION_FOOTER, getSystemSettingWithFallbacks( KEY_APPLICATION_FOOTER, localeStr, "" ) ); + + return translations; + } + + // ------------------------------------------------------------------------- + // Support Method implementation + // ------------------------------------------------------------------------- + private String getSystemSettingWithFallbacks( String keyName, String localeStr, String defaultValue ) + { + String settingValue = ""; + + String keyWithLocale = systemSettingManager.getSystemSetting( keyName + localeStr, "" ).toString(); + + if ( keyWithLocale.isEmpty() ) + { + settingValue = systemSettingManager.getSystemSetting( keyName, defaultValue ).toString(); + } + else + { + settingValue = keyWithLocale; + } + + return settingValue; + } + +} === 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-10-08 17:20:57 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-10-10 12:00:38 +0000 @@ -672,6 +672,10 @@ + + + + === modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/LocaleUtils.java' --- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/LocaleUtils.java 2013-10-08 17:16:47 +0000 +++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/LocaleUtils.java 2013-10-10 12:00:38 +0000 @@ -54,7 +54,14 @@ */ public static Locale getLocale( String localeStr ) { - return org.apache.commons.lang.LocaleUtils.toLocale( localeStr ); + if ( localeStr == null || localeStr.isEmpty() ) + { + return null; + } + else + { + return org.apache.commons.lang.LocaleUtils.toLocale( localeStr ); + } } /** === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js 2013-10-07 09:33:02 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.js 2013-10-10 12:00:38 +0000 @@ -44,5 +44,11 @@ $( '#loginMessage' ).html( json.wrong_username_or_password ); $( '#poweredByLabel' ).html( json.powered_by ); $( '#submit' ).val( json.login ); + + $( '#titleArea' ).html( json.applicationTitle ); + $( '#introArea' ).html( json.keyApplicationIntro ); + $( '#notificationArea' ).html( json.keyApplicationNotification ); + $( '#applicationFooter' ).html( json.keyApplicationFooter ); } ); -} \ No newline at end of file +} + === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm 2013-10-06 19:54:35 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm 2013-10-10 12:00:38 +0000 @@ -58,7 +58,7 @@
Powered by DHIS 2  - $!{keyApplicationFooter} + $!{keyApplicationFooter}