summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-06-09 11:28:08 -0400
committerJames Moger <james.moger@gitblit.com>2014-06-09 11:28:08 -0400
commit7e6932b27785d8dd9309c9a4d7a5fa9824c6b9cf (patch)
tree88ac662c120eb4d3bfbe6e829d9e941871b12d18
parente0c76480851a21d8901df89474100db2f7089e9b (diff)
downloadgitblit-7e6932b27785d8dd9309c9a4d7a5fa9824c6b9cf.tar.gz
gitblit-7e6932b27785d8dd9309c9a4d7a5fa9824c6b9cf.zip
Fix locale preference storing
-rw-r--r--src/main/java/com/gitblit/ConfigUserService.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/com/gitblit/ConfigUserService.java b/src/main/java/com/gitblit/ConfigUserService.java
index 0c5b2a58..d7d6c14f 100644
--- a/src/main/java/com/gitblit/ConfigUserService.java
+++ b/src/main/java/com/gitblit/ConfigUserService.java
@@ -24,6 +24,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -712,8 +713,14 @@ public class ConfigUserService implements IUserService {
config.setBoolean(USER, model.username, DISABLED, true);
}
if (model.getPreferences() != null) {
- if (model.getPreferences().getLocale() != null) {
- String val = model.getPreferences().getLocale().getLanguage() + "_" + model.getPreferences().getLocale().getCountry();
+ Locale locale = model.getPreferences().getLocale();
+ if (locale != null) {
+ String val;
+ if (StringUtils.isEmpty(locale.getCountry())) {
+ val = locale.getLanguage();
+ } else {
+ val = locale.getLanguage() + "_" + locale.getCountry();
+ }
config.setString(USER, model.username, LOCALE, val);
}