Skip to content

Commit 718b3f0

Browse files
Scott DoverScott Dover
authored andcommitted
chore: move translation location
Signed-off-by: Scott Dover <[email protected]>
1 parent 23610b4 commit 718b3f0

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

client/src/panels/WebviewManager.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,9 @@ export abstract class WebView {
8181
${styles}
8282
<title>${this.title}</title>
8383
</head>
84-
<body>
84+
<body data-l10n='${JSON.stringify(this.l10nMessages ? this.l10nMessages() : {})}'>
8585
${this.body()}
8686
${scripts}
87-
${
88-
this?.l10nMessages
89-
? `<script type="application/json" id="l10n-messages">${JSON.stringify(this?.l10nMessages())}</script>`
90-
: ""
91-
}
9287
</body>
9388
</html>`;
9489

client/src/webview/localize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const localize = (term: string, replacments?: Record<string, string>) => {
99
if (!localizedTerms) {
1010
try {
1111
localizedTerms = JSON.parse(
12-
document.querySelector("#l10n-messages").textContent,
12+
document.body.getAttribute("data-l10n") || "{}",
1313
);
1414
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1515
} catch (e) {

0 commit comments

Comments
 (0)