- Fix subdirectory links in pages servlet (issue-411)
- Fix subdirectory navigation in pages servlet (issue-412)
- Fix bug in adding invalid or empty SSH keys (ticket-50)
+ - Fix forcing default locale to en or LANG_CC for web ui (ticket-51)
changes:
- improve French translation (pr-176)
- simplify current plugin release detection and ignore the currentRelease registry field
import java.util.Collection;
import java.util.Date;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
return runtimeManager.getTimezone();
}
+ @Override
+ public Locale getLocale() {
+ return runtimeManager.getLocale();
+ }
+
@Override
public boolean isDebugMode() {
return runtimeManager.isDebugMode();
import java.io.File;
import java.util.Date;
+import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
*/
TimeZone getTimezone();
+ /**
+ * Returns the fixed locale for clients, or null if clients may choose their locale
+ *
+ * @return a fixed locale or null if clients are allowed to specify locale preference
+ * @since 1.5.1
+ */
+ Locale getLocale();
+
/**
* Determine if this Gitblit instance is actively serving git repositories
* or if it is merely a repository viewer.
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
logger.info("Settings : " + settings.toString());
logTimezone("JVM timezone: ", TimeZone.getDefault());
logTimezone("App timezone: ", getTimezone());
+ logger.info("JVM locale : " + Locale.getDefault());
+ logger.info("App locale : " + (getLocale() == null ? "<client>" : getLocale()));
return this;
}
logger.info("{}{} ({})", new Object [] { type, zone.getID(), offset });
}
+ @Override
+ public Locale getLocale() {
+ String lc = settings.getString(Keys.web.forceDefaultLocale, null);
+ if (!StringUtils.isEmpty(lc)) {
+ int underscore = lc.indexOf('_');
+ if (underscore > 0) {
+ String lang = lc.substring(0, underscore);
+ String cc = lc.substring(underscore + 1);
+ return new Locale(lang, cc);
+ } else {
+ return new Locale(lc);
+ }
+ }
+ return null;
+ }
+
/**
* Is Gitblit running in debug mode?
*
if (StringUtils.isEmpty(locale)) {
return null;
}
+ int underscore = locale.indexOf('_');
+ if (underscore > 0) {
+ String lang = locale.substring(0, underscore);
+ String cc = locale.substring(underscore + 1);
+ return new Locale(lang, cc);
+ }
return new Locale(locale);
}
import com.gitblit.manager.IUserManager;
import com.gitblit.tickets.ITicketService;
import com.gitblit.transport.ssh.IPublicKeyManager;
-import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.pages.ActivityPage;
import com.gitblit.wicket.pages.BlamePage;
import com.gitblit.wicket.pages.BlobDiffPage;
public final Session newSession(Request request, Response response) {
GitBlitWebSession gitBlitWebSession = new GitBlitWebSession(request);
- String forcedLocale = settings.getString(Keys.web.forceDefaultLocale, null);
- if (!StringUtils.isEmpty(forcedLocale)) {
- gitBlitWebSession.setLocale(new Locale(forcedLocale));
+ Locale forcedLocale = runtime().getLocale();
+ if (forcedLocale != null) {
+ gitBlitWebSession.setLocale(forcedLocale);
}
return gitBlitWebSession;
}
import java.io.File;
import java.util.Date;
+import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
return TimeZone.getDefault();
}
+ @Override
+ public Locale getLocale() {
+ return Locale.getDefault();
+ }
+
@Override
public boolean isServingRepositories() {
return true;