@intlayer/core 8.7.13 → 8.8.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/dictionaryManipulator/editDictionaryByKeyPath.cjs +3 -3
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs +7 -0
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeType.cjs +1 -0
- package/dist/cjs/dictionaryManipulator/getNodeType.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs +1 -1
- package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs.map +1 -1
- package/dist/cjs/index.cjs +14 -9
- package/dist/cjs/interpreter/getContent/index.cjs +1 -0
- package/dist/cjs/interpreter/getContent/plugins.cjs +55 -0
- package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
- package/dist/cjs/interpreter/getIntlayer.cjs +8 -4
- package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
- package/dist/cjs/interpreter/getPlural.cjs +26 -0
- package/dist/cjs/interpreter/getPlural.cjs.map +1 -0
- package/dist/cjs/interpreter/index.cjs +3 -0
- package/dist/cjs/transpiler/index.cjs +2 -0
- package/dist/cjs/transpiler/plural/index.cjs +4 -0
- package/dist/cjs/transpiler/plural/plural.cjs +33 -0
- package/dist/cjs/transpiler/plural/plural.cjs.map +1 -0
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +3 -3
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs +7 -0
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs +1 -1
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs +1 -1
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getNodeType.mjs +1 -0
- package/dist/esm/dictionaryManipulator/getNodeType.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +1 -1
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs +1 -1
- package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs.map +1 -1
- package/dist/esm/index.mjs +13 -11
- package/dist/esm/interpreter/getContent/index.mjs +2 -2
- package/dist/esm/interpreter/getContent/plugins.mjs +55 -1
- package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -1
- package/dist/esm/interpreter/getIntlayer.mjs +8 -4
- package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
- package/dist/esm/interpreter/getPlural.mjs +25 -0
- package/dist/esm/interpreter/getPlural.mjs.map +1 -0
- package/dist/esm/interpreter/index.mjs +3 -2
- package/dist/esm/transpiler/index.mjs +2 -1
- package/dist/esm/transpiler/plural/index.mjs +3 -0
- package/dist/esm/transpiler/plural/plural.mjs +31 -0
- package/dist/esm/transpiler/plural/plural.mjs.map +1 -0
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +12 -12
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +12 -12
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +10 -10
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getNodeType.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/interpreter/getContent/index.d.ts +2 -2
- package/dist/types/interpreter/getContent/plugins.d.ts +19 -1
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
- package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
- package/dist/types/interpreter/getPlural.d.ts +24 -0
- package/dist/types/interpreter/getPlural.d.ts.map +1 -0
- package/dist/types/interpreter/index.d.ts +3 -2
- package/dist/types/transpiler/index.d.ts +2 -1
- package/dist/types/transpiler/plural/index.d.ts +2 -0
- package/dist/types/transpiler/plural/plural.d.ts +35 -0
- package/dist/types/transpiler/plural/plural.d.ts.map +1 -0
- package/package.json +6 -6
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { getCondition } from "./getCondition.js";
|
|
2
2
|
import { GetNestingResult, getNesting } from "./getNesting.js";
|
|
3
|
-
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, translationPlugin } from "./getContent/plugins.js";
|
|
3
|
+
import { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, insertionPlugin, nestedPlugin, pluralPlugin, translationPlugin } from "./getContent/plugins.js";
|
|
4
4
|
import { deepTransformNode } from "./getContent/deepTransform.js";
|
|
5
5
|
import { getBasePlugins, getContent } from "./getContent/getContent.js";
|
|
6
6
|
import { getDictionary } from "./getDictionary.js";
|
|
7
7
|
import { findMatchingCondition, getEnumeration } from "./getEnumeration.js";
|
|
8
8
|
import { getHTML } from "./getHTML.js";
|
|
9
9
|
import { getIntlayer } from "./getIntlayer.js";
|
|
10
|
+
import { getPlural } from "./getPlural.js";
|
|
10
11
|
import { getTranslation } from "./getTranslation.js";
|
|
11
12
|
import { splitInsertionTemplate } from "./splitAndJoinInsertion.js";
|
|
12
|
-
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, GetNestingResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, deepTransformNode, enumerationPlugin, fallbackPlugin, filePlugin, findMatchingCondition, genderPlugin, getBasePlugins, getCondition, getContent, getDictionary, getEnumeration, getHTML, getIntlayer, getNesting, getTranslation, insertionPlugin, nestedPlugin, splitInsertionTemplate, translationPlugin };
|
|
13
|
+
export { ConditionCond, DeepTransformContent, EnumerationCond, FileCond, GenderCond, GetNestingResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, IsAny, NestedCond, NodeProps, Plugins, PluralCond, TranslationCond, UnionKeys, ValueAtKey, conditionPlugin, deepTransformNode, enumerationPlugin, fallbackPlugin, filePlugin, findMatchingCondition, genderPlugin, getBasePlugins, getCondition, getContent, getDictionary, getEnumeration, getHTML, getIntlayer, getNesting, getPlural, getTranslation, insertionPlugin, nestedPlugin, pluralPlugin, splitInsertionTemplate, translationPlugin };
|
|
@@ -11,5 +11,6 @@ import { getMarkdownMetadata } from "./markdown/getMarkdownMetadata.js";
|
|
|
11
11
|
import { MarkdownContent, MarkdownContentConstructor, md as markdown } from "./markdown/markdown.js";
|
|
12
12
|
import { MarkdownValidationResult, validateMarkdown } from "./markdown/validateMarkdown.js";
|
|
13
13
|
import { DotPath, NestedContent, NestedContentState, ValidDotPathsFor, nest as nesting } from "./nesting/nesting.js";
|
|
14
|
+
import { PluralCategory, PluralContent, PluralContentState, plural } from "./plural/plural.js";
|
|
14
15
|
import { TranslationContent, t as translation } from "./translation/translation.js";
|
|
15
|
-
export { ConditionContent, ConditionContentStates, DotPath, EnterFormat, EnumerationContent, EnumerationContentState, FileContent, FileContentConstructor, Gender, GenderContent, GenderContentStates, HTMLContent, HTMLContentConstructor, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_TAGS, InsertionContent, InsertionContentConstructor, MarkdownContent, MarkdownContentConstructor, HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, NestedContent, NestedContentState, TranslationContent, VOID_ELEMENTS, ValidDotPathsFor, condition as cond, enumeration as enu, file, fileContent, gender, getInsertionValues, getMarkdownMetadata, html, insertion as insert, markdown as md, nesting as nest, translation as t, validateHTML, validateMarkdown };
|
|
16
|
+
export { ConditionContent, ConditionContentStates, DotPath, EnterFormat, EnumerationContent, EnumerationContentState, FileContent, FileContentConstructor, Gender, GenderContent, GenderContentStates, HTMLContent, HTMLContentConstructor, HTMLTagsType, HTMLValidationIssue, HTMLValidationResult, HTML_TAGS, InsertionContent, InsertionContentConstructor, MarkdownContent, MarkdownContentConstructor, HTMLValidationIssue as MarkdownValidationIssue, MarkdownValidationResult, NestedContent, NestedContentState, PluralCategory, PluralContent, PluralContentState, TranslationContent, VOID_ELEMENTS, ValidDotPathsFor, condition as cond, enumeration as enu, file, fileContent, gender, getInsertionValues, getMarkdownMetadata, html, insertion as insert, markdown as md, nesting as nest, plural, translation as t, validateHTML, validateMarkdown };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PLURAL, TypedNodeModel } from "@intlayer/types/nodeType";
|
|
2
|
+
|
|
3
|
+
//#region src/transpiler/plural/plural.d.ts
|
|
4
|
+
type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
|
|
5
|
+
type PluralContentState<Content> = Partial<Record<PluralCategory, Content>> & {
|
|
6
|
+
other: Content;
|
|
7
|
+
};
|
|
8
|
+
type PluralContent<Content = unknown> = TypedNodeModel<typeof PLURAL, PluralContentState<Content>>;
|
|
9
|
+
/**
|
|
10
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
11
|
+
*
|
|
12
|
+
* Allow to pick a content based on a quantity using CLDR pluralization rules
|
|
13
|
+
* (`Intl.PluralRules`). The selected category depends on the active locale.
|
|
14
|
+
*
|
|
15
|
+
* Supported categories: `zero`, `one`, `two`, `few`, `many`, `other`.
|
|
16
|
+
* `other` is required as the fallback.
|
|
17
|
+
*
|
|
18
|
+
* The string content can include a `{{count}}` placeholder, which is
|
|
19
|
+
* automatically replaced with the provided count.
|
|
20
|
+
*
|
|
21
|
+
* Usage:
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* plural({
|
|
25
|
+
* one: '{{count}} вакансия',
|
|
26
|
+
* few: '{{count}} вакансии',
|
|
27
|
+
* many: '{{count}} вакансий',
|
|
28
|
+
* other: '{{count}} вакансий',
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare const plural: <Content = unknown>(content: PluralContentState<Content>) => PluralContent<Content>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { PluralCategory, PluralContent, PluralContentState, plural };
|
|
35
|
+
//# sourceMappingURL=plural.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plural.d.ts","names":[],"sources":["../../../../src/transpiler/plural/plural.ts"],"mappings":";;;KAGY,cAAA;AAAA,KAEA,kBAAA,YAA8B,OAAA,CACxC,MAAA,CAAO,cAAA,EAAgB,OAAA;EAEvB,KAAA,EAAO,OAAA;AAAA;AAAA,KAGG,aAAA,sBAAmC,cAAA,QACtC,MAAA,EACP,kBAAA,CAAmB,OAAA;;AARrB;;;;;;;;;;;;;;;;;;;AAMA;;;cA4BM,MAAA,sBACJ,OAAA,EAAS,kBAAA,CAAmB,OAAA,MAC3B,aAAA,CAAc,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/core",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Includes core Intlayer functions like translation, dictionary, and utility functions shared across multiple packages.",
|
|
6
6
|
"keywords": [
|
|
@@ -168,11 +168,11 @@
|
|
|
168
168
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
169
169
|
},
|
|
170
170
|
"dependencies": {
|
|
171
|
-
"@intlayer/api": "8.
|
|
172
|
-
"@intlayer/config": "8.
|
|
173
|
-
"@intlayer/dictionaries-entry": "8.
|
|
174
|
-
"@intlayer/types": "8.
|
|
175
|
-
"@intlayer/unmerged-dictionaries-entry": "8.
|
|
171
|
+
"@intlayer/api": "8.8.0",
|
|
172
|
+
"@intlayer/config": "8.8.0",
|
|
173
|
+
"@intlayer/dictionaries-entry": "8.8.0",
|
|
174
|
+
"@intlayer/types": "8.8.0",
|
|
175
|
+
"@intlayer/unmerged-dictionaries-entry": "8.8.0",
|
|
176
176
|
"defu": "6.1.7"
|
|
177
177
|
},
|
|
178
178
|
"devDependencies": {
|