diff options
author | Vitaly Takmazov | 2020-12-25 15:06:38 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2020-12-25 15:06:38 +0300 |
commit | 4ba4e27308fa963e96669912ead9bf91a06a9dba (patch) | |
tree | c0687af4d6067919588acecd7c83a91a55c2eac9 /src/main/java | |
parent | 1a7423501e2005b332d06ec33a71f0a2d2108433 (diff) |
Refactoring
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/juick/www/controllers/Settings.java | 4 | ||||
-rw-r--r-- | src/main/java/com/juick/www/controllers/Site.java | 4 |
2 files changed, 2 insertions, 6 deletions
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<Integer> mids; - Locale locale = LocaleContextHolder.getLocale(); - if (paramSearch != null) { String searchTitle = ResourceBundle.getBundle("messages", locale).getString("title.search"); title = searchTitle + StringEscapeUtils.escapeHtml4(paramSearch); |