blob: 5d91f3da46f84900e7021153b5d82b5a626c4217 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test DocumentL10n in HTML environment</title>
<link rel="localization" href="test.ftl"/>
<script type="text/javascript">
document.testsReadyPromise = new Promise((resolve) => {
// The test is in this file to ensure that we're testing
// the behavior in a non-system principal.
document.addEventListener("DOMContentLoaded", async () => {
await document.l10n.ready;
// Assign the localization from JS
let label = document.getElementById("label1");
document.l10n.setAttributes(
label,
"subtitle",
{
name: "Firefox",
}
);
const customMsg = await document.l10n.formatValue("custom-message");
document.getElementById("customMessage").textContent = customMsg;
resolve();
}, {once: true});
});
</script>
</head>
<body>
<h1 id="main-desc" data-l10n-id="page-title"></h1>
<p id="label1"></p>
<p id="customMessage"></p>
</body>
</html>
|