Mercurial > dive4elements > gnv-client
changeset 965:b7c6bf3cd7c9
Switching the language in the initial state is possible now (issue266).
gnv/trunk@1121 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 25 May 2010 07:41:31 +0000 |
parents | 3549253ecd7b |
children | 13de46229f63 |
files | gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java |
diffstat | 2 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv/ChangeLog Tue May 18 11:14:09 2010 +0000 +++ b/gnv/ChangeLog Tue May 25 07:41:31 2010 +0000 @@ -1,3 +1,11 @@ +2010-05-25 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + Issue266 + + * src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java: + Switching the language in the initial state will not throw an exception + anymore, but the language is toggled. + 2010-05-18 Tim Englich <tim.englich@intevation.de> * src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java (getValue),
--- a/gnv/src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java Tue May 18 11:14:09 2010 +0000 +++ b/gnv/src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java Tue May 25 07:41:31 2010 +0000 @@ -2,6 +2,7 @@ import de.intevation.gnv.action.sessionmodel.SessionModel; import de.intevation.gnv.action.sessionmodel.SessionModelFactory; +import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; import java.util.Locale; @@ -10,6 +11,7 @@ import org.apache.log4j.Logger; +import org.apache.struts.Globals; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; @@ -34,8 +36,15 @@ { SessionModelFactory factory = SessionModelFactory.getInstance(); SessionModel sm = factory.getSessionModel(request); + Locale locale = switchLanguage(sm.getCurrentLocale()); - sm.setCurrentLocale(switchLanguage(sm.getCurrentLocale())); + sm.setCurrentLocale(locale); + ArtifactObject artifactFactory = sm.getSelectedArtifactFactory(); + + if (artifactFactory == null) { + request.getSession().setAttribute(Globals.LOCALE_KEY, locale); + return mapping.findForward(SUCCSESS_FORWARD_ID); + } return super.execute(mapping, form, request, response); }