=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/I18nInterceptor.java' --- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/I18nInterceptor.java 2009-08-20 08:17:49 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/I18nInterceptor.java 2010-01-12 08:46:46 +0000 @@ -28,6 +28,7 @@ */ import java.util.HashMap; +import java.util.Locale; import java.util.Map; import ognl.NoSuchPropertyException; @@ -36,6 +37,7 @@ import org.hisp.dhis.i18n.I18n; import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.i18n.I18nManager; +import org.hisp.dhis.i18n.locale.LocaleManager; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionInvocation; @@ -49,8 +51,8 @@ implements Interceptor { private static final String KEY_I18N = "i18n"; - private static final String KEY_I18N_FORMAT = "format"; + private static final String KEY_LOCALE = "locale"; // ------------------------------------------------------------------------- // Dependencies @@ -62,6 +64,13 @@ { i18nManager = manager; } + + private LocaleManager localeManager; + + public void setLocaleManager( LocaleManager localeManager ) + { + this.localeManager = localeManager; + } // ------------------------------------------------------------------------- // AroundInterceptor implementation @@ -86,14 +95,16 @@ I18n i18n = i18nManager.getI18n( action.getClass() ); I18nFormat i18nFormat = i18nManager.getI18nFormat(); + Locale locale = localeManager.getCurrentLocale(); // --------------------------------------------------------------------- // Make the objects available for web templates // --------------------------------------------------------------------- - Map i18nMap = new HashMap( 2 ); + Map i18nMap = new HashMap( 3 ); i18nMap.put( KEY_I18N, i18n ); i18nMap.put( KEY_I18N_FORMAT, i18nFormat ); + i18nMap.put( KEY_LOCALE, locale ); invocation.getStack().push( i18nMap ); @@ -118,6 +129,14 @@ catch ( NoSuchPropertyException e ) { } + + try + { + Ognl.setValue( KEY_LOCALE, contextMap, action, locale ); + } + catch ( NoSuchPropertyException e ) + { + } return invocation.invoke(); } === 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 2009-12-09 09:34:39 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2010-01-12 08:46:46 +0000 @@ -590,6 +590,7 @@ +