summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-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);
}