Skip to content

Commit 6b681c3

Browse files
izaerabrianchandotcom
authored andcommitted
LPD-52709 Fix test frontend-js-web/main/DynamicInlineScroll.spec.ts > Check user pagination url working correctly
The legacy JS bundles in frontend-js-web use a custom build which bypasses the usual language handling plugin. Because of that we need to make sure that language keys end up in language.json and that they are loaded before the code using them is executed.
1 parent 644f824 commit 6b681c3

File tree

2 files changed

+46
-7
lines changed

2 files changed

+46
-7
lines changed

modules/apps/frontend-js/frontend-js-web/src/main/java/com/liferay/frontend/js/web/internal/servlet/taglib/LiferayGlobalObjectPostAUIDynamicInclude.java

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package com.liferay.frontend.js.web.internal.servlet.taglib;
77

8+
import com.liferay.petra.string.StringPool;
89
import com.liferay.portal.kernel.content.security.policy.ContentSecurityPolicyNonceProviderUtil;
910
import com.liferay.portal.kernel.log.Log;
1011
import com.liferay.portal.kernel.log.LogFactoryUtil;
@@ -63,9 +64,16 @@ public void include(
6364
"frontend-js-web", "/Liferay.js");
6465

6566
_renderScript(
66-
httpServletRequest, httpServletResponse.getWriter(),
67+
null, httpServletRequest, httpServletResponse.getWriter(),
6768
webContextScriptAbsolutePortalURLBuilder.build(),
6869
"text/javascript");
70+
71+
_renderScript(
72+
"await import(`@liferay/language" +
73+
"/${Liferay.ThemeDisplay.getLanguageId()}/frontend-js-web" +
74+
"/all.js`);",
75+
httpServletRequest, httpServletResponse.getWriter(), null,
76+
"module");
6977
}
7078
catch (Exception exception) {
7179
_log.error(exception);
@@ -90,8 +98,8 @@ protected void deactivate() {
9098
}
9199

92100
private void _renderScript(
93-
HttpServletRequest httpServletRequest, PrintWriter printWriter,
94-
String src, String type) {
101+
String content, HttpServletRequest httpServletRequest,
102+
PrintWriter printWriter, String src, String type) {
95103

96104
printWriter.print("<script");
97105
printWriter.print(
@@ -109,11 +117,23 @@ private void _renderScript(
109117
_log.error(exception);
110118
}
111119

112-
printWriter.print(" data-senna-track=\"permanent\" src=\"");
113-
printWriter.print(src);
114-
printWriter.print("\" type=\"");
120+
printWriter.print(" data-senna-track=\"permanent\"");
121+
122+
if (Validator.isNotNull(src)) {
123+
printWriter.print(" src=\"");
124+
printWriter.print(src);
125+
printWriter.print(StringPool.QUOTE);
126+
}
127+
128+
printWriter.print(" type=\"");
115129
printWriter.print(type);
116-
printWriter.println("\"></script>");
130+
printWriter.print("\">");
131+
132+
if (Validator.isNotNull(content)) {
133+
printWriter.print(content);
134+
}
135+
136+
printWriter.println("</script>");
117137
}
118138

119139
private static final Log _log = LogFactoryUtil.getLog(
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"keys": [
3+
"are-you-sure-you-want-to-remove-this-component",
4+
"danger",
5+
"due-to-inactivity-your-session-has-expired",
6+
"due-to-inactivity-your-session-will-expire",
7+
"no-reviewers-were-found",
8+
"extend",
9+
"minimize",
10+
"page-x",
11+
"please-contact-the-administrator-to-assign-reviewers",
12+
"proceed",
13+
"restore",
14+
"reviewer",
15+
"session-expires-in-x",
16+
"there-was-an-unexpected-error.-please-refresh-the-current-page",
17+
"this-change-will-only-be-shown-after-you-refresh-the-page"
18+
]
19+
}

0 commit comments

Comments
 (0)