From 4ba4e27308fa963e96669912ead9bf91a06a9dba Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 25 Dec 2020 15:06:38 +0300 Subject: Refactoring --- src/main/java/com/juick/www/controllers/Settings.java | 4 +--- src/main/java/com/juick/www/controllers/Site.java | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src/main/java/com/juick/www/controllers') diff --git a/src/main/java/com/juick/www/controllers/Settings.java b/src/main/java/com/juick/www/controllers/Settings.java index b3750074..5cda7bc4 100644 --- a/src/main/java/com/juick/www/controllers/Settings.java +++ b/src/main/java/com/juick/www/controllers/Settings.java @@ -28,7 +28,6 @@ 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; @@ -84,6 +83,7 @@ public class Settings { @GetMapping("/settings") protected String doGet( @Visitor User visitor, + Locale locale, HttpServletRequest request, HttpServletResponse response, ModelMap model) throws IOException { if (visitor.isAnonymous()) { @@ -96,8 +96,6 @@ public class Settings { page = "main"; } - Locale locale = LocaleContextHolder.getLocale(); - model.addAttribute("title", ResourceBundle.getBundle("messages", locale).getString("link.settings")); model.addAttribute("visitor", visitor); model.addAttribute("tags", tagService.getPopularTags()); diff --git a/src/main/java/com/juick/www/controllers/Site.java b/src/main/java/com/juick/www/controllers/Site.java index 0cc0abfe..1e308f6a 100644 --- a/src/main/java/com/juick/www/controllers/Site.java +++ b/src/main/java/com/juick/www/controllers/Site.java @@ -30,7 +30,6 @@ import com.juick.util.MessageUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.text.StringEscapeUtils; -import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -92,6 +91,7 @@ public class Site { @GetMapping("/") protected String doGet( @Visitor User visitor, + Locale locale, @RequestParam(required = false) String tag, @RequestParam(name = "show", required = false) String paramShow, @RequestParam(name = "search", required = false) String paramSearch, @@ -113,8 +113,6 @@ public class Site { String title; List mids; - Locale locale = LocaleContextHolder.getLocale(); - if (paramSearch != null) { String searchTitle = ResourceBundle.getBundle("messages", locale).getString("title.search"); title = searchTitle + StringEscapeUtils.escapeHtml4(paramSearch); -- cgit v1.2.3