From a770f32c4cc4f96777ae7a3ee853238f9b5ec914 Mon Sep 17 00:00:00 2001 From: Lukasz Jader Date: Sun, 7 Apr 2013 16:51:38 +0200 Subject: [PATCH] Overwrite created session locale with forced one --- src/main/java/com/gitblit/wicket/GitBlitWebApp.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gitblit/wicket/GitBlitWebApp.java b/src/main/java/com/gitblit/wicket/GitBlitWebApp.java index 2300d0ff..74b80551 100644 --- a/src/main/java/com/gitblit/wicket/GitBlitWebApp.java +++ b/src/main/java/com/gitblit/wicket/GitBlitWebApp.java @@ -15,6 +15,8 @@ */ package com.gitblit.wicket; +import java.util.Locale; + import org.apache.wicket.Application; import org.apache.wicket.Page; import org.apache.wicket.Request; @@ -25,6 +27,7 @@ import org.apache.wicket.protocol.http.WebApplication; import com.gitblit.GitBlit; import com.gitblit.Keys; +import com.gitblit.utils.StringUtils; import com.gitblit.wicket.pages.ActivityPage; import com.gitblit.wicket.pages.BlamePage; import com.gitblit.wicket.pages.BlobDiffPage; @@ -143,7 +146,13 @@ public class GitBlitWebApp extends WebApplication { @Override public final Session newSession(Request request, Response response) { - return new GitBlitWebSession(request); + GitBlitWebSession gitBlitWebSession = new GitBlitWebSession(request); + + String forcedLocale = GitBlit.getString(Keys.web.forceDefaultLocale, null); + if (!StringUtils.isEmpty(forcedLocale)) { + gitBlitWebSession.setLocale(new Locale(forcedLocale)); + } + return gitBlitWebSession; } @Override -- 2.39.5