@intlayer/core 1.0.0 → 1.2.0
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/dist/cjs/getLocaleName.cjs +8 -13
- package/dist/cjs/getLocaleName.d.ts +1 -1
- package/dist/cjs/index.cjs +20 -27
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +12 -25
- package/dist/cjs/localeList.cjs +9 -14
- package/dist/cjs/localeList.d.ts +1 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/enumeration.cjs +12 -17
- package/dist/cjs/transpiler/content_transformers/enumeration/enumeration.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/enumeration.d.ts +21 -16
- package/dist/cjs/transpiler/content_transformers/enumeration/getEnumerationContent.cjs +14 -34
- package/dist/cjs/transpiler/content_transformers/enumeration/getEnumerationContent.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/getEnumerationContent.d.ts +27 -7
- package/dist/cjs/transpiler/content_transformers/enumeration/index.cjs +11 -23
- package/dist/cjs/transpiler/content_transformers/enumeration/index.d.ts +4 -4
- package/dist/cjs/transpiler/content_transformers/index.cjs +11 -27
- package/dist/cjs/transpiler/content_transformers/index.d.ts +9 -15
- package/dist/cjs/transpiler/content_transformers/translation/getTranslationContent.cjs +9 -15
- package/dist/cjs/transpiler/content_transformers/translation/getTranslationContent.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/translation/getTranslationContent.d.ts +25 -8
- package/dist/cjs/transpiler/content_transformers/translation/index.cjs +13 -23
- package/dist/cjs/transpiler/content_transformers/translation/index.cjs.map +1 -1
- package/dist/cjs/transpiler/content_transformers/translation/index.d.ts +7 -5
- package/dist/cjs/transpiler/content_transformers/translation/{translations.cjs → translation.cjs} +17 -22
- package/dist/cjs/transpiler/content_transformers/translation/translation.cjs.map +1 -0
- package/dist/cjs/transpiler/content_transformers/translation/translation.d.ts +27 -0
- package/dist/cjs/transpiler/content_transformers/translation/types.cjs +17 -0
- package/dist/cjs/transpiler/content_transformers/translation/types.cjs.map +1 -0
- package/dist/cjs/transpiler/content_transformers/translation/types.d.ts +63 -0
- package/dist/cjs/transpiler/index.cjs +9 -22
- package/dist/cjs/transpiler/index.cjs.map +1 -1
- package/dist/cjs/transpiler/index.d.ts +9 -13
- package/dist/cjs/types/contentModule.cjs +4 -8
- package/dist/cjs/types/contentModule.d.ts +14 -28
- package/dist/cjs/types/index.cjs +9 -14
- package/dist/cjs/types/index.d.ts +7 -13
- package/dist/cjs/types/nodeType.cjs +8 -13
- package/dist/cjs/types/nodeType.d.ts +2 -2
- package/dist/cjs/utils/getStackTraceInfo.cjs +9 -14
- package/dist/cjs/utils/getStackTraceInfo.cjs.map +1 -1
- package/dist/cjs/utils/getStackTraceInfo.d.ts +4 -4
- package/dist/esm/getLocaleName.d.mts +1 -1
- package/dist/esm/getLocaleName.mjs +4 -2
- package/dist/esm/index.d.mts +12 -25
- package/dist/esm/index.mjs +7 -7
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/localeList.d.mts +1 -1
- package/dist/esm/localeList.mjs +5 -3
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.d.mts +21 -16
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.mjs +10 -6
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/enumeration/getEnumerationContent.d.mts +27 -7
- package/dist/esm/transpiler/content_transformers/enumeration/getEnumerationContent.mjs +10 -23
- package/dist/esm/transpiler/content_transformers/enumeration/getEnumerationContent.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/enumeration/index.d.mts +4 -4
- package/dist/esm/transpiler/content_transformers/enumeration/index.mjs +3 -3
- package/dist/esm/transpiler/content_transformers/index.d.mts +9 -15
- package/dist/esm/transpiler/content_transformers/index.mjs +3 -3
- package/dist/esm/transpiler/content_transformers/translation/getTranslationContent.d.mts +25 -8
- package/dist/esm/transpiler/content_transformers/translation/getTranslationContent.mjs +8 -5
- package/dist/esm/transpiler/content_transformers/translation/getTranslationContent.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/translation/index.d.mts +7 -5
- package/dist/esm/transpiler/content_transformers/translation/index.mjs +4 -3
- package/dist/esm/transpiler/content_transformers/translation/index.mjs.map +1 -1
- package/dist/esm/transpiler/content_transformers/translation/translation.d.mts +27 -0
- package/dist/esm/transpiler/content_transformers/translation/{translations.mjs → translation.mjs} +10 -7
- package/dist/esm/transpiler/content_transformers/translation/translation.mjs.map +1 -0
- package/dist/esm/transpiler/content_transformers/translation/types.d.mts +63 -0
- package/dist/esm/transpiler/content_transformers/translation/types.mjs +1 -0
- package/dist/esm/transpiler/content_transformers/translation/types.mjs.map +1 -0
- package/dist/esm/transpiler/index.d.mts +9 -13
- package/dist/esm/transpiler/index.mjs +2 -3
- package/dist/esm/transpiler/index.mjs.map +1 -1
- package/dist/esm/types/contentModule.d.mts +14 -28
- package/dist/esm/types/contentModule.mjs +1 -1
- package/dist/esm/types/index.d.mts +7 -13
- package/dist/esm/types/index.mjs +5 -3
- package/dist/esm/types/nodeType.d.mts +2 -2
- package/dist/esm/types/nodeType.mjs +4 -2
- package/dist/esm/utils/getStackTraceInfo.d.mts +4 -4
- package/dist/esm/utils/getStackTraceInfo.mjs +5 -3
- package/dist/esm/utils/getStackTraceInfo.mjs.map +1 -1
- package/package.json +12 -8
- package/src/index.ts +2 -0
- package/src/transpiler/content_transformers/enumeration/enumeration.ts +15 -1
- package/src/transpiler/content_transformers/enumeration/getEnumerationContent.ts +23 -0
- package/src/transpiler/content_transformers/translation/getTranslationContent.ts +27 -5
- package/src/transpiler/content_transformers/translation/index.ts +2 -1
- package/src/transpiler/content_transformers/translation/translation.ts +50 -0
- package/src/transpiler/content_transformers/translation/types.ts +72 -0
- package/src/transpiler/index.ts +1 -7
- package/src/utils/getStackTraceInfo.ts +1 -1
- package/dist/cjs/transpiler/content_transformers/translation/translations.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/translation/translations.d.ts +0 -17
- package/dist/esm/transpiler/content_transformers/translation/translations.d.mts +0 -17
- package/dist/esm/transpiler/content_transformers/translation/translations.mjs.map +0 -1
- package/src/transpiler/content_transformers/translation/translations.ts +0 -42
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
type NoteStackTraceInfo = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
file?: string;
|
|
3
|
+
line?: string;
|
|
4
|
+
column?: string;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* Get the file path, line number, and column number of the caller of this function
|
|
8
|
-
*
|
|
8
|
+
* Return an object containing file, line, and column numbers
|
|
9
9
|
*/
|
|
10
10
|
declare const getStackTraceInfo: () => NoteStackTraceInfo;
|
|
11
11
|
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
Content,
|
|
15
|
-
ContentModule,
|
|
16
|
-
ContentValue,
|
|
17
|
-
FlatContent,
|
|
18
|
-
FlatContentValue,
|
|
19
|
-
TypedNode,
|
|
20
|
-
} from "./types/contentModule.mjs";
|
|
21
|
-
export { NodeType } from "./types/nodeType.mjs";
|
|
22
|
-
export { getLocaleName } from "./getLocaleName.mjs";
|
|
23
|
-
export { localeList } from "./localeList.mjs";
|
|
24
|
-
import "@intlayer/config/client";
|
|
25
|
-
import "./utils/getStackTraceInfo.mjs";
|
|
1
|
+
export { t } from './transpiler/content_transformers/translation/translation.mjs';
|
|
2
|
+
export { getTranslationContent } from './transpiler/content_transformers/translation/getTranslationContent.mjs';
|
|
3
|
+
export { CustomizableLanguageContent, LanguageContent, CustomLocales as Locales, TranslationContent } from './transpiler/content_transformers/translation/types.mjs';
|
|
4
|
+
export { EnumerationContent, QuantityContent, enu } from './transpiler/content_transformers/enumeration/enumeration.mjs';
|
|
5
|
+
export { getEnumerationContent } from './transpiler/content_transformers/enumeration/getEnumerationContent.mjs';
|
|
6
|
+
export { Content, ContentModule, ContentValue, FlatContent, FlatContentValue, TypedNode } from './types/contentModule.mjs';
|
|
7
|
+
export { NodeType } from './types/nodeType.mjs';
|
|
8
|
+
export { getLocaleName } from './getLocaleName.mjs';
|
|
9
|
+
export { localeList } from './localeList.mjs';
|
|
10
|
+
import '@intlayer/config/client';
|
|
11
|
+
import 'intlayer';
|
|
12
|
+
import './utils/getStackTraceInfo.mjs';
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
t,
|
|
3
3
|
enu,
|
|
4
4
|
getTranslationContent,
|
|
5
|
-
getEnumerationContent
|
|
6
|
-
} from
|
|
7
|
-
import { NodeType } from
|
|
8
|
-
import { getLocaleName } from
|
|
9
|
-
import { localeList } from
|
|
5
|
+
getEnumerationContent
|
|
6
|
+
} from './transpiler/content_transformers/index.mjs';
|
|
7
|
+
import { NodeType } from './types/index.mjs';
|
|
8
|
+
import { getLocaleName } from './getLocaleName.mjs';
|
|
9
|
+
import { localeList } from './localeList.mjs';
|
|
10
10
|
export {
|
|
11
11
|
NodeType,
|
|
12
12
|
enu,
|
|
@@ -14,6 +14,6 @@ export {
|
|
|
14
14
|
getLocaleName,
|
|
15
15
|
getTranslationContent,
|
|
16
16
|
localeList,
|
|
17
|
-
t
|
|
17
|
+
t
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=index.mjs.map
|
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n ContentModule,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { localeList } from './localeList';\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export type {\n CustomizableLanguageContent,\n LanguageContent,\n TranslationContent,\n EnumerationContent,\n QuantityContent,\n CustomLocales as Locales,\n} from './transpiler/content_transformers/index';\nexport {\n t,\n enu,\n getTranslationContent,\n getEnumerationContent,\n} from './transpiler/content_transformers/index';\nexport type {\n ContentValue,\n Content,\n FlatContentValue,\n FlatContent,\n TypedNode,\n ContentModule,\n} from './types/index';\nexport { NodeType } from './types/index';\nexport { getLocaleName } from './getLocaleName';\nexport { localeList } from './localeList';\n"],"mappings":"AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;","names":[]}
|
package/dist/esm/localeList.mjs
CHANGED
|
@@ -224,7 +224,9 @@ const localeList = [
|
|
|
224
224
|
Locales.CHINESE_MACAU,
|
|
225
225
|
Locales.CHINESE_SINGAPORE,
|
|
226
226
|
Locales.CHINESE_TRADITIONAL,
|
|
227
|
-
Locales.ZULU_SOUTH_AFRICA
|
|
227
|
+
Locales.ZULU_SOUTH_AFRICA
|
|
228
228
|
];
|
|
229
|
-
export {
|
|
230
|
-
|
|
229
|
+
export {
|
|
230
|
+
localeList
|
|
231
|
+
};
|
|
232
|
+
//# sourceMappingURL=localeList.mjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NoteStackTraceInfo } from
|
|
2
|
-
import { NodeType } from
|
|
1
|
+
import { NoteStackTraceInfo } from '../../../utils/getStackTraceInfo.mjs';
|
|
2
|
+
import { NodeType } from '../../../types/nodeType.mjs';
|
|
3
3
|
|
|
4
4
|
type Positif = number | `${number}`;
|
|
5
5
|
type Negatif = `-${number}`;
|
|
@@ -10,23 +10,28 @@ type Superior = `>${Numbers}`;
|
|
|
10
10
|
type SuperiorOrEqual = `>=${Numbers}`;
|
|
11
11
|
type Inferior = `<${Numbers}`;
|
|
12
12
|
type InferiorOrEqual = `<=${Numbers}`;
|
|
13
|
-
type EnterFormat =
|
|
14
|
-
| Equal
|
|
15
|
-
| EqualString
|
|
16
|
-
| Superior
|
|
17
|
-
| SuperiorOrEqual
|
|
18
|
-
| Inferior
|
|
19
|
-
| InferiorOrEqual;
|
|
13
|
+
type EnterFormat = Equal | EqualString | Superior | SuperiorOrEqual | Inferior | InferiorOrEqual;
|
|
20
14
|
type QuantityContent<Content> = Record<EnterFormat, Content>;
|
|
21
|
-
type EnumerationContent<Content> = Partial<QuantityContent<Content>> &
|
|
22
|
-
NoteStackTraceInfo & {
|
|
15
|
+
type EnumerationContent<Content> = Partial<QuantityContent<Content>> & NoteStackTraceInfo & {
|
|
23
16
|
nodeType: NodeType.Enumeration;
|
|
24
|
-
|
|
17
|
+
};
|
|
25
18
|
/**
|
|
26
|
-
*
|
|
19
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
20
|
+
*
|
|
21
|
+
* Allow to pick a content based on a quantity.
|
|
22
|
+
*
|
|
23
|
+
* Usage:
|
|
24
|
+
*
|
|
25
|
+
* const content = enu({
|
|
26
|
+
* '<=-2.3': 'You have less than -2.3',
|
|
27
|
+
* '<1': 'You have less than one',
|
|
28
|
+
* '2': 'You have two',
|
|
29
|
+
* '>=3': 'You have three or more',
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* The order of the keys will define the priority of the content.
|
|
33
|
+
*
|
|
27
34
|
*/
|
|
28
|
-
declare const enumeration: <Content>(
|
|
29
|
-
content?: Partial<QuantityContent<Content>>
|
|
30
|
-
) => EnumerationContent<Content>;
|
|
35
|
+
declare const enumeration: <Content>(content?: Partial<QuantityContent<Content>>) => EnumerationContent<Content>;
|
|
31
36
|
|
|
32
37
|
export { type EnumerationContent, type QuantityContent, enumeration as enu };
|
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import { NodeType } from
|
|
2
|
-
import {
|
|
1
|
+
import { NodeType } from '../../../types/index.mjs';
|
|
2
|
+
import {
|
|
3
|
+
getStackTraceInfo
|
|
4
|
+
} from '../../../utils/getStackTraceInfo.mjs';
|
|
3
5
|
const enumeration = (content) => {
|
|
4
6
|
const stackTraceInfo = getStackTraceInfo();
|
|
5
7
|
if (typeof content === "string") {
|
|
6
8
|
const result2 = {
|
|
7
9
|
nodeType: NodeType.Enumeration,
|
|
8
10
|
...stackTraceInfo,
|
|
9
|
-
1: content
|
|
11
|
+
1: content
|
|
10
12
|
};
|
|
11
13
|
return result2;
|
|
12
14
|
}
|
|
13
15
|
const result = {
|
|
14
16
|
nodeType: NodeType.Enumeration,
|
|
15
17
|
...stackTraceInfo,
|
|
16
|
-
...content
|
|
18
|
+
...content
|
|
17
19
|
};
|
|
18
20
|
return result;
|
|
19
21
|
};
|
|
20
|
-
export {
|
|
21
|
-
|
|
22
|
+
export {
|
|
23
|
+
enumeration as enu
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=enumeration.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/enumeration/enumeration.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { NodeType } from '../../../types/index';\nimport {\n getStackTraceInfo,\n type NoteStackTraceInfo,\n} from '../../../utils/getStackTraceInfo';\n\ntype Positif = number | `${number}`;\ntype Negatif = `-${number}`;\ntype Numbers = Positif | Negatif;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\ntype EnterFormat =\n | Equal\n | EqualString\n | Superior\n | SuperiorOrEqual\n | Inferior\n | InferiorOrEqual;\n\nexport type QuantityContent<Content> = Record<EnterFormat, Content>;\n\nexport type EnumerationContent<Content> = Partial<QuantityContent<Content>> &\n NoteStackTraceInfo & {\n nodeType: NodeType.Enumeration;\n };\n\n/**\n *
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/enumeration/enumeration.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { NodeType } from '../../../types/index';\nimport {\n getStackTraceInfo,\n type NoteStackTraceInfo,\n} from '../../../utils/getStackTraceInfo';\n\ntype Positif = number | `${number}`;\ntype Negatif = `-${number}`;\ntype Numbers = Positif | Negatif;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\ntype EnterFormat =\n | Equal\n | EqualString\n | Superior\n | SuperiorOrEqual\n | Inferior\n | InferiorOrEqual;\n\nexport type QuantityContent<Content> = Record<EnterFormat, Content>;\n\nexport type EnumerationContent<Content> = Partial<QuantityContent<Content>> &\n NoteStackTraceInfo & {\n nodeType: NodeType.Enumeration;\n };\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * const content = enu({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * });\n *\n * The order of the keys will define the priority of the content.\n *\n */\nconst enumeration = <Content>(content?: Partial<QuantityContent<Content>>) => {\n const stackTraceInfo = getStackTraceInfo();\n\n if (typeof content === 'string') {\n const result: EnumerationContent<Content> = {\n nodeType: NodeType.Enumeration,\n ...stackTraceInfo,\n 1: content,\n };\n\n return result;\n }\n\n const result: EnumerationContent<Content> = {\n nodeType: NodeType.Enumeration,\n ...stackTraceInfo,\n ...content,\n };\n\n return result;\n};\n\nexport { enumeration as enu };\n"],"mappings":"AACA,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,OAEK;AA6CP,MAAM,cAAc,CAAU,YAAgD;AAC5E,QAAM,iBAAiB,kBAAkB;AAEzC,MAAI,OAAO,YAAY,UAAU;AAC/B,UAAMA,UAAsC;AAAA,MAC1C,UAAU,SAAS;AAAA,MACnB,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAEA,WAAOA;AAAA,EACT;AAEA,QAAM,SAAsC;AAAA,IAC1C,UAAU,SAAS;AAAA,IACnB,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AAEA,SAAO;AACT;","names":["result"]}
|
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
import { QuantityContent } from
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { QuantityContent } from './enumeration.mjs';
|
|
2
|
+
import '../../../utils/getStackTraceInfo.mjs';
|
|
3
|
+
import '../../../types/nodeType.mjs';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Allow to pick a content based on a quantity.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
*
|
|
10
|
+
* const content = getEnumerationContent({
|
|
11
|
+
* '<=-2.3': 'You have less than -2.3',
|
|
12
|
+
* '<1': 'You have less than one',
|
|
13
|
+
* '2': 'You have two',
|
|
14
|
+
* '>=3': 'You have three or more',
|
|
15
|
+
* },
|
|
16
|
+
* 2);
|
|
17
|
+
* // 'You have two'
|
|
18
|
+
*
|
|
19
|
+
* The order of the keys will define the priority of the content.
|
|
20
|
+
*
|
|
21
|
+
* const content = getEnumerationContent({
|
|
22
|
+
* '<4': 'You have less than four',
|
|
23
|
+
* '2': 'You have two',
|
|
24
|
+
* });
|
|
25
|
+
* // 'You have less than four'
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
declare const getEnumerationContent: <Content>(enumerationContent: QuantityContent<Content>, quantity: number) => Content;
|
|
9
29
|
|
|
10
30
|
export { getEnumerationContent };
|
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
const getEnumerationContent = (enumerationContent, quantity) => {
|
|
2
2
|
const numericKeys = Object.keys(enumerationContent);
|
|
3
3
|
for (const key of numericKeys) {
|
|
4
|
-
const isEqual =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const isSuperior =
|
|
11
|
-
key.startsWith(">") && quantity > parseFloat(key.slice(1));
|
|
12
|
-
const isSuperiorOrEqual =
|
|
13
|
-
key.startsWith(">=") && quantity >= parseFloat(key.slice(2));
|
|
14
|
-
const isInferior =
|
|
15
|
-
key.startsWith("<") && quantity < parseFloat(key.slice(1));
|
|
16
|
-
const isInferiorOrEqual =
|
|
17
|
-
key.startsWith("<=") && quantity <= parseFloat(key.slice(2));
|
|
18
|
-
if (
|
|
19
|
-
isEqual ||
|
|
20
|
-
isSuperior ||
|
|
21
|
-
isSuperiorOrEqual ||
|
|
22
|
-
isInferior ||
|
|
23
|
-
isInferiorOrEqual
|
|
24
|
-
) {
|
|
4
|
+
const isEqual = !key.startsWith(">") && !key.startsWith("<") && !key.startsWith("=") && parseFloat(key) === quantity || key.startsWith("=") && parseFloat(key.slice(1)) === quantity;
|
|
5
|
+
const isSuperior = key.startsWith(">") && quantity > parseFloat(key.slice(1));
|
|
6
|
+
const isSuperiorOrEqual = key.startsWith(">=") && quantity >= parseFloat(key.slice(2));
|
|
7
|
+
const isInferior = key.startsWith("<") && quantity < parseFloat(key.slice(1));
|
|
8
|
+
const isInferiorOrEqual = key.startsWith("<=") && quantity <= parseFloat(key.slice(2));
|
|
9
|
+
if (isEqual || isSuperior || isSuperiorOrEqual || isInferior || isInferiorOrEqual) {
|
|
25
10
|
return enumerationContent[key];
|
|
26
11
|
}
|
|
27
12
|
}
|
|
28
13
|
return enumerationContent["1"];
|
|
29
14
|
};
|
|
30
|
-
export {
|
|
31
|
-
|
|
15
|
+
export {
|
|
16
|
+
getEnumerationContent
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=getEnumerationContent.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/enumeration/getEnumerationContent.ts"],"sourcesContent":["import type { QuantityContent } from './enumeration';\n\ntype Key = keyof QuantityContent<string>;\n\nexport const getEnumerationContent = <Content>(\n enumerationContent: QuantityContent<Content>,\n quantity: number\n): Content => {\n const numericKeys = Object.keys(enumerationContent);\n\n for (const key of numericKeys) {\n const isEqual =\n (!key.startsWith('>') &&\n !key.startsWith('<') &&\n !key.startsWith('=') &&\n parseFloat(key) === quantity) ||\n (key.startsWith('=') && parseFloat(key.slice(1)) === quantity);\n const isSuperior =\n key.startsWith('>') && quantity > parseFloat(key.slice(1));\n const isSuperiorOrEqual =\n key.startsWith('>=') && quantity >= parseFloat(key.slice(2));\n const isInferior =\n key.startsWith('<') && quantity < parseFloat(key.slice(1));\n const isInferiorOrEqual =\n key.startsWith('<=') && quantity <= parseFloat(key.slice(2));\n\n if (\n isEqual ||\n isSuperior ||\n isSuperiorOrEqual ||\n isInferior ||\n isInferiorOrEqual\n ) {\n return enumerationContent[key as Key];\n }\n }\n\n // Default or error handling if no keys match\n return enumerationContent['1'];\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/enumeration/getEnumerationContent.ts"],"sourcesContent":["import type { QuantityContent } from './enumeration';\n\ntype Key = keyof QuantityContent<string>;\n\n/**\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * const content = getEnumerationContent({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * },\n * 2);\n * // 'You have two'\n *\n * The order of the keys will define the priority of the content.\n *\n * const content = getEnumerationContent({\n * '<4': 'You have less than four',\n * '2': 'You have two',\n * });\n * // 'You have less than four'\n *\n */\nexport const getEnumerationContent = <Content>(\n enumerationContent: QuantityContent<Content>,\n quantity: number\n): Content => {\n const numericKeys = Object.keys(enumerationContent);\n\n for (const key of numericKeys) {\n const isEqual =\n (!key.startsWith('>') &&\n !key.startsWith('<') &&\n !key.startsWith('=') &&\n parseFloat(key) === quantity) ||\n (key.startsWith('=') && parseFloat(key.slice(1)) === quantity);\n const isSuperior =\n key.startsWith('>') && quantity > parseFloat(key.slice(1));\n const isSuperiorOrEqual =\n key.startsWith('>=') && quantity >= parseFloat(key.slice(2));\n const isInferior =\n key.startsWith('<') && quantity < parseFloat(key.slice(1));\n const isInferiorOrEqual =\n key.startsWith('<=') && quantity <= parseFloat(key.slice(2));\n\n if (\n isEqual ||\n isSuperior ||\n isSuperiorOrEqual ||\n isInferior ||\n isInferiorOrEqual\n ) {\n return enumerationContent[key as Key];\n }\n }\n\n // Default or error handling if no keys match\n return enumerationContent['1'];\n};\n"],"mappings":"AA2BO,MAAM,wBAAwB,CACnC,oBACA,aACY;AACZ,QAAM,cAAc,OAAO,KAAK,kBAAkB;AAElD,aAAW,OAAO,aAAa;AAC7B,UAAM,UACH,CAAC,IAAI,WAAW,GAAG,KAClB,CAAC,IAAI,WAAW,GAAG,KACnB,CAAC,IAAI,WAAW,GAAG,KACnB,WAAW,GAAG,MAAM,YACrB,IAAI,WAAW,GAAG,KAAK,WAAW,IAAI,MAAM,CAAC,CAAC,MAAM;AACvD,UAAM,aACJ,IAAI,WAAW,GAAG,KAAK,WAAW,WAAW,IAAI,MAAM,CAAC,CAAC;AAC3D,UAAM,oBACJ,IAAI,WAAW,IAAI,KAAK,YAAY,WAAW,IAAI,MAAM,CAAC,CAAC;AAC7D,UAAM,aACJ,IAAI,WAAW,GAAG,KAAK,WAAW,WAAW,IAAI,MAAM,CAAC,CAAC;AAC3D,UAAM,oBACJ,IAAI,WAAW,IAAI,KAAK,YAAY,WAAW,IAAI,MAAM,CAAC,CAAC;AAE7D,QACE,WACA,cACA,qBACA,cACA,mBACA;AACA,aAAO,mBAAmB,GAAU;AAAA,IACtC;AAAA,EACF;AAGA,SAAO,mBAAmB,GAAG;AAC/B;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { EnumerationContent, QuantityContent, enu } from
|
|
2
|
-
export { getEnumerationContent } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
export { EnumerationContent, QuantityContent, enu } from './enumeration.mjs';
|
|
2
|
+
export { getEnumerationContent } from './getEnumerationContent.mjs';
|
|
3
|
+
import '../../../utils/getStackTraceInfo.mjs';
|
|
4
|
+
import '../../../types/nodeType.mjs';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
export * from './enumeration.mjs';
|
|
2
|
+
export * from './getEnumerationContent.mjs';
|
|
3
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
enu,
|
|
11
|
-
} from "./enumeration/enumeration.mjs";
|
|
12
|
-
export { getEnumerationContent } from "./enumeration/getEnumerationContent.mjs";
|
|
13
|
-
import "@intlayer/config/client";
|
|
14
|
-
import "../../utils/getStackTraceInfo.mjs";
|
|
15
|
-
import "../../types/nodeType.mjs";
|
|
1
|
+
export { t } from './translation/translation.mjs';
|
|
2
|
+
export { getTranslationContent } from './translation/getTranslationContent.mjs';
|
|
3
|
+
export { ConfigLanguageContent, ConfigLocales, CustomLocales, CustomizableLanguageContent, LanguageContent, TranslationContent } from './translation/types.mjs';
|
|
4
|
+
export { EnumerationContent, QuantityContent, enu } from './enumeration/enumeration.mjs';
|
|
5
|
+
export { getEnumerationContent } from './enumeration/getEnumerationContent.mjs';
|
|
6
|
+
import '@intlayer/config/client';
|
|
7
|
+
import 'intlayer';
|
|
8
|
+
import '../../utils/getStackTraceInfo.mjs';
|
|
9
|
+
import '../../types/nodeType.mjs';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
//# sourceMappingURL=index.mjs.map
|
|
1
|
+
export * from './translation/index.mjs';
|
|
2
|
+
export * from './enumeration/index.mjs';
|
|
3
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { Locales } from '@intlayer/config/client';
|
|
2
|
+
import { CustomizableLanguageContent } from './types.mjs';
|
|
3
|
+
import 'intlayer';
|
|
4
|
+
import '../../../utils/getStackTraceInfo.mjs';
|
|
5
|
+
import '../../../types/nodeType.mjs';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
type GetTranslationContent = <Content = string>(languageContent: CustomizableLanguageContent<Content>, locale: Locales) => Content;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* Allow to pick a content based on a locale.
|
|
11
|
+
* If not locale found, it will return the content related to the default locale.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
*
|
|
15
|
+
* const content = getTranslationContent({
|
|
16
|
+
* en: 'Hello',
|
|
17
|
+
* fr: 'Bonjour',
|
|
18
|
+
* },
|
|
19
|
+
* 'fr');
|
|
20
|
+
* // 'Bonjour'
|
|
21
|
+
*
|
|
22
|
+
* Using TypeScript:
|
|
23
|
+
* - this function will require each locale to be defined if defined in the project configuration.
|
|
24
|
+
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
25
|
+
*/
|
|
26
|
+
declare const getTranslationContent: GetTranslationContent;
|
|
10
27
|
|
|
11
28
|
export { getTranslationContent };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
intlayerIntlConfiguration
|
|
3
|
+
} from "@intlayer/config/client";
|
|
2
4
|
const defaultLocale = intlayerIntlConfiguration.defaultLocale;
|
|
3
|
-
const getTranslationContent = (languageContent, locale) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const getTranslationContent = (languageContent, locale) => languageContent[locale ?? defaultLocale] ?? languageContent[defaultLocale];
|
|
6
|
+
export {
|
|
7
|
+
getTranslationContent
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=getTranslationContent.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/getTranslationContent.ts"],"sourcesContent":["import {\n type Locales,\n intlayerIntlConfiguration,\n} from '@intlayer/config/client';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/getTranslationContent.ts"],"sourcesContent":["import {\n type Locales,\n intlayerIntlConfiguration,\n} from '@intlayer/config/client';\nimport type { CustomizableLanguageContent } from './types';\n\nconst defaultLocale = intlayerIntlConfiguration.defaultLocale;\n\ntype GetTranslationContent = <Content = string>(\n languageContent: CustomizableLanguageContent<Content>,\n locale: Locales\n) => Content;\n\n/**\n *\n * Allow to pick a content based on a locale.\n * If not locale found, it will return the content related to the default locale.\n *\n * Usage:\n *\n * const content = getTranslationContent({\n * en: 'Hello',\n * fr: 'Bonjour',\n * },\n * 'fr');\n * // 'Bonjour'\n *\n * Using TypeScript:\n * - this function will require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nexport const getTranslationContent: GetTranslationContent = <Content = string>(\n languageContent: CustomizableLanguageContent<Content>,\n locale: Locales\n) => languageContent[locale ?? defaultLocale] ?? languageContent[defaultLocale];\n"],"mappings":"AAAA;AAAA,EAEE;AAAA,OACK;AAGP,MAAM,gBAAgB,0BAA0B;AAyBzC,MAAM,wBAA+C,CAC1D,iBACA,WACG,gBAAgB,UAAU,aAAa,KAAK,gBAAgB,aAAa;","names":[]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { getTranslationContent } from
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
export { t } from './translation.mjs';
|
|
2
|
+
export { getTranslationContent } from './getTranslationContent.mjs';
|
|
3
|
+
export { ConfigLanguageContent, ConfigLocales, CustomLocales, CustomizableLanguageContent, LanguageContent, TranslationContent } from './types.mjs';
|
|
4
|
+
import '@intlayer/config/client';
|
|
5
|
+
import 'intlayer';
|
|
6
|
+
import '../../../utils/getStackTraceInfo.mjs';
|
|
7
|
+
import '../../../types/nodeType.mjs';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
|
|
1
|
+
export * from './translation.mjs';
|
|
2
|
+
export * from './getTranslationContent.mjs';
|
|
3
|
+
export * from './types.mjs';
|
|
4
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/index.ts"],"sourcesContent":["export * from './translation';\nexport * from './getTranslationContent';\nexport * from './types';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CustomizableLanguageContent, TranslationContent } from './types.mjs';
|
|
2
|
+
import '@intlayer/config/client';
|
|
3
|
+
import 'intlayer';
|
|
4
|
+
import '../../../utils/getStackTraceInfo.mjs';
|
|
5
|
+
import '../../../types/nodeType.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
10
|
+
*
|
|
11
|
+
* Get the content of a translation based on the locale.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
*
|
|
15
|
+
* translation<string>({
|
|
16
|
+
* "en": "Hello",
|
|
17
|
+
* "fr": "Bonjour",
|
|
18
|
+
* // ... any other available locale
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* Using TypeScript:
|
|
22
|
+
* - this function require each locale to be defined if defined in the project configuration.
|
|
23
|
+
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
24
|
+
*/
|
|
25
|
+
declare const translation: <Content = string>(content?: CustomizableLanguageContent<Content>) => TranslationContent<Content>;
|
|
26
|
+
|
|
27
|
+
export { translation as t };
|
package/dist/esm/transpiler/content_transformers/translation/{translations.mjs → translation.mjs}
RENAMED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { intlayerConfiguration } from "@intlayer/config/client";
|
|
2
|
-
import { NodeType } from
|
|
3
|
-
import { getStackTraceInfo } from
|
|
4
|
-
const
|
|
2
|
+
import { NodeType } from '../../../types/index.mjs';
|
|
3
|
+
import { getStackTraceInfo } from '../../../utils/getStackTraceInfo.mjs';
|
|
4
|
+
const { defaultLocale } = intlayerConfiguration.internationalization;
|
|
5
|
+
const translation = (content) => {
|
|
5
6
|
const stackTraceInfo = getStackTraceInfo();
|
|
6
7
|
if (typeof content === "string") {
|
|
7
8
|
const result2 = {
|
|
8
9
|
nodeType: NodeType.Translation,
|
|
9
10
|
...stackTraceInfo,
|
|
10
|
-
[
|
|
11
|
+
[defaultLocale]: content
|
|
11
12
|
};
|
|
12
13
|
return result2;
|
|
13
14
|
}
|
|
14
15
|
const result = {
|
|
15
16
|
nodeType: NodeType.Translation,
|
|
16
17
|
...stackTraceInfo,
|
|
17
|
-
...content
|
|
18
|
+
...content
|
|
18
19
|
};
|
|
19
20
|
return result;
|
|
20
21
|
};
|
|
21
|
-
export {
|
|
22
|
-
|
|
22
|
+
export {
|
|
23
|
+
translation as t
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=translation.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/transpiler/content_transformers/translation/translation.ts"],"sourcesContent":["import { intlayerConfiguration } from '@intlayer/config/client';\nimport { NodeType } from '../../../types/index';\nimport { getStackTraceInfo } from '../../../utils/getStackTraceInfo';\nimport type { CustomizableLanguageContent, TranslationContent } from './types';\n\nconst { defaultLocale } = intlayerConfiguration.internationalization;\n\n/**\n *\n * Function intended to be used to build intlayer dictionaries.\n *\n * Get the content of a translation based on the locale.\n *\n * Usage:\n *\n * translation<string>({\n * \"en\": \"Hello\",\n * \"fr\": \"Bonjour\",\n * // ... any other available locale\n * })\n *\n * Using TypeScript:\n * - this function require each locale to be defined if defined in the project configuration.\n * - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.\n */\nconst translation = <Content = string>(\n content?: CustomizableLanguageContent<Content>\n) => {\n const stackTraceInfo = getStackTraceInfo();\n\n if (typeof content === 'string') {\n const result: TranslationContent<Content> = {\n nodeType: NodeType.Translation,\n ...stackTraceInfo,\n [defaultLocale]: content,\n } as TranslationContent<Content>;\n\n return result;\n }\n\n const result: TranslationContent<Content> = {\n nodeType: NodeType.Translation,\n ...stackTraceInfo,\n ...(content as unknown as object),\n } as TranslationContent<Content>;\n\n return result;\n};\n\nexport { translation as t };\n"],"mappings":"AAAA,SAAS,6BAA6B;AACtC,SAAS,gBAAgB;AACzB,SAAS,yBAAyB;AAGlC,MAAM,EAAE,cAAc,IAAI,sBAAsB;AAoBhD,MAAM,cAAc,CAClB,YACG;AACH,QAAM,iBAAiB,kBAAkB;AAEzC,MAAI,OAAO,YAAY,UAAU;AAC/B,UAAMA,UAAsC;AAAA,MAC1C,UAAU,SAAS;AAAA,MACnB,GAAG;AAAA,MACH,CAAC,aAAa,GAAG;AAAA,IACnB;AAEA,WAAOA;AAAA,EACT;AAEA,QAAM,SAAsC;AAAA,IAC1C,UAAU,SAAS;AAAA,IACnB,GAAG;AAAA,IACH,GAAI;AAAA,EACN;AAEA,SAAO;AACT;","names":["result"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { LocalesValues } from '@intlayer/config/client';
|
|
2
|
+
import { IConfigLocales } from 'intlayer';
|
|
3
|
+
import { NoteStackTraceInfo } from '../../../utils/getStackTraceInfo.mjs';
|
|
4
|
+
import { NodeType } from '../../../types/nodeType.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* If module augmented, it will return the configured locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...
|
|
8
|
+
* If not, it will return never
|
|
9
|
+
*/
|
|
10
|
+
type ConfigLocales = keyof IConfigLocales<unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* If module augmented, it will return the configured locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...
|
|
13
|
+
* If not, it will return all available locales such as Locales.ENGLISH | Locales.FRENCH | Locales.SPANISH | ...
|
|
14
|
+
*/
|
|
15
|
+
type CustomLocales = ConfigLocales extends never ? LocalesValues : ConfigLocales;
|
|
16
|
+
/**
|
|
17
|
+
* Record of locales and content
|
|
18
|
+
*
|
|
19
|
+
* const myVar1: LanguageContent<string> = {
|
|
20
|
+
* "en": "",
|
|
21
|
+
* "fr": ""
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* const myVar2: LanguageContent<{age: number, name: string}> = {
|
|
25
|
+
* "en": {age: 1, name: "test"},
|
|
26
|
+
* "fr": {age: 1, name: "test"}
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
type LanguageContent<Content> = Partial<Record<LocalesValues, Content>>;
|
|
30
|
+
type ConfigLanguageContent<Content> = Record<ConfigLocales, Content>;
|
|
31
|
+
/**
|
|
32
|
+
* Valid
|
|
33
|
+
* const test: CustomizableLanguageContent<string, Locales.ENGLISH | Locales.FRENCH> = {
|
|
34
|
+
* "en": "test",
|
|
35
|
+
* "fr": "test"
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* const test: CustomizableLanguageContent<number> = {
|
|
39
|
+
* "fr": 1,
|
|
40
|
+
* "en": 1,
|
|
41
|
+
* ... any other available locale
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* Invalid
|
|
45
|
+
*
|
|
46
|
+
* const test: CustomizableLanguageContent<string> = {
|
|
47
|
+
* "en": "test",
|
|
48
|
+
* "fr": "test",
|
|
49
|
+
* "sss": "test" // Does not exist in Locales
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* const test: CustomizableLanguageContent<string, Locales.ENGLISH | Locales.FRENCH> = {
|
|
53
|
+
* "fr": "test"
|
|
54
|
+
* // Locales.ENGLISH is missing
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
*/
|
|
58
|
+
type CustomizableLanguageContent<Content = string> = ConfigLocales extends never ? LanguageContent<Content> : ConfigLanguageContent<Content>;
|
|
59
|
+
type TranslationContent<Content> = LanguageContent<Content> & NoteStackTraceInfo & {
|
|
60
|
+
nodeType: NodeType.Translation;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type { ConfigLanguageContent, ConfigLocales, CustomLocales, CustomizableLanguageContent, LanguageContent, TranslationContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|