@yozora-tech/qfluent 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/assets/BDqr3vjM-bundle-graph.json +1 -0
- package/lib/assets/DLXuL6n7-bundle-graph.json +1 -0
- package/lib/index.qwik.cjs +11 -12
- package/lib/index.qwik.mjs +1 -10
- package/lib/q-manifest.json +25 -25
- package/lib/qfluent/context.qwik.cjs +170 -181
- package/lib/qfluent/context.qwik.mjs +170 -166
- package/lib/qfluent/tools.qwik.cjs +16 -11
- package/lib/qfluent/tools.qwik.mjs +17 -12
- package/lib/qfluent/translate.qwik.cjs +77 -78
- package/lib/qfluent/translate.qwik.mjs +78 -81
- package/package.json +12 -6
- package/lib/assets/DVjQdr_6-bundle-graph.json +0 -1
- package/lib/assets/l4W0yvKV-bundle-graph.json +0 -1
|
@@ -1,173 +1,177 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Slot, _captures, _jsxSorted, componentQrl, createContextId, inlinedQrl, isServer, noSerialize, useContext, useContextProvider, useOnDocument, useSignal, useTaskQrl } from "@qwik.dev/core";
|
|
2
2
|
import { FluentBundle, FluentResource } from "@fluent/bundle";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
/** @internal */ var FluentLocalesId = createContextId("QwikFluentLocales");
|
|
4
|
+
/** @internal */ var FluentResourcesId = createContextId("QwikFluentResources");
|
|
5
|
+
/** @internal */ var FluentBundlesId = createContextId("QwikFluentBundles");
|
|
6
|
+
/** @internal */ var FluentErrorsId = createContextId("QwikFluentErrors");
|
|
7
|
+
/**
|
|
8
|
+
* Signal to list of preferred locales. Translations are picked from these languages, with fallbacks as needed.
|
|
9
|
+
*
|
|
10
|
+
* Normally you want to set this to `preferred_languages.concat(navigator.languages)`.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const locales = useFluentLocales();
|
|
14
|
+
* return (
|
|
15
|
+
* <select onChange$={(event, select) => {
|
|
16
|
+
* locales.value = [select.value].concat(navigator.languages);
|
|
17
|
+
* }}>
|
|
18
|
+
* <option value="ar">Arabic</option>
|
|
19
|
+
* <option value="en">English</option>
|
|
20
|
+
* <option value="ja">Japanese</option>
|
|
21
|
+
* ...
|
|
22
|
+
* </select>
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/ function useFluentLocales() {
|
|
26
|
+
return useContext(FluentLocalesId);
|
|
9
27
|
}
|
|
10
|
-
|
|
11
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Includes your resources and compiled FluentBundles by locales.
|
|
30
|
+
*
|
|
31
|
+
* You can make use of your custom resource properties with this.
|
|
32
|
+
*/ function useFluentResources() {
|
|
33
|
+
return useContext(FluentResourcesId);
|
|
12
34
|
}
|
|
13
|
-
|
|
14
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Useful for debugging errors in resources.
|
|
37
|
+
*
|
|
38
|
+
* You can clear the errors after use.
|
|
39
|
+
*/ function useFluentErrors() {
|
|
40
|
+
return useContext(FluentErrorsId);
|
|
15
41
|
}
|
|
16
42
|
function ataToUtf8(pathname) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
24
|
-
for (let i = 0; i < binaryString.length; i++) {
|
|
25
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
26
|
-
}
|
|
27
|
-
return new TextDecoder().decode(bytes);
|
|
43
|
+
const a = pathname.indexOf(";base64,");
|
|
44
|
+
if (a === -1) throw new Error("Invalid ata url pathname: " + pathname);
|
|
45
|
+
const binaryString = atob(pathname.slice(a + 8));
|
|
46
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
47
|
+
for (let i = 0; i < binaryString.length; i++) bytes[i] = binaryString.charCodeAt(i);
|
|
48
|
+
return new TextDecoder().decode(bytes);
|
|
28
49
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
}, "FluentProvider_component_useTask_1_GdWGQNUVI4g", [
|
|
158
|
-
locales,
|
|
159
|
-
resmap,
|
|
160
|
-
ssr
|
|
161
|
-
]));
|
|
162
|
-
return /* @__PURE__ */ _jsxSorted(Slot, null, null, null, 3, "76_0");
|
|
50
|
+
/**
|
|
51
|
+
* Use this in `src/root.tsx`.
|
|
52
|
+
*
|
|
53
|
+
* ```tsx
|
|
54
|
+
* <body>
|
|
55
|
+
* <FluentProvider resources={...}>
|
|
56
|
+
* <RouterOutlet />
|
|
57
|
+
* </FluentProvider>
|
|
58
|
+
* </body>
|
|
59
|
+
* ```
|
|
60
|
+
*/ var FluentProvider = /*#__PURE__*/ componentQrl(/*#__PURE__*/ inlinedQrl((_rawProps) => {
|
|
61
|
+
const locales = useSignal(_rawProps.acceptLanguage ?? ["en"]);
|
|
62
|
+
const bunmap = useSignal(noSerialize({}));
|
|
63
|
+
const resmap = useSignal(noSerialize({}));
|
|
64
|
+
const errors = useSignal(noSerialize([]));
|
|
65
|
+
useContextProvider(FluentLocalesId, locales);
|
|
66
|
+
useContextProvider(FluentBundlesId, bunmap);
|
|
67
|
+
useContextProvider(FluentResourcesId, resmap);
|
|
68
|
+
useContextProvider(FluentErrorsId, errors);
|
|
69
|
+
const ssr = useSignal(true);
|
|
70
|
+
useOnDocument("load", /*#__PURE__*/ inlinedQrl(() => {
|
|
71
|
+
const locales = _captures[0], ssr = _captures[1];
|
|
72
|
+
if (!ssr.value) return;
|
|
73
|
+
ssr.value = false;
|
|
74
|
+
locales.value = navigator.languages.concat();
|
|
75
|
+
}, "FluentProvider_component_useOnDocument_9BL0L0WgLlY", [locales, ssr]));
|
|
76
|
+
useTaskQrl(/*#__PURE__*/ inlinedQrl((_rawProps1) => {
|
|
77
|
+
const _rawProps = _captures[0], bunmap = _captures[1], errors = _captures[2], locales = _captures[3], resmap = _captures[4], ssr = _captures[5];
|
|
78
|
+
_rawProps1.track(locales);
|
|
79
|
+
_rawProps1.track(ssr);
|
|
80
|
+
if (!bunmap.value) bunmap.value = noSerialize({});
|
|
81
|
+
if (!resmap.value) resmap.value = noSerialize({});
|
|
82
|
+
if (!errors.value) errors.value = noSerialize([]);
|
|
83
|
+
const res = noSerialize(resmap.value);
|
|
84
|
+
const bun = noSerialize(bunmap.value);
|
|
85
|
+
const promises = [];
|
|
86
|
+
const whitelist = locales.value;
|
|
87
|
+
let has_errors = false;
|
|
88
|
+
for (const r of _rawProps.resources) {
|
|
89
|
+
let ok = false;
|
|
90
|
+
for (const x of r.locales) {
|
|
91
|
+
if (res[x]) break;
|
|
92
|
+
if (whitelist.includes(x)) {
|
|
93
|
+
ok = true;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (!ok) continue;
|
|
98
|
+
const b = new FluentBundle(r.locales);
|
|
99
|
+
for (const x of r.locales) {
|
|
100
|
+
res[x] = r;
|
|
101
|
+
bun[x] = b;
|
|
102
|
+
}
|
|
103
|
+
for (const url of r.resources) {
|
|
104
|
+
let promise;
|
|
105
|
+
if (isServer) {
|
|
106
|
+
const rel = url.toString().slice(1);
|
|
107
|
+
const candidates = [new URL("../dist/", _rawProps.origin), _rawProps.origin].map((base) => new URL(rel, base));
|
|
108
|
+
const ata = candidates.find((c) => c.protocol === "ata:");
|
|
109
|
+
if (ata) promise = new Promise((resolve, reject) => {
|
|
110
|
+
try {
|
|
111
|
+
resolve(ataToUtf8(ata.pathname));
|
|
112
|
+
} catch (err) {
|
|
113
|
+
reject(err);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
else promise = import("node:fs/promises").then(async (fs) => {
|
|
117
|
+
const { fileURLToPath } = await import("node:url");
|
|
118
|
+
let firstError;
|
|
119
|
+
for (const c of candidates) try {
|
|
120
|
+
const buf = await fs.readFile(c.protocol === "file:" ? fileURLToPath(c) : c.pathname);
|
|
121
|
+
return new TextDecoder().decode(buf);
|
|
122
|
+
} catch (err) {
|
|
123
|
+
if (firstError === void 0) firstError = err;
|
|
124
|
+
}
|
|
125
|
+
throw firstError;
|
|
126
|
+
});
|
|
127
|
+
} else promise = fetch(url).then((resp) => resp.text());
|
|
128
|
+
promises.push(promise.then((s) => {
|
|
129
|
+
const errset = b.addResource(new FluentResource(s));
|
|
130
|
+
if (errset.length) {
|
|
131
|
+
errors.value.push({
|
|
132
|
+
resource: r,
|
|
133
|
+
errors: errset
|
|
134
|
+
});
|
|
135
|
+
has_errors = true;
|
|
136
|
+
console.error(`[qfluent] Errors in resource ${url}:`, errset);
|
|
137
|
+
}
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return Promise.all(promises).then(() => {
|
|
142
|
+
bunmap.trigger();
|
|
143
|
+
resmap.trigger();
|
|
144
|
+
if (has_errors) errors.trigger();
|
|
145
|
+
});
|
|
146
|
+
}, "FluentProvider_component_useTask_0r0LUJYLJnU", [
|
|
147
|
+
_rawProps,
|
|
148
|
+
bunmap,
|
|
149
|
+
errors,
|
|
150
|
+
locales,
|
|
151
|
+
resmap,
|
|
152
|
+
ssr
|
|
153
|
+
]));
|
|
154
|
+
useTaskQrl(/*#__PURE__*/ inlinedQrl(({ track }) => {
|
|
155
|
+
const locales = _captures[0], resmap = _captures[1], ssr = _captures[2];
|
|
156
|
+
if (track(ssr)) return;
|
|
157
|
+
if (!track(resmap)) return;
|
|
158
|
+
track(locales);
|
|
159
|
+
const root = document.querySelector("html");
|
|
160
|
+
if (!root) return;
|
|
161
|
+
for (const l of locales.value) {
|
|
162
|
+
const b = resmap.value[l];
|
|
163
|
+
if (!b) continue;
|
|
164
|
+
root.lang = l;
|
|
165
|
+
const dir = b.dir;
|
|
166
|
+
if (dir) root.dir = dir;
|
|
167
|
+
else root.dir = "";
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}, "FluentProvider_component_useTask_1_GdWGQNUVI4g", [
|
|
171
|
+
locales,
|
|
172
|
+
resmap,
|
|
173
|
+
ssr
|
|
174
|
+
]));
|
|
175
|
+
return /*#__PURE__*/ _jsxSorted(Slot, null, null, null, 3, "76_0");
|
|
163
176
|
}, "FluentProvider_component_LWfKAJ3jVqM"));
|
|
164
|
-
export {
|
|
165
|
-
FluentBundlesId,
|
|
166
|
-
FluentErrorsId,
|
|
167
|
-
FluentLocalesId,
|
|
168
|
-
FluentProvider,
|
|
169
|
-
FluentResourcesId,
|
|
170
|
-
useFluentErrors,
|
|
171
|
-
useFluentLocales,
|
|
172
|
-
useFluentResources
|
|
173
|
-
};
|
|
177
|
+
export { FluentBundlesId, FluentErrorsId, FluentLocalesId, FluentProvider, FluentResourcesId, useFluentErrors, useFluentLocales, useFluentResources };
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Parse an `Accept-Language` header as array of locales, sorted by quality value.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* parseAcceptLanguage("en-US;q=0.3, ja, zh-CN;q=0.9, zh;q=0.7")
|
|
6
|
+
* // [ "ja", "zh-CN", "zh", "en-US" ]
|
|
7
|
+
* ```
|
|
8
|
+
*/ function parseAcceptLanguage(header) {
|
|
9
|
+
return header.split(",").map((entry) => {
|
|
10
|
+
const [locale, ...params] = entry.split(";");
|
|
11
|
+
const q = params.find((p) => p.trim().startsWith("q="));
|
|
12
|
+
return {
|
|
13
|
+
locale: locale.trim(),
|
|
14
|
+
q: q ? parseFloat(q.split("=")[1]) : 1
|
|
15
|
+
};
|
|
16
|
+
}).filter((x) => x.locale).sort((a, b) => b.q - a.q).map((x) => x.locale);
|
|
12
17
|
}
|
|
13
18
|
exports.parseAcceptLanguage = parseAcceptLanguage;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Parse an `Accept-Language` header as array of locales, sorted by quality value.
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* parseAcceptLanguage("en-US;q=0.3, ja, zh-CN;q=0.9, zh;q=0.7")
|
|
6
|
+
* // [ "ja", "zh-CN", "zh", "en-US" ]
|
|
7
|
+
* ```
|
|
8
|
+
*/ function parseAcceptLanguage(header) {
|
|
9
|
+
return header.split(",").map((entry) => {
|
|
10
|
+
const [locale, ...params] = entry.split(";");
|
|
11
|
+
const q = params.find((p) => p.trim().startsWith("q="));
|
|
12
|
+
return {
|
|
13
|
+
locale: locale.trim(),
|
|
14
|
+
q: q ? parseFloat(q.split("=")[1]) : 1
|
|
15
|
+
};
|
|
16
|
+
}).filter((x) => x.locale).sort((a, b) => b.q - a.q).map((x) => x.locale);
|
|
10
17
|
}
|
|
11
|
-
export {
|
|
12
|
-
parseAcceptLanguage
|
|
13
|
-
};
|
|
18
|
+
export { parseAcceptLanguage };
|
|
@@ -1,87 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const core = require("@qwik.dev/core");
|
|
4
|
-
const context = require("./context.qwik.cjs");
|
|
1
|
+
const require_context = require("./context.qwik.cjs");
|
|
2
|
+
let _qwik_dev_core = require("@qwik.dev/core");
|
|
5
3
|
function wrapArgs(args) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
case "object":
|
|
19
|
-
if (args === null) {
|
|
20
|
-
return {
|
|
21
|
-
x: "null"
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
return args;
|
|
25
|
-
default:
|
|
26
|
-
return {
|
|
27
|
-
x: String(args)
|
|
28
|
-
};
|
|
29
|
-
}
|
|
4
|
+
switch (typeof args) {
|
|
5
|
+
case "string":
|
|
6
|
+
case "number":
|
|
7
|
+
case "bigint":
|
|
8
|
+
case "boolean": return { x: args };
|
|
9
|
+
case "undefined": return { x: "undefined" };
|
|
10
|
+
case "object":
|
|
11
|
+
if (args === null) return { x: "null" };
|
|
12
|
+
return args;
|
|
13
|
+
default: return { x: String(args) };
|
|
14
|
+
}
|
|
30
15
|
}
|
|
31
16
|
function dummyT(s, args) {
|
|
32
|
-
|
|
17
|
+
return s + (args ? " + " + args : "");
|
|
33
18
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Return a reactive signal to a translated string.
|
|
21
|
+
*
|
|
22
|
+
* Useful for non-DOM use cases (like `document.title`, see `useLocalizedTitle`).
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const t = useT("my-title");
|
|
26
|
+
* useTask$(({ track }) => {
|
|
27
|
+
* track(t);
|
|
28
|
+
* document.title = t.value;
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/ function useT(s, args) {
|
|
32
|
+
const locales = require_context.useFluentLocales();
|
|
33
|
+
const bundles = (0, _qwik_dev_core.useContext)(require_context.FluentBundlesId);
|
|
34
|
+
return (0, _qwik_dev_core.useComputedQrl)(/*#__PURE__*/ (0, _qwik_dev_core.inlinedQrl)(() => {
|
|
35
|
+
const args = _qwik_dev_core._captures[0], bundles = _qwik_dev_core._captures[1], locales = _qwik_dev_core._captures[2], s = _qwik_dev_core._captures[3];
|
|
36
|
+
const value = args?.value;
|
|
37
|
+
const placeholder = dummyT(s, value);
|
|
38
|
+
const wargs = wrapArgs(value);
|
|
39
|
+
if (!bundles.value) return placeholder;
|
|
40
|
+
for (const k of locales.value) {
|
|
41
|
+
const b = bundles.value[k];
|
|
42
|
+
if (!b) continue;
|
|
43
|
+
const m = b.getMessage(s);
|
|
44
|
+
if (!m || !m.value) continue;
|
|
45
|
+
return b.formatPattern(m.value, wargs);
|
|
46
|
+
}
|
|
47
|
+
return placeholder;
|
|
48
|
+
}, "useT_message_useComputed_S0G7htNeJXI", [
|
|
49
|
+
args,
|
|
50
|
+
bundles,
|
|
51
|
+
locales,
|
|
52
|
+
s
|
|
53
|
+
]));
|
|
64
54
|
}
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Translate a string in TSX idiom.
|
|
57
|
+
*
|
|
58
|
+
* Pass a signal for `args`.
|
|
59
|
+
*
|
|
60
|
+
* ```tsx
|
|
61
|
+
* const x = useSignal(1);
|
|
62
|
+
* return <T s="x-apples" args={x} />;
|
|
63
|
+
* ```
|
|
64
|
+
*/ var T = /*#__PURE__*/ (0, _qwik_dev_core.componentQrl)(/*#__PURE__*/ (0, _qwik_dev_core.inlinedQrl)((_rawProps) => {
|
|
65
|
+
return useT(_rawProps.s, _rawProps.args).value;
|
|
67
66
|
}, "T_component_g8a5BXhl0hY"));
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Make the document title (`<title>` element in `<head>`) translated, and follow locale changes.
|
|
69
|
+
*
|
|
70
|
+
* Note: Only effective after resumption on clients. Title generated during SSG is untouched.
|
|
71
|
+
*/ function useLocalizedTitle(s, args) {
|
|
72
|
+
const t = useT(s, args);
|
|
73
|
+
(0, _qwik_dev_core.useOnDocument)("qidle", /*#__PURE__*/ (0, _qwik_dev_core.inlinedQrl)(() => {
|
|
74
|
+
const t = _qwik_dev_core._captures[0];
|
|
75
|
+
if (typeof document === "undefined") return;
|
|
76
|
+
document.title = t.value;
|
|
77
|
+
}, "useLocalizedTitle_useOnDocument_VXsb0xE3U2c", [t]));
|
|
78
|
+
(0, _qwik_dev_core.useTaskQrl)(/*#__PURE__*/ (0, _qwik_dev_core.inlinedQrl)(({ track }) => {
|
|
79
|
+
const t = _qwik_dev_core._captures[0];
|
|
80
|
+
track(t);
|
|
81
|
+
if (typeof document === "undefined") return;
|
|
82
|
+
document.title = t.value;
|
|
83
|
+
}, "useLocalizedTitle_useTask_MxJmwSF2dkE", [t]));
|
|
85
84
|
}
|
|
86
85
|
exports.T = T;
|
|
87
86
|
exports.useLocalizedTitle = useLocalizedTitle;
|