Fix several I18n isssues.

This commit is contained in:
Paulo Gustavo Veiga
2012-07-06 00:46:54 -03:00
parent aedab95b4a
commit b816d12842
15 changed files with 111 additions and 173 deletions

View File

@@ -44,7 +44,7 @@ public class UserLocaleInterceptor extends HandlerInterceptorAdapter {
if (user != null && session != null) {
String userLocale = user.getLocale();
final Locale sessionLocale = (Locale) session.getAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME);
if ((userLocale != null) && ((sessionLocale == null) || (!userLocale.equals(sessionLocale.getISO3Language())))) {
if ((userLocale != null) && ((sessionLocale == null) || (!userLocale.equals(sessionLocale.toString())))) {
session.setAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME, new Locale(userLocale));
}
}

View File

@@ -70,6 +70,8 @@ public class MindmapController {
final MindMapBean mindmap = findMindmapBean(id);
model.addAttribute("principal", Utils.getUser());
model.addAttribute("mindmap", mindmap);
final Locale locale = LocaleContextHolder.getLocale();
model.addAttribute("locale", locale.toString().toLowerCase());
return "mindmapPrint";
}
@@ -128,7 +130,7 @@ public class MindmapController {
@RequestMapping(value = "maps/")
public String showListPage(@NotNull Model model) {
final Locale locale = LocaleContextHolder.getLocale();
model.addAttribute("locale", locale.getISO3Language());
model.addAttribute("locale", locale.toString().toLowerCase());
return "mindmapList";
}
@@ -143,7 +145,7 @@ public class MindmapController {
// Configure default locale for the editor ...
final Locale locale = LocaleContextHolder.getLocale();
model.addAttribute("locale", locale.getISO3Language());
model.addAttribute("locale", locale.toString().toLowerCase());
model.addAttribute("principal", Utils.getUser());
result = "mindmapEditor";
} else {
@@ -178,6 +180,8 @@ public class MindmapController {
final MindMapBean mindmap = findMindmapBean(id);
view = new ModelAndView("mindmapEmbedded", "mindmap", mindmap);
view.addObject("zoom", zoom == null ? 1 : zoom);
final Locale locale = LocaleContextHolder.getLocale();
view.addObject("locale", locale.toString().toLowerCase());
return view;
}

View File

@@ -86,8 +86,6 @@ public class AccountController extends BaseController {
if (language == null) {
throw new IllegalArgumentException("language can not be null");
} if (!language.equals("en") && !language.equals("es") ){
throw new IllegalArgumentException("language not supported yet");
}
final User user = Utils.getUser();