From 1a7423501e2005b332d06ec33a71f0a2d2108433 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 23 Dec 2020 21:04:02 +0300 Subject: Fix title locale on Settings page --- src/main/java/com/juick/www/controllers/Settings.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/com/juick/www/controllers/Settings.java b/src/main/java/com/juick/www/controllers/Settings.java index 70e550bb..b3750074 100644 --- a/src/main/java/com/juick/www/controllers/Settings.java +++ b/src/main/java/com/juick/www/controllers/Settings.java @@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; @@ -48,6 +49,8 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Arrays; import java.util.List; +import java.util.Locale; +import java.util.ResourceBundle; import java.util.stream.Collectors; import java.util.stream.IntStream; @@ -93,7 +96,9 @@ public class Settings { page = "main"; } - model.addAttribute("title", "Настройки"); + Locale locale = LocaleContextHolder.getLocale(); + + model.addAttribute("title", ResourceBundle.getBundle("messages", locale).getString("link.settings")); model.addAttribute("visitor", visitor); model.addAttribute("tags", tagService.getPopularTags()); model.addAttribute("auths", userService.getAuthCodes(visitor)); -- cgit v1.2.3