@intlayer/core 8.7.14 → 8.9.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.
Files changed (84) hide show
  1. package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs +3 -3
  2. package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
  3. package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +1 -1
  4. package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
  5. package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs +7 -0
  6. package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
  7. package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs +1 -1
  8. package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
  9. package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs +1 -1
  10. package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
  11. package/dist/cjs/dictionaryManipulator/getNodeType.cjs +1 -0
  12. package/dist/cjs/dictionaryManipulator/getNodeType.cjs.map +1 -1
  13. package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs +1 -1
  14. package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -1
  15. package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs +1 -1
  16. package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -1
  17. package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs +1 -1
  18. package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs.map +1 -1
  19. package/dist/cjs/index.cjs +14 -9
  20. package/dist/cjs/interpreter/getContent/index.cjs +1 -0
  21. package/dist/cjs/interpreter/getContent/plugins.cjs +55 -0
  22. package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
  23. package/dist/cjs/interpreter/getIntlayer.cjs +8 -4
  24. package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
  25. package/dist/cjs/interpreter/getPlural.cjs +26 -0
  26. package/dist/cjs/interpreter/getPlural.cjs.map +1 -0
  27. package/dist/cjs/interpreter/index.cjs +3 -0
  28. package/dist/cjs/transpiler/index.cjs +2 -0
  29. package/dist/cjs/transpiler/plural/index.cjs +4 -0
  30. package/dist/cjs/transpiler/plural/plural.cjs +33 -0
  31. package/dist/cjs/transpiler/plural/plural.cjs.map +1 -0
  32. package/dist/cjs/utils/index.cjs +1 -1
  33. package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +3 -3
  34. package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -1
  35. package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +1 -1
  36. package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -1
  37. package/dist/esm/dictionaryManipulator/getDefaultNode.mjs +7 -0
  38. package/dist/esm/dictionaryManipulator/getDefaultNode.mjs.map +1 -1
  39. package/dist/esm/dictionaryManipulator/getEmptyNode.mjs +1 -1
  40. package/dist/esm/dictionaryManipulator/getEmptyNode.mjs.map +1 -1
  41. package/dist/esm/dictionaryManipulator/getNodeChildren.mjs +1 -1
  42. package/dist/esm/dictionaryManipulator/getNodeChildren.mjs.map +1 -1
  43. package/dist/esm/dictionaryManipulator/getNodeType.mjs +1 -0
  44. package/dist/esm/dictionaryManipulator/getNodeType.mjs.map +1 -1
  45. package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs +1 -1
  46. package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs.map +1 -1
  47. package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +1 -1
  48. package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -1
  49. package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs +1 -1
  50. package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs.map +1 -1
  51. package/dist/esm/index.mjs +13 -11
  52. package/dist/esm/interpreter/getContent/index.mjs +2 -2
  53. package/dist/esm/interpreter/getContent/plugins.mjs +55 -1
  54. package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -1
  55. package/dist/esm/interpreter/getIntlayer.mjs +8 -4
  56. package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
  57. package/dist/esm/interpreter/getPlural.mjs +25 -0
  58. package/dist/esm/interpreter/getPlural.mjs.map +1 -0
  59. package/dist/esm/interpreter/index.mjs +3 -2
  60. package/dist/esm/transpiler/index.mjs +2 -1
  61. package/dist/esm/transpiler/plural/index.mjs +3 -0
  62. package/dist/esm/transpiler/plural/plural.mjs +31 -0
  63. package/dist/esm/transpiler/plural/plural.mjs.map +1 -0
  64. package/dist/esm/utils/index.mjs +1 -1
  65. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +12 -12
  66. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
  67. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +12 -12
  68. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
  69. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +10 -10
  70. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -1
  71. package/dist/types/dictionaryManipulator/getNodeType.d.ts.map +1 -1
  72. package/dist/types/index.d.ts +4 -2
  73. package/dist/types/interpreter/getContent/index.d.ts +2 -2
  74. package/dist/types/interpreter/getContent/plugins.d.ts +19 -1
  75. package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
  76. package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
  77. package/dist/types/interpreter/getPlural.d.ts +24 -0
  78. package/dist/types/interpreter/getPlural.d.ts.map +1 -0
  79. package/dist/types/interpreter/index.d.ts +3 -2
  80. package/dist/types/transpiler/index.d.ts +2 -1
  81. package/dist/types/transpiler/plural/index.d.ts +2 -0
  82. package/dist/types/transpiler/plural/plural.d.ts +35 -0
  83. package/dist/types/transpiler/plural/plural.d.ts.map +1 -0
  84. 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,2 @@
1
+ import { PluralCategory, PluralContent, PluralContentState, plural } from "./plural.js";
2
+ export { PluralCategory, PluralContent, PluralContentState, plural };
@@ -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.7.14",
3
+ "version": "8.9.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.7.14",
172
- "@intlayer/config": "8.7.14",
173
- "@intlayer/dictionaries-entry": "8.7.14",
174
- "@intlayer/types": "8.7.14",
175
- "@intlayer/unmerged-dictionaries-entry": "8.7.14",
171
+ "@intlayer/api": "8.9.0",
172
+ "@intlayer/config": "8.9.0",
173
+ "@intlayer/dictionaries-entry": "8.9.0",
174
+ "@intlayer/types": "8.9.0",
175
+ "@intlayer/unmerged-dictionaries-entry": "8.9.0",
176
176
  "defu": "6.1.7"
177
177
  },
178
178
  "devDependencies": {