From 568d15a741eba029051fd70f95b600d33ce1b6c2 Mon Sep 17 00:00:00 2001 From: Shinsuke Sugaya Date: Sat, 18 Jan 2025 20:38:54 +0900 Subject: [PATCH] fix #2544 Add lang attribute. --- .../org/codelibs/fess/taglib/FessFunctions.java | 13 +++++++++++++ src/main/webapp/WEB-INF/fe.tld | 12 ++++++++++++ src/main/webapp/WEB-INF/orig/view/advance.jsp | 4 ++-- .../webapp/WEB-INF/orig/view/error/badRequest.jsp | 4 ++-- src/main/webapp/WEB-INF/orig/view/error/error.jsp | 4 ++-- .../webapp/WEB-INF/orig/view/error/notFound.jsp | 4 ++-- src/main/webapp/WEB-INF/orig/view/error/system.jsp | 4 ++-- src/main/webapp/WEB-INF/orig/view/help.jsp | 4 ++-- src/main/webapp/WEB-INF/orig/view/index.jsp | 4 ++-- src/main/webapp/WEB-INF/orig/view/login/index.jsp | 4 ++-- .../webapp/WEB-INF/orig/view/login/newpassword.jsp | 4 ++-- src/main/webapp/WEB-INF/orig/view/profile/index.jsp | 4 ++-- src/main/webapp/WEB-INF/orig/view/search.jsp | 4 ++-- src/main/webapp/WEB-INF/view/advance.jsp | 4 ++-- src/main/webapp/WEB-INF/view/error/badRequest.jsp | 4 ++-- src/main/webapp/WEB-INF/view/error/error.jsp | 4 ++-- src/main/webapp/WEB-INF/view/error/notFound.jsp | 4 ++-- src/main/webapp/WEB-INF/view/error/system.jsp | 4 ++-- src/main/webapp/WEB-INF/view/help.jsp | 4 ++-- src/main/webapp/WEB-INF/view/index.jsp | 4 ++-- src/main/webapp/WEB-INF/view/login/index.jsp | 4 ++-- src/main/webapp/WEB-INF/view/login/newpassword.jsp | 4 ++-- src/main/webapp/WEB-INF/view/profile/index.jsp | 4 ++-- src/main/webapp/WEB-INF/view/search.jsp | 4 ++-- 24 files changed, 69 insertions(+), 44 deletions(-) diff --git a/src/main/java/org/codelibs/fess/taglib/FessFunctions.java b/src/main/java/org/codelibs/fess/taglib/FessFunctions.java index 5afb611d6..d9d01cc39 100644 --- a/src/main/java/org/codelibs/fess/taglib/FessFunctions.java +++ b/src/main/java/org/codelibs/fess/taglib/FessFunctions.java @@ -56,6 +56,7 @@ import org.codelibs.fess.helper.ViewHelper; import org.codelibs.fess.util.ComponentUtil; import org.lastaflute.di.util.LdiURLUtil; +import org.lastaflute.web.LastaWebKey; import org.lastaflute.web.util.LaRequestUtil; import org.lastaflute.web.util.LaResponseUtil; import org.lastaflute.web.util.LaServletContextUtil; @@ -99,6 +100,18 @@ protected FessFunctions() { // nothing } + public static String html(final boolean isOpen) { + if (isOpen) { + return " { + if (req.getAttribute(LastaWebKey.USER_LOCALE_KEY) instanceof Locale locale) { + return locale; + } + return Locale.ENGLISH; + }).orElse(Locale.ENGLISH).getLanguage() + "\">"; + } + return ""; + } + public static Boolean labelExists(final String value) { return LaRequestUtil.getOptionalRequest().map(req -> { @SuppressWarnings("unchecked") diff --git a/src/main/webapp/WEB-INF/fe.tld b/src/main/webapp/WEB-INF/fe.tld index 08741d550..c1cee9e3e 100644 --- a/src/main/webapp/WEB-INF/fe.tld +++ b/src/main/webapp/WEB-INF/fe.tld @@ -11,6 +11,18 @@ fe fess.tags.functions + + + Print HTML tag. + + html + org.codelibs.fess.taglib.FessFunctions + java.lang.String html(boolean) + + ${fe:html(true)}...${fe:html(false)} + + + Returns a label name. diff --git a/src/main/webapp/WEB-INF/orig/view/advance.jsp b/src/main/webapp/WEB-INF/orig/view/advance.jsp index 605b0119f..d1534969e 100644 --- a/src/main/webapp/WEB-INF/orig/view/advance.jsp +++ b/src/main/webapp/WEB-INF/orig/view/advance.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -323,4 +323,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/orig/view/error/badRequest.jsp b/src/main/webapp/WEB-INF/orig/view/error/badRequest.jsp index 9cd954c7e..6a55f7ad5 100644 --- a/src/main/webapp/WEB-INF/orig/view/error/badRequest.jsp +++ b/src/main/webapp/WEB-INF/orig/view/error/badRequest.jsp @@ -1,6 +1,6 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> <% try{ %> - +${fe:html(true)} @@ -31,5 +31,5 @@ - +${fe:html(false)} <% }catch(Exception e){session.invalidate();} %> diff --git a/src/main/webapp/WEB-INF/orig/view/error/error.jsp b/src/main/webapp/WEB-INF/orig/view/error/error.jsp index c1acbd77c..b9ce00db3 100644 --- a/src/main/webapp/WEB-INF/orig/view/error/error.jsp +++ b/src/main/webapp/WEB-INF/orig/view/error/error.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -35,4 +35,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/orig/view/error/notFound.jsp b/src/main/webapp/WEB-INF/orig/view/error/notFound.jsp index ea834214d..74014a76b 100644 --- a/src/main/webapp/WEB-INF/orig/view/error/notFound.jsp +++ b/src/main/webapp/WEB-INF/orig/view/error/notFound.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -33,4 +33,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/orig/view/error/system.jsp b/src/main/webapp/WEB-INF/orig/view/error/system.jsp index 6ac728697..5ca50885e 100644 --- a/src/main/webapp/WEB-INF/orig/view/error/system.jsp +++ b/src/main/webapp/WEB-INF/orig/view/error/system.jsp @@ -1,6 +1,6 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> <% try{ %> - +${fe:html(true)} @@ -31,5 +31,5 @@ - +${fe:html(false)} <% }catch(Exception e){session.invalidate();} %> diff --git a/src/main/webapp/WEB-INF/orig/view/help.jsp b/src/main/webapp/WEB-INF/orig/view/help.jsp index f827ded22..8eb0581bd 100644 --- a/src/main/webapp/WEB-INF/orig/view/help.jsp +++ b/src/main/webapp/WEB-INF/orig/view/help.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -33,4 +33,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/orig/view/index.jsp b/src/main/webapp/WEB-INF/orig/view/index.jsp index 09f23e55c..ce6ca6861 100644 --- a/src/main/webapp/WEB-INF/orig/view/index.jsp +++ b/src/main/webapp/WEB-INF/orig/view/index.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -173,4 +173,4 @@ - +${fe:html(false)} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/orig/view/login/index.jsp b/src/main/webapp/WEB-INF/orig/view/login/index.jsp index a94cc5a8d..5e063a320 100644 --- a/src/main/webapp/WEB-INF/orig/view/login/index.jsp +++ b/src/main/webapp/WEB-INF/orig/view/login/index.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -79,4 +79,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/orig/view/login/newpassword.jsp b/src/main/webapp/WEB-INF/orig/view/login/newpassword.jsp index ee1deb3fb..fce47b965 100644 --- a/src/main/webapp/WEB-INF/orig/view/login/newpassword.jsp +++ b/src/main/webapp/WEB-INF/orig/view/login/newpassword.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -78,4 +78,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/orig/view/profile/index.jsp b/src/main/webapp/WEB-INF/orig/view/profile/index.jsp index 0a1cc413b..23a4287d8 100644 --- a/src/main/webapp/WEB-INF/orig/view/profile/index.jsp +++ b/src/main/webapp/WEB-INF/orig/view/profile/index.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -89,4 +89,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/orig/view/search.jsp b/src/main/webapp/WEB-INF/orig/view/search.jsp index 24b1cde6a..fc2096ee3 100644 --- a/src/main/webapp/WEB-INF/orig/view/search.jsp +++ b/src/main/webapp/WEB-INF/orig/view/search.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -155,4 +155,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/view/advance.jsp b/src/main/webapp/WEB-INF/view/advance.jsp index 605b0119f..d1534969e 100644 --- a/src/main/webapp/WEB-INF/view/advance.jsp +++ b/src/main/webapp/WEB-INF/view/advance.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -323,4 +323,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/view/error/badRequest.jsp b/src/main/webapp/WEB-INF/view/error/badRequest.jsp index 9cd954c7e..6a55f7ad5 100644 --- a/src/main/webapp/WEB-INF/view/error/badRequest.jsp +++ b/src/main/webapp/WEB-INF/view/error/badRequest.jsp @@ -1,6 +1,6 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> <% try{ %> - +${fe:html(true)} @@ -31,5 +31,5 @@ - +${fe:html(false)} <% }catch(Exception e){session.invalidate();} %> diff --git a/src/main/webapp/WEB-INF/view/error/error.jsp b/src/main/webapp/WEB-INF/view/error/error.jsp index c1acbd77c..b9ce00db3 100644 --- a/src/main/webapp/WEB-INF/view/error/error.jsp +++ b/src/main/webapp/WEB-INF/view/error/error.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -35,4 +35,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/view/error/notFound.jsp b/src/main/webapp/WEB-INF/view/error/notFound.jsp index ea834214d..74014a76b 100644 --- a/src/main/webapp/WEB-INF/view/error/notFound.jsp +++ b/src/main/webapp/WEB-INF/view/error/notFound.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -33,4 +33,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/view/error/system.jsp b/src/main/webapp/WEB-INF/view/error/system.jsp index 6ac728697..5ca50885e 100644 --- a/src/main/webapp/WEB-INF/view/error/system.jsp +++ b/src/main/webapp/WEB-INF/view/error/system.jsp @@ -1,6 +1,6 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> <% try{ %> - +${fe:html(true)} @@ -31,5 +31,5 @@ - +${fe:html(false)} <% }catch(Exception e){session.invalidate();} %> diff --git a/src/main/webapp/WEB-INF/view/help.jsp b/src/main/webapp/WEB-INF/view/help.jsp index f827ded22..8eb0581bd 100644 --- a/src/main/webapp/WEB-INF/view/help.jsp +++ b/src/main/webapp/WEB-INF/view/help.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -33,4 +33,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/view/index.jsp b/src/main/webapp/WEB-INF/view/index.jsp index 09f23e55c..ce6ca6861 100644 --- a/src/main/webapp/WEB-INF/view/index.jsp +++ b/src/main/webapp/WEB-INF/view/index.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -173,4 +173,4 @@ - +${fe:html(false)} \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/view/login/index.jsp b/src/main/webapp/WEB-INF/view/login/index.jsp index a94cc5a8d..5e063a320 100644 --- a/src/main/webapp/WEB-INF/view/login/index.jsp +++ b/src/main/webapp/WEB-INF/view/login/index.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -79,4 +79,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/view/login/newpassword.jsp b/src/main/webapp/WEB-INF/view/login/newpassword.jsp index ee1deb3fb..fce47b965 100644 --- a/src/main/webapp/WEB-INF/view/login/newpassword.jsp +++ b/src/main/webapp/WEB-INF/view/login/newpassword.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -78,4 +78,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/view/profile/index.jsp b/src/main/webapp/WEB-INF/view/profile/index.jsp index 0a1cc413b..23a4287d8 100644 --- a/src/main/webapp/WEB-INF/view/profile/index.jsp +++ b/src/main/webapp/WEB-INF/view/profile/index.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -89,4 +89,4 @@ - +${fe:html(false)} diff --git a/src/main/webapp/WEB-INF/view/search.jsp b/src/main/webapp/WEB-INF/view/search.jsp index 24b1cde6a..fc2096ee3 100644 --- a/src/main/webapp/WEB-INF/view/search.jsp +++ b/src/main/webapp/WEB-INF/view/search.jsp @@ -1,5 +1,5 @@ <%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> - +${fe:html(true)} @@ -155,4 +155,4 @@ - +${fe:html(false)}