@koine/i18n 2.0.0-beta.174 → 2.0.0-beta.175
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/adapter-js/generators/createT.cjs.js +50 -51
- package/adapter-js/generators/createT.esm.js +50 -51
- package/adapter-js/generators/dictionary.cjs.js +34 -0
- package/adapter-js/generators/dictionary.d.ts +3 -0
- package/adapter-js/generators/dictionary.esm.js +32 -0
- package/adapter-js/generators/formatTo.cjs.js +2 -2
- package/adapter-js/generators/formatTo.esm.js +2 -2
- package/adapter-js/generators/formatUrl.cjs.js +2 -2
- package/adapter-js/generators/formatUrl.esm.js +2 -2
- package/adapter-js/generators/getI18nDictionaries.cjs.js +2 -2
- package/adapter-js/generators/getI18nDictionaries.esm.js +2 -2
- package/adapter-js/generators/getI18nMetadata.cjs.js +2 -2
- package/adapter-js/generators/getI18nMetadata.esm.js +2 -2
- package/adapter-js/generators/getT.cjs.js +3 -3
- package/adapter-js/generators/getT.esm.js +3 -3
- package/adapter-js/generators/loadTranslations.cjs.js +2 -2
- package/adapter-js/generators/loadTranslations.esm.js +2 -2
- package/adapter-js/generators/pathnameToRouteId.cjs.js +2 -2
- package/adapter-js/generators/pathnameToRouteId.esm.js +2 -2
- package/adapter-js/generators/routes.cjs.js +2 -2
- package/adapter-js/generators/routes.esm.js +2 -2
- package/adapter-js/generators/setLocale.cjs.js +2 -2
- package/adapter-js/generators/setLocale.esm.js +2 -2
- package/adapter-js/generators/t.cjs.js +11 -11
- package/adapter-js/generators/t.esm.js +11 -11
- package/adapter-js/generators/tInterpolateParams.cjs.js +2 -2
- package/adapter-js/generators/tInterpolateParams.esm.js +2 -2
- package/adapter-js/generators/tInterpolateParamsDeep.cjs.js +2 -2
- package/adapter-js/generators/tInterpolateParamsDeep.esm.js +2 -2
- package/adapter-js/generators/tPluralise.cjs.js +2 -2
- package/adapter-js/generators/tPluralise.esm.js +2 -2
- package/adapter-js/generators/to.cjs.js +2 -2
- package/adapter-js/generators/to.esm.js +2 -2
- package/adapter-js/generators/types.cjs.js +2 -2
- package/adapter-js/generators/types.esm.js +2 -2
- package/adapter-js/index.cjs.js +2 -0
- package/adapter-js/index.esm.js +21 -19
- package/adapter-next/plugin/utils.cjs.js +13 -18
- package/adapter-next/plugin/utils.esm.js +13 -18
- package/compiler/code/adapters.cjs.js +14 -13
- package/compiler/code/adapters.esm.js +15 -14
- package/compiler/code/data-translations.cjs.js +94 -82
- package/compiler/code/data-translations.d.ts +27 -1
- package/compiler/code/data-translations.esm.js +93 -83
- package/compiler/code/data.cjs.js +15 -9
- package/compiler/code/data.d.ts +6 -1
- package/compiler/code/data.esm.js +15 -10
- package/compiler/config.cjs.js +1 -1
- package/compiler/config.d.ts +3 -4
- package/compiler/config.esm.js +1 -1
- package/compiler/createSwcTransforms.cjs.js +17 -0
- package/compiler/createSwcTransforms.d.ts +10 -0
- package/compiler/createSwcTransforms.esm.js +15 -0
- package/compiler/types.d.ts +3 -3
- package/package.json +3 -3
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var createAdapter = require('../../compiler/createAdapter.cjs.js');
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var t = createAdapter.createGenerator("js", (e)=>{
|
|
6
6
|
let { config: { single: t }, options: { translations: { fallbackDefaultStrategy: a, tokens: { keyDelimiter: n, namespaceDelimiter: l } } } } = e;
|
|
7
7
|
return {
|
|
8
8
|
createT: {
|
|
@@ -38,17 +38,9 @@ export function createT<TDictionary extends I18nUtils.TranslationsDictionaryLoos
|
|
|
38
38
|
const namespace = namespaceOrPath && maybePath ? namespaceOrPath : "";
|
|
39
39
|
const path = namespaceOrPath && maybePath ? maybePath : namespaceOrPath;
|
|
40
40
|
const dic = (namespace && dictionaries[namespace]) || dictionaries || {};
|
|
41
|
-
const
|
|
42
|
-
const value = getValue(dic, pluralisedKey);
|
|
41
|
+
const [value, isEmpty] = getValue(pluralRules, dic, path, query);
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
typeof value === "undefined" ||
|
|
47
|
-
value === null ||
|
|
48
|
-
value === "" ||
|
|
49
|
-
(typeof value === "object" && !Object.keys(value).length) ||
|
|
50
|
-
(Array.isArray(value) && !value.length)
|
|
51
|
-
) {
|
|
43
|
+
if (isEmpty) {
|
|
52
44
|
// special case when query is an empty string use it as fallback
|
|
53
45
|
fallback = query === "" ? query : fallback;
|
|
54
46
|
return (typeof fallback !== "undefined" ? fallback : ${"key" === a ? "trace" : 'value || ""'}) as TReturn;
|
|
@@ -58,55 +50,62 @@ export function createT<TDictionary extends I18nUtils.TranslationsDictionaryLoos
|
|
|
58
50
|
};
|
|
59
51
|
}
|
|
60
52
|
|
|
61
|
-
/**
|
|
62
|
-
* Get value from key (allow nested keys as parent.children)
|
|
63
|
-
*/
|
|
64
53
|
function getValue(
|
|
65
|
-
dic: I18nUtils.TranslationsDictionaryLoose,
|
|
66
|
-
key: string = "",
|
|
67
|
-
): unknown | undefined {
|
|
68
|
-
const keyParts = key.split("${n}");
|
|
69
|
-
|
|
70
|
-
return keyParts.reduce(
|
|
71
|
-
(val: I18nUtils.TranslationsDictionaryLoose | string, key: string) => {
|
|
72
|
-
return val?.[key as keyof typeof val] ?? {};
|
|
73
|
-
},
|
|
74
|
-
dic,
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Control plural keys depending the {{count}} variable
|
|
80
|
-
*/
|
|
81
|
-
function getPluralisedKey(
|
|
82
54
|
pluralRules: Intl.PluralRules,
|
|
83
|
-
|
|
84
|
-
|
|
55
|
+
dictionary: I18nUtils.TranslationsDictionaryLoose,
|
|
56
|
+
path: string,
|
|
85
57
|
query?: I18nUtils.TranslateQuery
|
|
86
|
-
):
|
|
58
|
+
): [unknown | undefined, boolean] {
|
|
87
59
|
const count = query instanceof Object ? query["count"] : null;
|
|
88
60
|
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
61
|
+
if (typeof count === "number") {
|
|
62
|
+
const countRule = pluralRules.select(count);
|
|
63
|
+
const pluralisedPaths = [
|
|
64
|
+
path + "_" + count,
|
|
65
|
+
path + "_" + countRule,
|
|
66
|
+
path + "${n}" + count,
|
|
67
|
+
path + "${n}" + countRule,
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
for (let i = 0; i < pluralisedPaths.length; i++) {
|
|
71
|
+
const pluralisedPath = pluralisedPaths[i];
|
|
72
|
+
|
|
73
|
+
const output = getValueAtPath(dictionary, pluralisedPath);
|
|
74
|
+
if (output[0] !== undefined) {
|
|
75
|
+
return output;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
93
78
|
}
|
|
94
79
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return pluralKey;
|
|
98
|
-
}
|
|
80
|
+
return getValueAtPath(dictionary, path);
|
|
81
|
+
}
|
|
99
82
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Get value at path (allow nested keys as parent.children)
|
|
85
|
+
*/
|
|
86
|
+
function getValueAtPath(
|
|
87
|
+
dictionary: I18nUtils.TranslationsDictionaryLoose,
|
|
88
|
+
path: string = "",
|
|
89
|
+
): unknown | undefined {
|
|
90
|
+
const keys = path.split("${n}");
|
|
103
91
|
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
92
|
+
const value = keys.reduce(
|
|
93
|
+
(val: I18nUtils.TranslationsDictionaryLoose | string, key: string) => {
|
|
94
|
+
return val?.[key as keyof typeof val];
|
|
95
|
+
},
|
|
96
|
+
dictionary,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
// check if value is empty
|
|
100
|
+
const isEmpty = (
|
|
101
|
+
typeof value === "undefined" ||
|
|
102
|
+
value === null ||
|
|
103
|
+
value === "" ||
|
|
104
|
+
(typeof value === "object" && !Object.keys(value).length) ||
|
|
105
|
+
(Array.isArray(value) && !value.length)
|
|
106
|
+
);
|
|
108
107
|
|
|
109
|
-
return
|
|
108
|
+
return [value, isEmpty];
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
export default createT;
|
|
@@ -115,4 +114,4 @@ export default createT;
|
|
|
115
114
|
};
|
|
116
115
|
});
|
|
117
116
|
|
|
118
|
-
module.exports =
|
|
117
|
+
module.exports = t;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createGenerator } from '../../compiler/createAdapter.esm.js';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var t = createGenerator("js", (e)=>{
|
|
4
4
|
let { config: { single: t }, options: { translations: { fallbackDefaultStrategy: a, tokens: { keyDelimiter: n, namespaceDelimiter: l } } } } = e;
|
|
5
5
|
return {
|
|
6
6
|
createT: {
|
|
@@ -36,17 +36,9 @@ export function createT<TDictionary extends I18nUtils.TranslationsDictionaryLoos
|
|
|
36
36
|
const namespace = namespaceOrPath && maybePath ? namespaceOrPath : "";
|
|
37
37
|
const path = namespaceOrPath && maybePath ? maybePath : namespaceOrPath;
|
|
38
38
|
const dic = (namespace && dictionaries[namespace]) || dictionaries || {};
|
|
39
|
-
const
|
|
40
|
-
const value = getValue(dic, pluralisedKey);
|
|
39
|
+
const [value, isEmpty] = getValue(pluralRules, dic, path, query);
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
typeof value === "undefined" ||
|
|
45
|
-
value === null ||
|
|
46
|
-
value === "" ||
|
|
47
|
-
(typeof value === "object" && !Object.keys(value).length) ||
|
|
48
|
-
(Array.isArray(value) && !value.length)
|
|
49
|
-
) {
|
|
41
|
+
if (isEmpty) {
|
|
50
42
|
// special case when query is an empty string use it as fallback
|
|
51
43
|
fallback = query === "" ? query : fallback;
|
|
52
44
|
return (typeof fallback !== "undefined" ? fallback : ${"key" === a ? "trace" : 'value || ""'}) as TReturn;
|
|
@@ -56,55 +48,62 @@ export function createT<TDictionary extends I18nUtils.TranslationsDictionaryLoos
|
|
|
56
48
|
};
|
|
57
49
|
}
|
|
58
50
|
|
|
59
|
-
/**
|
|
60
|
-
* Get value from key (allow nested keys as parent.children)
|
|
61
|
-
*/
|
|
62
51
|
function getValue(
|
|
63
|
-
dic: I18nUtils.TranslationsDictionaryLoose,
|
|
64
|
-
key: string = "",
|
|
65
|
-
): unknown | undefined {
|
|
66
|
-
const keyParts = key.split("${n}");
|
|
67
|
-
|
|
68
|
-
return keyParts.reduce(
|
|
69
|
-
(val: I18nUtils.TranslationsDictionaryLoose | string, key: string) => {
|
|
70
|
-
return val?.[key as keyof typeof val] ?? {};
|
|
71
|
-
},
|
|
72
|
-
dic,
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Control plural keys depending the {{count}} variable
|
|
78
|
-
*/
|
|
79
|
-
function getPluralisedKey(
|
|
80
52
|
pluralRules: Intl.PluralRules,
|
|
81
|
-
|
|
82
|
-
|
|
53
|
+
dictionary: I18nUtils.TranslationsDictionaryLoose,
|
|
54
|
+
path: string,
|
|
83
55
|
query?: I18nUtils.TranslateQuery
|
|
84
|
-
):
|
|
56
|
+
): [unknown | undefined, boolean] {
|
|
85
57
|
const count = query instanceof Object ? query["count"] : null;
|
|
86
58
|
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
59
|
+
if (typeof count === "number") {
|
|
60
|
+
const countRule = pluralRules.select(count);
|
|
61
|
+
const pluralisedPaths = [
|
|
62
|
+
path + "_" + count,
|
|
63
|
+
path + "_" + countRule,
|
|
64
|
+
path + "${n}" + count,
|
|
65
|
+
path + "${n}" + countRule,
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
for (let i = 0; i < pluralisedPaths.length; i++) {
|
|
69
|
+
const pluralisedPath = pluralisedPaths[i];
|
|
70
|
+
|
|
71
|
+
const output = getValueAtPath(dictionary, pluralisedPath);
|
|
72
|
+
if (output[0] !== undefined) {
|
|
73
|
+
return output;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
91
76
|
}
|
|
92
77
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return pluralKey;
|
|
96
|
-
}
|
|
78
|
+
return getValueAtPath(dictionary, path);
|
|
79
|
+
}
|
|
97
80
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Get value at path (allow nested keys as parent.children)
|
|
83
|
+
*/
|
|
84
|
+
function getValueAtPath(
|
|
85
|
+
dictionary: I18nUtils.TranslationsDictionaryLoose,
|
|
86
|
+
path: string = "",
|
|
87
|
+
): unknown | undefined {
|
|
88
|
+
const keys = path.split("${n}");
|
|
101
89
|
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
90
|
+
const value = keys.reduce(
|
|
91
|
+
(val: I18nUtils.TranslationsDictionaryLoose | string, key: string) => {
|
|
92
|
+
return val?.[key as keyof typeof val];
|
|
93
|
+
},
|
|
94
|
+
dictionary,
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// check if value is empty
|
|
98
|
+
const isEmpty = (
|
|
99
|
+
typeof value === "undefined" ||
|
|
100
|
+
value === null ||
|
|
101
|
+
value === "" ||
|
|
102
|
+
(typeof value === "object" && !Object.keys(value).length) ||
|
|
103
|
+
(Array.isArray(value) && !value.length)
|
|
104
|
+
);
|
|
106
105
|
|
|
107
|
-
return
|
|
106
|
+
return [value, isEmpty];
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
export default createT;
|
|
@@ -113,4 +112,4 @@ export default createT;
|
|
|
113
112
|
};
|
|
114
113
|
});
|
|
115
114
|
|
|
116
|
-
export {
|
|
115
|
+
export { t as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var utils = require('@koine/utils');
|
|
4
|
+
var dataTranslations = require('../../compiler/code/data-translations.cjs.js');
|
|
5
|
+
var createAdapter = require('../../compiler/createAdapter.cjs.js');
|
|
6
|
+
var helpers = require('../../compiler/helpers.cjs.js');
|
|
7
|
+
|
|
8
|
+
var e = createAdapter.createGenerator("js", (o)=>{
|
|
9
|
+
let { input: n, options: { translations: a } } = o, { dir: m, prefix: p } = a.dictionaries, { translationFiles: s } = n, c = s.reduce((e, t)=>{
|
|
10
|
+
let { locale: o, path: i } = t, n = dataTranslations.translationPathToNamespace(i);
|
|
11
|
+
return e[n] = e[n] || {}, e[n][o] = i, e;
|
|
12
|
+
}, {}), l = (t)=>utils.changeCaseSnake(t);
|
|
13
|
+
return Object.keys(c).reduce((e, r)=>{
|
|
14
|
+
let o = c[r], n = `dictionary_${r}`, a = dataTranslations.normaliseTranslationTraceIdentifier(r, p);
|
|
15
|
+
return e[n] = {
|
|
16
|
+
dir: m,
|
|
17
|
+
name: a,
|
|
18
|
+
ext: "ts",
|
|
19
|
+
index: !0,
|
|
20
|
+
content: ()=>`
|
|
21
|
+
${Object.keys(o).map((e)=>`import ${l(e)} from "${helpers.getTranslationsDir(1)}/${e}/${o[e]}";`).join("\n")}
|
|
22
|
+
|
|
23
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
24
|
+
export const ${a} = {
|
|
25
|
+
${Object.keys(o).map((e)=>`"${e}": ${l(e)}`).join(",\n ")}
|
|
26
|
+
} as const;
|
|
27
|
+
|
|
28
|
+
export default ${a};
|
|
29
|
+
`
|
|
30
|
+
}, e;
|
|
31
|
+
}, {});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
module.exports = e;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { changeCaseSnake } from '@koine/utils';
|
|
2
|
+
import { translationPathToNamespace, normaliseTranslationTraceIdentifier } from '../../compiler/code/data-translations.esm.js';
|
|
3
|
+
import { createGenerator } from '../../compiler/createAdapter.esm.js';
|
|
4
|
+
import { getTranslationsDir } from '../../compiler/helpers.esm.js';
|
|
5
|
+
|
|
6
|
+
var e = createGenerator("js", (o)=>{
|
|
7
|
+
let { input: n, options: { translations: a } } = o, { dir: m, prefix: p } = a.dictionaries, { translationFiles: s } = n, c = s.reduce((e, t)=>{
|
|
8
|
+
let { locale: o, path: i } = t, n = translationPathToNamespace(i);
|
|
9
|
+
return e[n] = e[n] || {}, e[n][o] = i, e;
|
|
10
|
+
}, {}), l = (t)=>changeCaseSnake(t);
|
|
11
|
+
return Object.keys(c).reduce((e, r)=>{
|
|
12
|
+
let o = c[r], n = `dictionary_${r}`, a = normaliseTranslationTraceIdentifier(r, p);
|
|
13
|
+
return e[n] = {
|
|
14
|
+
dir: m,
|
|
15
|
+
name: a,
|
|
16
|
+
ext: "ts",
|
|
17
|
+
index: !0,
|
|
18
|
+
content: ()=>`
|
|
19
|
+
${Object.keys(o).map((e)=>`import ${l(e)} from "${getTranslationsDir(1)}/${e}/${o[e]}";`).join("\n")}
|
|
20
|
+
|
|
21
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
22
|
+
export const ${a} = {
|
|
23
|
+
${Object.keys(o).map((e)=>`"${e}": ${l(e)}`).join(",\n ")}
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
export default ${a};
|
|
27
|
+
`
|
|
28
|
+
}, e;
|
|
29
|
+
}, {});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export { e as default };
|
|
@@ -84,7 +84,7 @@ const formatTo = ({ defaultLocale: e, hideDefaultLocaleInUrl: t }, n)=>new funct
|
|
|
84
84
|
return pathname;
|
|
85
85
|
`
|
|
86
86
|
});
|
|
87
|
-
var
|
|
87
|
+
var a = createAdapter.createGenerator("js", (a)=>{
|
|
88
88
|
let { config: t } = a;
|
|
89
89
|
return {
|
|
90
90
|
formatTo: {
|
|
@@ -100,5 +100,5 @@ var t = createAdapter.createGenerator("js", (a)=>{
|
|
|
100
100
|
};
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
-
exports.default =
|
|
103
|
+
exports.default = a;
|
|
104
104
|
exports.formatTo = formatTo;
|
|
@@ -80,7 +80,7 @@ const formatTo = ({ defaultLocale: e, hideDefaultLocaleInUrl: t }, n)=>new Funct
|
|
|
80
80
|
return pathname;
|
|
81
81
|
`
|
|
82
82
|
});
|
|
83
|
-
var
|
|
83
|
+
var a = createGenerator("js", (a)=>{
|
|
84
84
|
let { config: t } = a;
|
|
85
85
|
return {
|
|
86
86
|
formatTo: {
|
|
@@ -96,4 +96,4 @@ var t = createGenerator("js", (a)=>{
|
|
|
96
96
|
};
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
export {
|
|
99
|
+
export { a as default, formatTo };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var createAdapter = require('../../compiler/createAdapter.cjs.js');
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var m = createAdapter.createGenerator("js", (e)=>{
|
|
6
6
|
let { config: { baseUrl: t, trailingSlash: a } } = e;
|
|
7
7
|
return {
|
|
8
8
|
formatUrl: {
|
|
@@ -24,4 +24,4 @@ export default formatUrl;
|
|
|
24
24
|
};
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
module.exports =
|
|
27
|
+
module.exports = m;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createGenerator } from '../../compiler/createAdapter.esm.js';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var m = createGenerator("js", (e)=>{
|
|
4
4
|
let { config: { baseUrl: t, trailingSlash: a } } = e;
|
|
5
5
|
return {
|
|
6
6
|
formatUrl: {
|
|
@@ -22,4 +22,4 @@ export default formatUrl;
|
|
|
22
22
|
};
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
export {
|
|
25
|
+
export { m as default };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var createAdapter = require('../../compiler/createAdapter.cjs.js');
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var s = createAdapter.createGenerator("js", (n)=>({
|
|
6
6
|
getI18nDictionaries: {
|
|
7
7
|
dir: createAdapter.createGenerator.dirs.internal,
|
|
8
8
|
name: "getI18nDictionaries",
|
|
@@ -41,4 +41,4 @@ export async function getI18nDictionaries({
|
|
|
41
41
|
}
|
|
42
42
|
}));
|
|
43
43
|
|
|
44
|
-
module.exports =
|
|
44
|
+
module.exports = s;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createGenerator } from '../../compiler/createAdapter.esm.js';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var s = createGenerator("js", (n)=>({
|
|
4
4
|
getI18nDictionaries: {
|
|
5
5
|
dir: createGenerator.dirs.internal,
|
|
6
6
|
name: "getI18nDictionaries",
|
|
@@ -39,4 +39,4 @@ export async function getI18nDictionaries({
|
|
|
39
39
|
}
|
|
40
40
|
}));
|
|
41
41
|
|
|
42
|
-
export {
|
|
42
|
+
export { s as default };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var createAdapter = require('../../compiler/createAdapter.cjs.js');
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var n = createAdapter.createGenerator("js", (e)=>{
|
|
6
6
|
let { routes: { dynamicRoutes: a, staticRoutes: o } } = e;
|
|
7
7
|
return {
|
|
8
8
|
getI18nMetadata: {
|
|
@@ -63,4 +63,4 @@ export function getI18nMetadata<TRouteId extends I18n.RouteId | RouteIdError>({
|
|
|
63
63
|
};
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
module.exports =
|
|
66
|
+
module.exports = n;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createGenerator } from '../../compiler/createAdapter.esm.js';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var n = createGenerator("js", (e)=>{
|
|
4
4
|
let { routes: { dynamicRoutes: a, staticRoutes: o } } = e;
|
|
5
5
|
return {
|
|
6
6
|
getI18nMetadata: {
|
|
@@ -61,4 +61,4 @@ export function getI18nMetadata<TRouteId extends I18n.RouteId | RouteIdError>({
|
|
|
61
61
|
};
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
export {
|
|
64
|
+
export { n as default };
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
var createAdapter = require('../../compiler/createAdapter.cjs.js');
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var i = createAdapter.createGenerator("js", (a)=>({
|
|
6
6
|
getT: {
|
|
7
7
|
name: "getT",
|
|
8
8
|
ext: "ts",
|
|
9
9
|
index: !0,
|
|
10
10
|
content: ()=>`
|
|
11
11
|
import { loadTranslations } from "./internal/loadTranslations";
|
|
12
|
-
import { createT } from "
|
|
12
|
+
import { createT } from "./createT";
|
|
13
13
|
import type { I18n } from "./types";
|
|
14
14
|
|
|
15
15
|
export async function getT<TNamespace extends I18n.TranslationsNamespace>(
|
|
@@ -31,4 +31,4 @@ export default getT;
|
|
|
31
31
|
}
|
|
32
32
|
}));
|
|
33
33
|
|
|
34
|
-
module.exports =
|
|
34
|
+
module.exports = i;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createGenerator } from '../../compiler/createAdapter.esm.js';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var i = createGenerator("js", (a)=>({
|
|
4
4
|
getT: {
|
|
5
5
|
name: "getT",
|
|
6
6
|
ext: "ts",
|
|
7
7
|
index: !0,
|
|
8
8
|
content: ()=>`
|
|
9
9
|
import { loadTranslations } from "./internal/loadTranslations";
|
|
10
|
-
import { createT } from "
|
|
10
|
+
import { createT } from "./createT";
|
|
11
11
|
import type { I18n } from "./types";
|
|
12
12
|
|
|
13
13
|
export async function getT<TNamespace extends I18n.TranslationsNamespace>(
|
|
@@ -29,4 +29,4 @@ export default getT;
|
|
|
29
29
|
}
|
|
30
30
|
}));
|
|
31
31
|
|
|
32
|
-
export {
|
|
32
|
+
export { i as default };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var createAdapter = require('../../compiler/createAdapter.cjs.js');
|
|
4
4
|
var helpers = require('../../compiler/helpers.cjs.js');
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var f = createAdapter.createGenerator("js", (n)=>({
|
|
7
7
|
loadTranslations: {
|
|
8
8
|
dir: createAdapter.createGenerator.dirs.internal,
|
|
9
9
|
name: "loadTranslations",
|
|
@@ -26,4 +26,4 @@ export const loadTranslations = (
|
|
|
26
26
|
}
|
|
27
27
|
}));
|
|
28
28
|
|
|
29
|
-
module.exports =
|
|
29
|
+
module.exports = f;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createGenerator } from '../../compiler/createAdapter.esm.js';
|
|
2
2
|
import { getTranslationsDir } from '../../compiler/helpers.esm.js';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var f = createGenerator("js", (n)=>({
|
|
5
5
|
loadTranslations: {
|
|
6
6
|
dir: createGenerator.dirs.internal,
|
|
7
7
|
name: "loadTranslations",
|
|
@@ -24,4 +24,4 @@ export const loadTranslations = (
|
|
|
24
24
|
}
|
|
25
25
|
}));
|
|
26
26
|
|
|
27
|
-
export {
|
|
27
|
+
export { f as default };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var utils = require('@koine/utils');
|
|
4
4
|
var createAdapter = require('../../compiler/createAdapter.cjs.js');
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var g = createAdapter.createGenerator("js", (t)=>{
|
|
7
7
|
let { options: a } = t, { idDelimiter: r, optionalCatchAll: o, catchAll: n } = a.routes.tokens;
|
|
8
8
|
return {
|
|
9
9
|
pathnameToRouteId: {
|
|
@@ -30,4 +30,4 @@ export default pathnameToRouteId;
|
|
|
30
30
|
};
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
module.exports =
|
|
33
|
+
module.exports = g;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { escapeRegExp } from '@koine/utils';
|
|
2
2
|
import { createGenerator } from '../../compiler/createAdapter.esm.js';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var g = createGenerator("js", (t)=>{
|
|
5
5
|
let { options: a } = t, { idDelimiter: r, optionalCatchAll: o, catchAll: n } = a.routes.tokens;
|
|
6
6
|
return {
|
|
7
7
|
pathnameToRouteId: {
|
|
@@ -28,4 +28,4 @@ export default pathnameToRouteId;
|
|
|
28
28
|
};
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
export {
|
|
31
|
+
export { g as default };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var createAdapter = require('../../compiler/createAdapter.cjs.js');
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var l = createAdapter.createGenerator("js", (t)=>{
|
|
6
6
|
let { routes: e } = t, n = (r)=>JSON.stringify(Object.fromEntries(Object.entries(e.byId).map(([t, e])=>[
|
|
7
7
|
t,
|
|
8
8
|
r(e)
|
|
@@ -84,4 +84,4 @@ export const routesSpa = ${r} as Record<string, string | Record<I18n.Locale, str
|
|
|
84
84
|
};
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
module.exports =
|
|
87
|
+
module.exports = l;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createGenerator } from '../../compiler/createAdapter.esm.js';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var l = createGenerator("js", (t)=>{
|
|
4
4
|
let { routes: e } = t, n = (r)=>JSON.stringify(Object.fromEntries(Object.entries(e.byId).map(([t, e])=>[
|
|
5
5
|
t,
|
|
6
6
|
r(e)
|
|
@@ -82,4 +82,4 @@ export const routesSpa = ${r} as Record<string, string | Record<I18n.Locale, str
|
|
|
82
82
|
};
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
export {
|
|
85
|
+
export { l as default };
|
|
@@ -29,7 +29,7 @@ const setGlobalLocale = (e)=>new functions.FunctionsCompiler({
|
|
|
29
29
|
body: `global.${helpers.GLOBAL_I18N_IDENTIFIER} = value`,
|
|
30
30
|
implicitReturn: !0
|
|
31
31
|
});
|
|
32
|
-
var
|
|
32
|
+
var d = createAdapter.createGenerator("js", (o)=>({
|
|
33
33
|
globals: {
|
|
34
34
|
dir: createAdapter.createGenerator.dirs.internal,
|
|
35
35
|
name: "globals",
|
|
@@ -55,5 +55,5 @@ declare global {
|
|
|
55
55
|
}
|
|
56
56
|
}));
|
|
57
57
|
|
|
58
|
-
exports.default =
|
|
58
|
+
exports.default = d;
|
|
59
59
|
exports.setGlobalLocale = setGlobalLocale;
|
|
@@ -25,7 +25,7 @@ const setGlobalLocale = (e)=>new FunctionsCompiler({
|
|
|
25
25
|
body: `global.${GLOBAL_I18N_IDENTIFIER} = value`,
|
|
26
26
|
implicitReturn: !0
|
|
27
27
|
});
|
|
28
|
-
var
|
|
28
|
+
var d = createGenerator("js", (o)=>({
|
|
29
29
|
globals: {
|
|
30
30
|
dir: createGenerator.dirs.internal,
|
|
31
31
|
name: "globals",
|
|
@@ -51,4 +51,4 @@ declare global {
|
|
|
51
51
|
}
|
|
52
52
|
}));
|
|
53
53
|
|
|
54
|
-
export {
|
|
54
|
+
export { d as default, setGlobalLocale };
|