@intlayer/core 6.1.6 → 7.0.0-canary.1
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/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs +213 -0
- package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs.map +1 -0
- package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs +95 -0
- package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs.map +1 -0
- package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs +46 -0
- package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs.map +1 -0
- package/dist/cjs/deepTransformPlugins/getLocalizedContent.cjs +33 -0
- package/dist/cjs/deepTransformPlugins/getLocalizedContent.cjs.map +1 -0
- package/dist/cjs/deepTransformPlugins/getMaskContent.cjs +27 -0
- package/dist/cjs/deepTransformPlugins/getMaskContent.cjs.map +1 -0
- package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs +45 -0
- package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs.map +1 -0
- package/dist/cjs/deepTransformPlugins/getReplacedValuesContent.cjs +60 -0
- package/dist/cjs/deepTransformPlugins/getReplacedValuesContent.cjs.map +1 -0
- package/dist/cjs/deepTransformPlugins/index.cjs +25 -0
- package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs +107 -0
- package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs.map +1 -0
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs +59 -91
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +13 -39
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs +48 -94
- package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs +24 -68
- package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs +21 -56
- package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getNodeType.cjs +32 -49
- package/dist/cjs/dictionaryManipulator/getNodeType.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/getUnmergedDictionaryByKeyPath.cjs +18 -50
- package/dist/cjs/dictionaryManipulator/getUnmergedDictionaryByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/index.cjs +28 -41
- package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs +69 -0
- package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs.map +1 -0
- package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs +30 -0
- package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs.map +1 -0
- package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs +48 -0
- package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs.map +1 -0
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs +29 -54
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs +37 -63
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -1
- package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs +36 -76
- package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs.map +1 -1
- package/dist/cjs/formatters/compact.cjs +24 -46
- package/dist/cjs/formatters/compact.cjs.map +1 -1
- package/dist/cjs/formatters/currency.cjs +28 -50
- package/dist/cjs/formatters/currency.cjs.map +1 -1
- package/dist/cjs/formatters/date.cjs +56 -79
- package/dist/cjs/formatters/date.cjs.map +1 -1
- package/dist/cjs/formatters/index.cjs +17 -37
- package/dist/cjs/formatters/list.cjs +29 -47
- package/dist/cjs/formatters/list.cjs.map +1 -1
- package/dist/cjs/formatters/number.cjs +17 -43
- package/dist/cjs/formatters/number.cjs.map +1 -1
- package/dist/cjs/formatters/percentage.cjs +22 -51
- package/dist/cjs/formatters/percentage.cjs.map +1 -1
- package/dist/cjs/formatters/relativeTime.cjs +28 -70
- package/dist/cjs/formatters/relativeTime.cjs.map +1 -1
- package/dist/cjs/formatters/units.cjs +22 -48
- package/dist/cjs/formatters/units.cjs.map +1 -1
- package/dist/cjs/getStorageAttributes.cjs +116 -0
- package/dist/cjs/getStorageAttributes.cjs.map +1 -0
- package/dist/cjs/index.cjs +154 -45
- package/dist/cjs/interpreter/getCondition.cjs +30 -30
- package/dist/cjs/interpreter/getCondition.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/deepTransform.cjs +38 -63
- package/dist/cjs/interpreter/getContent/deepTransform.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/getContent.cjs +31 -54
- package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -1
- package/dist/cjs/interpreter/getContent/index.cjs +13 -27
- package/dist/cjs/interpreter/getContent/plugins.cjs +135 -175
- package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
- package/dist/cjs/interpreter/getDictionary.cjs +21 -39
- package/dist/cjs/interpreter/getDictionary.cjs.map +1 -1
- package/dist/cjs/interpreter/getEnumeration.cjs +69 -42
- package/dist/cjs/interpreter/getEnumeration.cjs.map +1 -1
- package/dist/cjs/interpreter/getGender.cjs +33 -34
- package/dist/cjs/interpreter/getGender.cjs.map +1 -1
- package/dist/cjs/interpreter/getInsertion.cjs +18 -27
- package/dist/cjs/interpreter/getInsertion.cjs.map +1 -1
- package/dist/cjs/interpreter/getIntlayer.cjs +13 -48
- package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
- package/dist/cjs/interpreter/getNesting.cjs +26 -41
- package/dist/cjs/interpreter/getNesting.cjs.map +1 -1
- package/dist/cjs/interpreter/getTranslation.cjs +29 -32
- package/dist/cjs/interpreter/getTranslation.cjs.map +1 -1
- package/dist/cjs/interpreter/index.cjs +26 -39
- package/dist/cjs/localization/getBrowserLocale.cjs +144 -0
- package/dist/cjs/localization/getBrowserLocale.cjs.map +1 -0
- package/dist/cjs/localization/getHTMLTextDir.cjs +49 -255
- package/dist/cjs/localization/getHTMLTextDir.cjs.map +1 -1
- package/dist/cjs/localization/getLocaleFromPath.cjs +40 -56
- package/dist/cjs/localization/getLocaleFromPath.cjs.map +1 -1
- package/dist/cjs/localization/getLocaleLang.cjs +18 -27
- package/dist/cjs/localization/getLocaleLang.cjs.map +1 -1
- package/dist/cjs/localization/getLocaleName.cjs +7 -32
- package/dist/cjs/localization/getLocaleName.cjs.map +1 -1
- package/dist/cjs/localization/getLocalizedUrl.cjs +46 -47
- package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
- package/dist/cjs/localization/getMultilingualUrls.cjs +69 -65
- package/dist/cjs/localization/getMultilingualUrls.cjs.map +1 -1
- package/dist/cjs/localization/getPathWithoutLocale.cjs +53 -61
- package/dist/cjs/localization/getPathWithoutLocale.cjs.map +1 -1
- package/dist/cjs/localization/index.cjs +26 -63
- package/dist/cjs/localization/localeDetector.cjs +108 -39
- package/dist/cjs/localization/localeDetector.cjs.map +1 -1
- package/dist/cjs/localization/localeMapper.cjs +118 -72
- package/dist/cjs/localization/localeMapper.cjs.map +1 -1
- package/dist/cjs/localization/localeResolver.cjs +26 -61
- package/dist/cjs/localization/localeResolver.cjs.map +1 -1
- package/dist/cjs/transpiler/condition/condition.cjs +26 -29
- package/dist/cjs/transpiler/condition/condition.cjs.map +1 -1
- package/dist/cjs/transpiler/condition/index.cjs +3 -23
- package/dist/cjs/transpiler/enumeration/enumeration.cjs +28 -29
- package/dist/cjs/transpiler/enumeration/enumeration.cjs.map +1 -1
- package/dist/cjs/transpiler/enumeration/index.cjs +3 -23
- package/dist/cjs/transpiler/file/file.cjs +52 -71
- package/dist/cjs/transpiler/file/file.cjs.map +1 -1
- package/dist/cjs/transpiler/file/fileBrowser.cjs +24 -33
- package/dist/cjs/transpiler/file/fileBrowser.cjs.map +1 -1
- package/dist/cjs/transpiler/file/index.cjs +4 -23
- package/dist/cjs/transpiler/gender/gender.cjs +26 -29
- package/dist/cjs/transpiler/gender/gender.cjs.map +1 -1
- package/dist/cjs/transpiler/gender/index.cjs +3 -23
- package/dist/cjs/transpiler/index.cjs +19 -35
- package/dist/cjs/transpiler/insertion/getInsertionValues.cjs +8 -31
- package/dist/cjs/transpiler/insertion/getInsertionValues.cjs.map +1 -1
- package/dist/cjs/transpiler/insertion/index.cjs +5 -25
- package/dist/cjs/transpiler/insertion/insertion.cjs +34 -51
- package/dist/cjs/transpiler/insertion/insertion.cjs.map +1 -1
- package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs +53 -86
- package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs.map +1 -1
- package/dist/cjs/transpiler/markdown/index.cjs +5 -25
- package/dist/cjs/transpiler/markdown/markdown.cjs +33 -52
- package/dist/cjs/transpiler/markdown/markdown.cjs.map +1 -1
- package/dist/cjs/transpiler/nesting/index.cjs +3 -23
- package/dist/cjs/transpiler/nesting/nesting.cjs +26 -31
- package/dist/cjs/transpiler/nesting/nesting.cjs.map +1 -1
- package/dist/cjs/transpiler/translation/index.cjs +3 -23
- package/dist/cjs/transpiler/translation/translation.cjs +29 -29
- package/dist/cjs/transpiler/translation/translation.cjs.map +1 -1
- package/dist/cjs/utils/checkIsURLAbsolute.cjs +5 -27
- package/dist/cjs/utils/checkIsURLAbsolute.cjs.map +1 -1
- package/dist/cjs/utils/intl.cjs +48 -74
- package/dist/cjs/utils/intl.cjs.map +1 -1
- package/dist/cjs/utils/isSameKeyPath.cjs +6 -30
- package/dist/cjs/utils/isSameKeyPath.cjs.map +1 -1
- package/dist/cjs/utils/isValidReactElement.cjs +12 -27
- package/dist/cjs/utils/isValidReactElement.cjs.map +1 -1
- package/dist/cjs/utils/localeStorage.cjs +143 -0
- package/dist/cjs/utils/localeStorage.cjs.map +1 -0
- package/dist/cjs/utils/parseYaml.cjs +185 -55
- package/dist/cjs/utils/parseYaml.cjs.map +1 -1
- package/dist/esm/deepTransformPlugins/getFilterMissingTranslationsContent.mjs +208 -0
- package/dist/esm/deepTransformPlugins/getFilterMissingTranslationsContent.mjs.map +1 -0
- package/dist/esm/deepTransformPlugins/getFilterTranslationsOnlyContent.mjs +90 -0
- package/dist/esm/deepTransformPlugins/getFilterTranslationsOnlyContent.mjs.map +1 -0
- package/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs +43 -0
- package/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs.map +1 -0
- package/dist/esm/deepTransformPlugins/getLocalizedContent.mjs +32 -0
- package/dist/esm/deepTransformPlugins/getLocalizedContent.mjs.map +1 -0
- package/dist/esm/deepTransformPlugins/getMaskContent.mjs +26 -0
- package/dist/esm/deepTransformPlugins/getMaskContent.mjs.map +1 -0
- package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs +41 -0
- package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs.map +1 -0
- package/dist/esm/deepTransformPlugins/getReplacedValuesContent.mjs +60 -0
- package/dist/esm/deepTransformPlugins/getReplacedValuesContent.mjs.map +1 -0
- package/dist/esm/deepTransformPlugins/index.mjs +10 -0
- package/dist/esm/deepTransformPlugins/insertContentInDictionary.mjs +105 -0
- package/dist/esm/deepTransformPlugins/insertContentInDictionary.mjs.map +1 -0
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +57 -67
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +11 -15
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs +46 -70
- package/dist/esm/dictionaryManipulator/getDefaultNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs +22 -44
- package/dist/esm/dictionaryManipulator/getEmptyNode.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs +19 -32
- package/dist/esm/dictionaryManipulator/getNodeChildren.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getNodeType.mjs +31 -26
- package/dist/esm/dictionaryManipulator/getNodeType.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/getUnmergedDictionaryByKeyPath.mjs +14 -15
- package/dist/esm/dictionaryManipulator/getUnmergedDictionaryByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/index.mjs +15 -11
- package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs +66 -0
- package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs.map +1 -0
- package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs +29 -0
- package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs.map +1 -0
- package/dist/esm/dictionaryManipulator/orderDictionaries.mjs +46 -0
- package/dist/esm/dictionaryManipulator/orderDictionaries.mjs.map +1 -0
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs +27 -30
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +35 -39
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -1
- package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs +34 -52
- package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs.map +1 -1
- package/dist/esm/formatters/compact.mjs +21 -11
- package/dist/esm/formatters/compact.mjs.map +1 -1
- package/dist/esm/formatters/currency.mjs +25 -15
- package/dist/esm/formatters/currency.mjs.map +1 -1
- package/dist/esm/formatters/date.mjs +53 -44
- package/dist/esm/formatters/date.mjs.map +1 -1
- package/dist/esm/formatters/index.mjs +10 -9
- package/dist/esm/formatters/list.mjs +26 -12
- package/dist/esm/formatters/list.mjs.map +1 -1
- package/dist/esm/formatters/number.mjs +14 -8
- package/dist/esm/formatters/number.mjs.map +1 -1
- package/dist/esm/formatters/percentage.mjs +19 -16
- package/dist/esm/formatters/percentage.mjs.map +1 -1
- package/dist/esm/formatters/relativeTime.mjs +25 -35
- package/dist/esm/formatters/relativeTime.mjs.map +1 -1
- package/dist/esm/formatters/units.mjs +19 -13
- package/dist/esm/formatters/units.mjs.map +1 -1
- package/dist/esm/getStorageAttributes.mjs +114 -0
- package/dist/esm/getStorageAttributes.mjs.map +1 -0
- package/dist/esm/index.mjs +67 -13
- package/dist/esm/interpreter/getCondition.mjs +29 -6
- package/dist/esm/interpreter/getCondition.mjs.map +1 -1
- package/dist/esm/interpreter/getContent/deepTransform.mjs +36 -39
- package/dist/esm/interpreter/getContent/deepTransform.mjs.map +1 -1
- package/dist/esm/interpreter/getContent/getContent.mjs +28 -26
- package/dist/esm/interpreter/getContent/getContent.mjs.map +1 -1
- package/dist/esm/interpreter/getContent/index.mjs +5 -4
- package/dist/esm/interpreter/getContent/plugins.mjs +121 -139
- package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -1
- package/dist/esm/interpreter/getDictionary.mjs +20 -14
- package/dist/esm/interpreter/getDictionary.mjs.map +1 -1
- package/dist/esm/interpreter/getEnumeration.mjs +67 -17
- package/dist/esm/interpreter/getEnumeration.mjs.map +1 -1
- package/dist/esm/interpreter/getGender.mjs +32 -10
- package/dist/esm/interpreter/getGender.mjs.map +1 -1
- package/dist/esm/interpreter/getInsertion.mjs +17 -3
- package/dist/esm/interpreter/getInsertion.mjs.map +1 -1
- package/dist/esm/interpreter/getIntlayer.mjs +10 -13
- package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
- package/dist/esm/interpreter/getNesting.mjs +25 -16
- package/dist/esm/interpreter/getNesting.mjs.map +1 -1
- package/dist/esm/interpreter/getTranslation.mjs +28 -8
- package/dist/esm/interpreter/getTranslation.mjs.map +1 -1
- package/dist/esm/interpreter/index.mjs +11 -10
- package/dist/esm/localization/getBrowserLocale.mjs +139 -0
- package/dist/esm/localization/getBrowserLocale.mjs.map +1 -0
- package/dist/esm/localization/getHTMLTextDir.mjs +47 -231
- package/dist/esm/localization/getHTMLTextDir.mjs.map +1 -1
- package/dist/esm/localization/getLocaleFromPath.mjs +36 -21
- package/dist/esm/localization/getLocaleFromPath.mjs.map +1 -1
- package/dist/esm/localization/getLocaleLang.mjs +17 -3
- package/dist/esm/localization/getLocaleLang.mjs.map +1 -1
- package/dist/esm/localization/getLocaleName.mjs +7 -8
- package/dist/esm/localization/getLocaleName.mjs.map +1 -1
- package/dist/esm/localization/getLocalizedUrl.mjs +43 -12
- package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -1
- package/dist/esm/localization/getMultilingualUrls.mjs +65 -29
- package/dist/esm/localization/getMultilingualUrls.mjs.map +1 -1
- package/dist/esm/localization/getPathWithoutLocale.mjs +50 -26
- package/dist/esm/localization/getPathWithoutLocale.mjs.map +1 -1
- package/dist/esm/localization/index.mjs +7 -21
- package/dist/esm/localization/localeDetector.mjs +109 -6
- package/dist/esm/localization/localeDetector.mjs.map +1 -1
- package/dist/esm/localization/localeMapper.mjs +112 -35
- package/dist/esm/localization/localeMapper.mjs.map +1 -1
- package/dist/esm/localization/localeResolver.mjs +23 -26
- package/dist/esm/localization/localeResolver.mjs.map +1 -1
- package/dist/esm/transpiler/condition/condition.mjs +23 -7
- package/dist/esm/transpiler/condition/condition.mjs.map +1 -1
- package/dist/esm/transpiler/condition/index.mjs +3 -2
- package/dist/esm/transpiler/enumeration/enumeration.mjs +25 -7
- package/dist/esm/transpiler/enumeration/enumeration.mjs.map +1 -1
- package/dist/esm/transpiler/enumeration/index.mjs +3 -2
- package/dist/esm/transpiler/file/file.mjs +46 -40
- package/dist/esm/transpiler/file/file.mjs.map +1 -1
- package/dist/esm/transpiler/file/fileBrowser.mjs +22 -9
- package/dist/esm/transpiler/file/fileBrowser.mjs.map +1 -1
- package/dist/esm/transpiler/file/index.mjs +3 -2
- package/dist/esm/transpiler/gender/gender.mjs +23 -7
- package/dist/esm/transpiler/gender/gender.mjs.map +1 -1
- package/dist/esm/transpiler/gender/index.mjs +3 -2
- package/dist/esm/transpiler/index.mjs +11 -8
- package/dist/esm/transpiler/insertion/getInsertionValues.mjs +7 -7
- package/dist/esm/transpiler/insertion/getInsertionValues.mjs.map +1 -1
- package/dist/esm/transpiler/insertion/index.mjs +4 -3
- package/dist/esm/transpiler/insertion/insertion.mjs +31 -29
- package/dist/esm/transpiler/insertion/insertion.mjs.map +1 -1
- package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs +52 -61
- package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs.map +1 -1
- package/dist/esm/transpiler/markdown/index.mjs +4 -3
- package/dist/esm/transpiler/markdown/markdown.mjs +29 -29
- package/dist/esm/transpiler/markdown/markdown.mjs.map +1 -1
- package/dist/esm/transpiler/nesting/index.mjs +3 -2
- package/dist/esm/transpiler/nesting/nesting.mjs +23 -9
- package/dist/esm/transpiler/nesting/nesting.mjs.map +1 -1
- package/dist/esm/transpiler/translation/index.mjs +3 -2
- package/dist/esm/transpiler/translation/translation.mjs +26 -7
- package/dist/esm/transpiler/translation/translation.mjs.map +1 -1
- package/dist/esm/utils/checkIsURLAbsolute.mjs +4 -3
- package/dist/esm/utils/checkIsURLAbsolute.mjs.map +1 -1
- package/dist/esm/utils/intl.mjs +44 -49
- package/dist/esm/utils/intl.mjs.map +1 -1
- package/dist/esm/utils/isSameKeyPath.mjs +5 -6
- package/dist/esm/utils/isSameKeyPath.mjs.map +1 -1
- package/dist/esm/utils/isValidReactElement.mjs +11 -3
- package/dist/esm/utils/isValidReactElement.mjs.map +1 -1
- package/dist/esm/utils/localeStorage.mjs +139 -0
- package/dist/esm/utils/localeStorage.mjs.map +1 -0
- package/dist/esm/utils/parseYaml.mjs +184 -31
- package/dist/esm/utils/parseYaml.mjs.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +46 -0
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -0
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +38 -0
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -0
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +30 -0
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -0
- package/dist/types/deepTransformPlugins/getLocalizedContent.d.ts +18 -0
- package/dist/types/deepTransformPlugins/getLocalizedContent.d.ts.map +1 -0
- package/dist/types/deepTransformPlugins/getMaskContent.d.ts +10 -0
- package/dist/types/deepTransformPlugins/getMaskContent.d.ts.map +1 -0
- package/dist/types/deepTransformPlugins/getMissingLocalesContent.d.ts +16 -0
- package/dist/types/deepTransformPlugins/getMissingLocalesContent.d.ts.map +1 -0
- package/dist/types/deepTransformPlugins/getReplacedValuesContent.d.ts +8 -0
- package/dist/types/deepTransformPlugins/getReplacedValuesContent.d.ts.map +1 -0
- package/dist/types/deepTransformPlugins/index.d.ts +9 -0
- package/dist/types/deepTransformPlugins/insertContentInDictionary.d.ts +25 -0
- package/dist/types/deepTransformPlugins/insertContentInDictionary.d.ts.map +1 -0
- package/dist/types/dictionaryManipulator/editDictionaryByKeyPath.d.ts +6 -3
- package/dist/types/dictionaryManipulator/editDictionaryByKeyPath.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts +6 -3
- package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getDefaultNode.d.ts +6 -3
- package/dist/types/dictionaryManipulator/getDefaultNode.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getEmptyNode.d.ts +6 -2
- package/dist/types/dictionaryManipulator/getEmptyNode.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getNodeChildren.d.ts +6 -2
- package/dist/types/dictionaryManipulator/getNodeChildren.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getNodeType.d.ts +6 -3
- package/dist/types/dictionaryManipulator/getNodeType.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/getUnmergedDictionaryByKeyPath.d.ts +8 -3
- package/dist/types/dictionaryManipulator/getUnmergedDictionaryByKeyPath.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/index.d.ts +14 -11
- package/dist/types/dictionaryManipulator/mergeDictionaries.d.ts +7 -0
- package/dist/types/dictionaryManipulator/mergeDictionaries.d.ts.map +1 -0
- package/dist/types/dictionaryManipulator/normalizeDictionary.d.ts +8 -0
- package/dist/types/dictionaryManipulator/normalizeDictionary.d.ts.map +1 -0
- package/dist/types/dictionaryManipulator/orderDictionaries.d.ts +16 -0
- package/dist/types/dictionaryManipulator/orderDictionaries.d.ts.map +1 -0
- package/dist/types/dictionaryManipulator/removeContentNodeByKeyPath.d.ts +6 -3
- package/dist/types/dictionaryManipulator/removeContentNodeByKeyPath.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/renameContentNodeByKeyPath.d.ts +6 -3
- package/dist/types/dictionaryManipulator/renameContentNodeByKeyPath.d.ts.map +1 -1
- package/dist/types/dictionaryManipulator/updateNodeChildren.d.ts +6 -2
- package/dist/types/dictionaryManipulator/updateNodeChildren.d.ts.map +1 -1
- package/dist/types/formatters/compact.d.ts +8 -3
- package/dist/types/formatters/compact.d.ts.map +1 -1
- package/dist/types/formatters/currency.d.ts +8 -3
- package/dist/types/formatters/currency.d.ts.map +1 -1
- package/dist/types/formatters/date.d.ts +8 -3
- package/dist/types/formatters/date.d.ts.map +1 -1
- package/dist/types/formatters/index.d.ts +9 -9
- package/dist/types/formatters/list.d.ts +8 -3
- package/dist/types/formatters/list.d.ts.map +1 -1
- package/dist/types/formatters/number.d.ts +8 -3
- package/dist/types/formatters/number.d.ts.map +1 -1
- package/dist/types/formatters/percentage.d.ts +8 -3
- package/dist/types/formatters/percentage.d.ts.map +1 -1
- package/dist/types/formatters/relativeTime.d.ts +8 -5
- package/dist/types/formatters/relativeTime.d.ts.map +1 -1
- package/dist/types/formatters/units.d.ts +8 -3
- package/dist/types/formatters/units.d.ts.map +1 -1
- package/dist/types/getStorageAttributes.d.ts +25 -0
- package/dist/types/getStorageAttributes.d.ts.map +1 -0
- package/dist/types/index.d.ts +67 -13
- package/dist/types/interpreter/getCondition.d.ts +7 -2
- package/dist/types/interpreter/getCondition.d.ts.map +1 -1
- package/dist/types/interpreter/getContent/deepTransform.d.ts +7 -2
- package/dist/types/interpreter/getContent/deepTransform.d.ts.map +1 -1
- package/dist/types/interpreter/getContent/getContent.d.ts +8 -4
- package/dist/types/interpreter/getContent/getContent.d.ts.map +1 -1
- package/dist/types/interpreter/getContent/index.d.ts +4 -4
- package/dist/types/interpreter/getContent/plugins.d.ts +68 -66
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
- package/dist/types/interpreter/getDictionary.d.ts +8 -4
- package/dist/types/interpreter/getDictionary.d.ts.map +1 -1
- package/dist/types/interpreter/getEnumeration.d.ts +8 -3
- package/dist/types/interpreter/getEnumeration.d.ts.map +1 -1
- package/dist/types/interpreter/getGender.d.ts +7 -4
- package/dist/types/interpreter/getGender.d.ts.map +1 -1
- package/dist/types/interpreter/getInsertion.d.ts +7 -2
- package/dist/types/interpreter/getInsertion.d.ts.map +1 -1
- package/dist/types/interpreter/getIntlayer.d.ts +7 -5
- package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
- package/dist/types/interpreter/getNesting.d.ts +9 -6
- package/dist/types/interpreter/getNesting.d.ts.map +1 -1
- package/dist/types/interpreter/getTranslation.d.ts +7 -3
- package/dist/types/interpreter/getTranslation.d.ts.map +1 -1
- package/dist/types/interpreter/index.d.ts +10 -10
- package/dist/types/localization/getBrowserLocale.d.ts +35 -0
- package/dist/types/localization/getBrowserLocale.d.ts.map +1 -0
- package/dist/types/localization/getHTMLTextDir.d.ts +6 -3
- package/dist/types/localization/getHTMLTextDir.d.ts.map +1 -1
- package/dist/types/localization/getLocaleFromPath.d.ts +7 -2
- package/dist/types/localization/getLocaleFromPath.d.ts.map +1 -1
- package/dist/types/localization/getLocaleLang.d.ts +7 -2
- package/dist/types/localization/getLocaleLang.d.ts.map +1 -1
- package/dist/types/localization/getLocaleName.d.ts +6 -2
- package/dist/types/localization/getLocaleName.d.ts.map +1 -1
- package/dist/types/localization/getLocalizedUrl.d.ts +30 -17
- package/dist/types/localization/getLocalizedUrl.d.ts.map +1 -1
- package/dist/types/localization/getMultilingualUrls.d.ts +28 -12
- package/dist/types/localization/getMultilingualUrls.d.ts.map +1 -1
- package/dist/types/localization/getPathWithoutLocale.d.ts +11 -3
- package/dist/types/localization/getPathWithoutLocale.d.ts.map +1 -1
- package/dist/types/localization/index.d.ts +12 -12
- package/dist/types/localization/localeDetector.d.ts +7 -2
- package/dist/types/localization/localeDetector.d.ts.map +1 -1
- package/dist/types/localization/localeMapper.d.ts +23 -19
- package/dist/types/localization/localeMapper.d.ts.map +1 -1
- package/dist/types/localization/localeResolver.d.ts +7 -2
- package/dist/types/localization/localeResolver.d.ts.map +1 -1
- package/dist/types/transpiler/condition/condition.d.ts +8 -5
- package/dist/types/transpiler/condition/condition.d.ts.map +1 -1
- package/dist/types/transpiler/condition/index.d.ts +2 -2
- package/dist/types/transpiler/enumeration/enumeration.d.ts +9 -6
- package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -1
- package/dist/types/transpiler/enumeration/index.d.ts +2 -2
- package/dist/types/transpiler/file/file.d.ts +11 -6
- package/dist/types/transpiler/file/file.d.ts.map +1 -1
- package/dist/types/transpiler/file/fileBrowser.d.ts +7 -2
- package/dist/types/transpiler/file/fileBrowser.d.ts.map +1 -1
- package/dist/types/transpiler/file/index.d.ts +2 -2
- package/dist/types/transpiler/gender/gender.d.ts +9 -6
- package/dist/types/transpiler/gender/gender.d.ts.map +1 -1
- package/dist/types/transpiler/gender/index.d.ts +2 -2
- package/dist/types/transpiler/index.d.ts +11 -9
- package/dist/types/transpiler/insertion/getInsertionValues.d.ts +4 -1
- package/dist/types/transpiler/insertion/getInsertionValues.d.ts.map +1 -1
- package/dist/types/transpiler/insertion/index.d.ts +3 -3
- package/dist/types/transpiler/insertion/insertion.d.ts +8 -5
- package/dist/types/transpiler/insertion/insertion.d.ts.map +1 -1
- package/dist/types/transpiler/markdown/getMarkdownMetadata.d.ts +4 -1
- package/dist/types/transpiler/markdown/getMarkdownMetadata.d.ts.map +1 -1
- package/dist/types/transpiler/markdown/index.d.ts +3 -3
- package/dist/types/transpiler/markdown/markdown.d.ts +8 -5
- package/dist/types/transpiler/markdown/markdown.d.ts.map +1 -1
- package/dist/types/transpiler/nesting/index.d.ts +2 -2
- package/dist/types/transpiler/nesting/nesting.d.ts +24 -25
- package/dist/types/transpiler/nesting/nesting.d.ts.map +1 -1
- package/dist/types/transpiler/translation/index.d.ts +2 -2
- package/dist/types/transpiler/translation/translation.d.ts +9 -6
- package/dist/types/transpiler/translation/translation.d.ts.map +1 -1
- package/dist/types/utils/checkIsURLAbsolute.d.ts +4 -1
- package/dist/types/utils/checkIsURLAbsolute.d.ts.map +1 -1
- package/dist/types/utils/intl.d.ts +9 -10
- package/dist/types/utils/intl.d.ts.map +1 -1
- package/dist/types/utils/isSameKeyPath.d.ts +6 -2
- package/dist/types/utils/isSameKeyPath.d.ts.map +1 -1
- package/dist/types/utils/isValidReactElement.d.ts +4 -1
- package/dist/types/utils/isValidReactElement.d.ts.map +1 -1
- package/dist/types/utils/localeStorage.d.ts +105 -0
- package/dist/types/utils/localeStorage.d.ts.map +1 -0
- package/dist/types/utils/parseYaml.d.ts +4 -1
- package/dist/types/utils/parseYaml.d.ts.map +1 -1
- package/package.json +36 -121
- package/LICENSE +0 -202
- package/dist/cjs/deepTranformPlugins/getFilterTranslationsOnlyContent.cjs +0 -130
- package/dist/cjs/deepTranformPlugins/getFilterTranslationsOnlyContent.cjs.map +0 -1
- package/dist/cjs/deepTranformPlugins/getFilteredLocalesContent.cjs +0 -62
- package/dist/cjs/deepTranformPlugins/getFilteredLocalesContent.cjs.map +0 -1
- package/dist/cjs/deepTranformPlugins/getLocalisedContent.cjs +0 -51
- package/dist/cjs/deepTranformPlugins/getLocalisedContent.cjs.map +0 -1
- package/dist/cjs/deepTranformPlugins/getMaskContent.cjs +0 -49
- package/dist/cjs/deepTranformPlugins/getMaskContent.cjs.map +0 -1
- package/dist/cjs/deepTranformPlugins/getMissingLocalesContent.cjs +0 -78
- package/dist/cjs/deepTranformPlugins/getMissingLocalesContent.cjs.map +0 -1
- package/dist/cjs/deepTranformPlugins/getReplacedValuesContent.cjs +0 -82
- package/dist/cjs/deepTranformPlugins/getReplacedValuesContent.cjs.map +0 -1
- package/dist/cjs/deepTranformPlugins/index.cjs +0 -33
- package/dist/cjs/deepTranformPlugins/index.cjs.map +0 -1
- package/dist/cjs/dictionaryManipulator/index.cjs.map +0 -1
- package/dist/cjs/formatters/index.cjs.map +0 -1
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/interpreter/getContent/index.cjs.map +0 -1
- package/dist/cjs/interpreter/getIntlayerAsync.cjs +0 -37
- package/dist/cjs/interpreter/getIntlayerAsync.cjs.map +0 -1
- package/dist/cjs/interpreter/index.cjs.map +0 -1
- package/dist/cjs/localization/index.cjs.map +0 -1
- package/dist/cjs/localization/localeList.cjs +0 -256
- package/dist/cjs/localization/localeList.cjs.map +0 -1
- package/dist/cjs/transpiler/condition/index.cjs.map +0 -1
- package/dist/cjs/transpiler/enumeration/index.cjs.map +0 -1
- package/dist/cjs/transpiler/file/index.cjs.map +0 -1
- package/dist/cjs/transpiler/gender/index.cjs.map +0 -1
- package/dist/cjs/transpiler/index.cjs.map +0 -1
- package/dist/cjs/transpiler/insertion/index.cjs.map +0 -1
- package/dist/cjs/transpiler/markdown/index.cjs.map +0 -1
- package/dist/cjs/transpiler/nesting/index.cjs.map +0 -1
- package/dist/cjs/transpiler/translation/index.cjs.map +0 -1
- package/dist/cjs/types/dictionary.cjs +0 -17
- package/dist/cjs/types/dictionary.cjs.map +0 -1
- package/dist/cjs/types/index.cjs +0 -29
- package/dist/cjs/types/index.cjs.map +0 -1
- package/dist/cjs/types/intlayer.cjs +0 -35
- package/dist/cjs/types/intlayer.cjs.map +0 -1
- package/dist/cjs/types/keyPath.cjs +0 -17
- package/dist/cjs/types/keyPath.cjs.map +0 -1
- package/dist/cjs/types/nodeType.cjs +0 -53
- package/dist/cjs/types/nodeType.cjs.map +0 -1
- package/dist/cjs/types/translation.cjs +0 -17
- package/dist/cjs/types/translation.cjs.map +0 -1
- package/dist/esm/deepTranformPlugins/getFilterTranslationsOnlyContent.mjs +0 -95
- package/dist/esm/deepTranformPlugins/getFilterTranslationsOnlyContent.mjs.map +0 -1
- package/dist/esm/deepTranformPlugins/getFilteredLocalesContent.mjs +0 -40
- package/dist/esm/deepTranformPlugins/getFilteredLocalesContent.mjs.map +0 -1
- package/dist/esm/deepTranformPlugins/getLocalisedContent.mjs +0 -19
- package/dist/esm/deepTranformPlugins/getLocalisedContent.mjs.map +0 -1
- package/dist/esm/deepTranformPlugins/getMaskContent.mjs +0 -24
- package/dist/esm/deepTranformPlugins/getMaskContent.mjs.map +0 -1
- package/dist/esm/deepTranformPlugins/getMissingLocalesContent.mjs +0 -43
- package/dist/esm/deepTranformPlugins/getMissingLocalesContent.mjs.map +0 -1
- package/dist/esm/deepTranformPlugins/getReplacedValuesContent.mjs +0 -60
- package/dist/esm/deepTranformPlugins/getReplacedValuesContent.mjs.map +0 -1
- package/dist/esm/deepTranformPlugins/index.mjs +0 -7
- package/dist/esm/deepTranformPlugins/index.mjs.map +0 -1
- package/dist/esm/dictionaryManipulator/index.mjs.map +0 -1
- package/dist/esm/formatters/index.mjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/interpreter/getContent/index.mjs.map +0 -1
- package/dist/esm/interpreter/getIntlayerAsync.mjs +0 -13
- package/dist/esm/interpreter/getIntlayerAsync.mjs.map +0 -1
- package/dist/esm/interpreter/index.mjs.map +0 -1
- package/dist/esm/localization/index.mjs.map +0 -1
- package/dist/esm/localization/localeList.mjs +0 -232
- package/dist/esm/localization/localeList.mjs.map +0 -1
- package/dist/esm/transpiler/condition/index.mjs.map +0 -1
- package/dist/esm/transpiler/enumeration/index.mjs.map +0 -1
- package/dist/esm/transpiler/file/index.mjs.map +0 -1
- package/dist/esm/transpiler/gender/index.mjs.map +0 -1
- package/dist/esm/transpiler/index.mjs.map +0 -1
- package/dist/esm/transpiler/insertion/index.mjs.map +0 -1
- package/dist/esm/transpiler/markdown/index.mjs.map +0 -1
- package/dist/esm/transpiler/nesting/index.mjs.map +0 -1
- package/dist/esm/transpiler/translation/index.mjs.map +0 -1
- package/dist/esm/types/dictionary.mjs +0 -1
- package/dist/esm/types/dictionary.mjs.map +0 -1
- package/dist/esm/types/index.mjs +0 -5
- package/dist/esm/types/index.mjs.map +0 -1
- package/dist/esm/types/intlayer.mjs +0 -13
- package/dist/esm/types/intlayer.mjs.map +0 -1
- package/dist/esm/types/keyPath.mjs +0 -1
- package/dist/esm/types/keyPath.mjs.map +0 -1
- package/dist/esm/types/nodeType.mjs +0 -28
- package/dist/esm/types/nodeType.mjs.map +0 -1
- package/dist/esm/types/translation.mjs +0 -1
- package/dist/esm/types/translation.mjs.map +0 -1
- package/dist/types/deepTranformPlugins/getFilterTranslationsOnlyContent.d.ts +0 -13
- package/dist/types/deepTranformPlugins/getFilterTranslationsOnlyContent.d.ts.map +0 -1
- package/dist/types/deepTranformPlugins/getFilteredLocalesContent.d.ts +0 -5
- package/dist/types/deepTranformPlugins/getFilteredLocalesContent.d.ts.map +0 -1
- package/dist/types/deepTranformPlugins/getLocalisedContent.d.ts +0 -13
- package/dist/types/deepTranformPlugins/getLocalisedContent.d.ts.map +0 -1
- package/dist/types/deepTranformPlugins/getMaskContent.d.ts +0 -6
- package/dist/types/deepTranformPlugins/getMaskContent.d.ts.map +0 -1
- package/dist/types/deepTranformPlugins/getMissingLocalesContent.d.ts +0 -13
- package/dist/types/deepTranformPlugins/getMissingLocalesContent.d.ts.map +0 -1
- package/dist/types/deepTranformPlugins/getReplacedValuesContent.d.ts +0 -4
- package/dist/types/deepTranformPlugins/getReplacedValuesContent.d.ts.map +0 -1
- package/dist/types/deepTranformPlugins/index.d.ts +0 -7
- package/dist/types/deepTranformPlugins/index.d.ts.map +0 -1
- package/dist/types/dictionaryManipulator/index.d.ts.map +0 -1
- package/dist/types/formatters/index.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/interpreter/getContent/index.d.ts.map +0 -1
- package/dist/types/interpreter/getIntlayerAsync.d.ts +0 -13
- package/dist/types/interpreter/getIntlayerAsync.d.ts.map +0 -1
- package/dist/types/interpreter/index.d.ts.map +0 -1
- package/dist/types/localization/index.d.ts.map +0 -1
- package/dist/types/localization/localeList.d.ts +0 -3
- package/dist/types/localization/localeList.d.ts.map +0 -1
- package/dist/types/transpiler/condition/index.d.ts.map +0 -1
- package/dist/types/transpiler/enumeration/index.d.ts.map +0 -1
- package/dist/types/transpiler/file/index.d.ts.map +0 -1
- package/dist/types/transpiler/gender/index.d.ts.map +0 -1
- package/dist/types/transpiler/index.d.ts.map +0 -1
- package/dist/types/transpiler/insertion/index.d.ts.map +0 -1
- package/dist/types/transpiler/markdown/index.d.ts.map +0 -1
- package/dist/types/transpiler/nesting/index.d.ts.map +0 -1
- package/dist/types/transpiler/translation/index.d.ts.map +0 -1
- package/dist/types/types/dictionary.d.ts +0 -307
- package/dist/types/types/dictionary.d.ts.map +0 -1
- package/dist/types/types/index.d.ts +0 -5
- package/dist/types/types/index.d.ts.map +0 -1
- package/dist/types/types/intlayer.d.ts +0 -5
- package/dist/types/types/intlayer.d.ts.map +0 -1
- package/dist/types/types/keyPath.d.ts +0 -47
- package/dist/types/types/keyPath.d.ts.map +0 -1
- package/dist/types/types/nodeType.d.ts +0 -30
- package/dist/types/types/nodeType.d.ts.map +0 -1
- package/dist/types/types/translation.d.ts +0 -25
- package/dist/types/types/translation.d.ts.map +0 -1
|
@@ -1,42 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var getDictionary_exports = {};
|
|
20
|
-
__export(getDictionary_exports, {
|
|
21
|
-
getDictionary: () => getDictionary
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getDictionary_exports);
|
|
24
|
-
var import_getContent = require('./getContent/getContent.cjs');
|
|
1
|
+
const require_interpreter_getContent_getContent = require('./getContent/getContent.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/interpreter/getDictionary.ts
|
|
4
|
+
/**
|
|
5
|
+
* Transforms a dictionary in a single pass, applying each plugin as needed.
|
|
6
|
+
*
|
|
7
|
+
* @param dictionary The dictionary to transform.
|
|
8
|
+
* @param locale The locale to use if your transformers need it (e.g. for translations).
|
|
9
|
+
* @param additionalPlugins An array of NodeTransformer that define how to transform recognized nodes.
|
|
10
|
+
* If omitted, we’ll use a default set of plugins.
|
|
11
|
+
*/
|
|
25
12
|
const getDictionary = (dictionary, locale, plugins) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
dictionary.content,
|
|
34
|
-
props,
|
|
35
|
-
locale
|
|
36
|
-
);
|
|
13
|
+
const props = {
|
|
14
|
+
dictionaryKey: dictionary.key,
|
|
15
|
+
dictionaryPath: dictionary.filePath,
|
|
16
|
+
keyPath: [],
|
|
17
|
+
plugins
|
|
18
|
+
};
|
|
19
|
+
return require_interpreter_getContent_getContent.getContent(dictionary.content, props, locale);
|
|
37
20
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.getDictionary = getDictionary;
|
|
42
24
|
//# sourceMappingURL=getDictionary.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/interpreter/getDictionary.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"getDictionary.cjs","names":["props: NodeProps","getContent"],"sources":["../../../src/interpreter/getDictionary.ts"],"sourcesContent":["import type {\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n} from '@intlayer/types';\nimport type {\n DeepTransformContent,\n IInterpreterPluginState,\n NodeProps,\n Plugins,\n} from './getContent';\nimport { getContent } from './getContent/getContent';\n\n/**\n * Transforms a dictionary in a single pass, applying each plugin as needed.\n *\n * @param dictionary The dictionary to transform.\n * @param locale The locale to use if your transformers need it (e.g. for translations).\n * @param additionalPlugins An array of NodeTransformer that define how to transform recognized nodes.\n * If omitted, we’ll use a default set of plugins.\n */\nexport const getDictionary = <\n T extends Dictionary,\n L extends LocalesValues = DeclaredLocales,\n>(\n dictionary: T,\n locale?: L,\n plugins?: Plugins[]\n): DeepTransformContent<T['content'], IInterpreterPluginState, L> => {\n const props: NodeProps = {\n dictionaryKey: dictionary.key,\n dictionaryPath: dictionary.filePath,\n keyPath: [],\n plugins,\n };\n\n return getContent(dictionary.content, props, locale);\n};\n"],"mappings":";;;;;;;;;;;AAqBA,MAAa,iBAIX,YACA,QACA,YACmE;CACnE,MAAMA,QAAmB;EACvB,eAAe,WAAW;EAC1B,gBAAgB,WAAW;EAC3B,SAAS,EAAE;EACX;EACD;AAED,QAAOC,qDAAW,WAAW,SAAS,OAAO,OAAO"}
|
|
@@ -1,47 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/interpreter/getEnumeration.ts
|
|
3
|
+
/**
|
|
4
|
+
* Find the matching condition for a quantity.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const key = findMatchingCondition({
|
|
10
|
+
* '<=-2.3': 'You have less than -2.3',
|
|
11
|
+
* '<1': 'You have less than one',
|
|
12
|
+
* '2': 'You have two',
|
|
13
|
+
* '>=3': 'You have three or more',
|
|
14
|
+
* }, 2);
|
|
15
|
+
* // '2'
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* The order of the keys will define the priority of the content.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* const key = findMatchingCondition({
|
|
22
|
+
* '<4': 'You have less than four',
|
|
23
|
+
* '2': 'You have two',
|
|
24
|
+
* }, 2);
|
|
25
|
+
* // '<4'
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* If no keys match, the default key is '1'.
|
|
29
|
+
*/
|
|
25
30
|
const findMatchingCondition = (enumerationContent, quantity) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
}
|
|
31
|
+
const numericKeys = Object.keys(enumerationContent);
|
|
32
|
+
for (const key of numericKeys) {
|
|
33
|
+
const isEqual = !key.startsWith(">") && !key.startsWith("<") && !key.startsWith("=") && parseFloat(key) === quantity || key.startsWith("=") && parseFloat(key.slice(1)) === quantity;
|
|
34
|
+
const isSuperior = key.startsWith(">") && quantity > parseFloat(key.slice(1));
|
|
35
|
+
const isSuperiorOrEqual = key.startsWith(">=") && quantity >= parseFloat(key.slice(2));
|
|
36
|
+
const isInferior = key.startsWith("<") && quantity < parseFloat(key.slice(1));
|
|
37
|
+
const isInferiorOrEqual = key.startsWith("<=") && quantity <= parseFloat(key.slice(2));
|
|
38
|
+
if (isEqual || isSuperior || isSuperiorOrEqual || isInferior || isInferiorOrEqual) return key;
|
|
39
|
+
}
|
|
37
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Allow to pick a content based on a quantity.
|
|
43
|
+
*
|
|
44
|
+
* Usage:
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* const content = getEnumeration({
|
|
48
|
+
* '<=-2.3': 'You have less than -2.3',
|
|
49
|
+
* '<1': 'You have less than one',
|
|
50
|
+
* '2': 'You have two',
|
|
51
|
+
* '>=3': 'You have three or more',
|
|
52
|
+
* }, 2);
|
|
53
|
+
* // 'You have two'
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* The order of the keys will define the priority of the content.
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* const content = getEnumeration({
|
|
60
|
+
* '<4': 'You have less than four',
|
|
61
|
+
* '2': 'You have two',
|
|
62
|
+
* }, 2);
|
|
63
|
+
* // 'You have less than four'
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
*/
|
|
38
67
|
const getEnumeration = (enumerationContent, quantity) => {
|
|
39
|
-
|
|
40
|
-
return enumerationContent[key];
|
|
68
|
+
return enumerationContent[findMatchingCondition(enumerationContent, quantity) ?? "fallback"];
|
|
41
69
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
exports.findMatchingCondition = findMatchingCondition;
|
|
73
|
+
exports.getEnumeration = getEnumeration;
|
|
47
74
|
//# sourceMappingURL=getEnumeration.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/interpreter/getEnumeration.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"getEnumeration.cjs","names":[],"sources":["../../../src/interpreter/getEnumeration.ts"],"sourcesContent":["import type { EnterFormat, EnumerationContentState } from '../transpiler';\n\n/**\n * Find the matching condition for a quantity.\n *\n * Usage:\n *\n * ```ts\n * const key = findMatchingCondition({\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 * }, 2);\n * // '2'\n * ```\n *\n * The order of the keys will define the priority of the content.\n *\n * ```ts\n * const key = findMatchingCondition({\n * '<4': 'You have less than four',\n * '2': 'You have two',\n * }, 2);\n * // '<4'\n * ```\n *\n * If no keys match, the default key is '1'.\n */\nexport const findMatchingCondition = <Content>(\n enumerationContent: EnumerationContentState<Content>,\n quantity: number\n): EnterFormat => {\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 key as EnterFormat;\n }\n }\n};\n\n/**\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * const content = getEnumeration({\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 * }, 2);\n * // 'You have two'\n * ```\n *\n * The order of the keys will define the priority of the content.\n *\n * ```ts\n * const content = getEnumeration({\n * '<4': 'You have less than four',\n * '2': 'You have two',\n * }, 2);\n * // 'You have less than four'\n * ```\n *\n */\nexport const getEnumeration = <Content>(\n enumerationContent: EnumerationContentState<Content>,\n quantity: number\n): Content => {\n const key =\n findMatchingCondition<Content>(enumerationContent, quantity) ?? 'fallback';\n\n // Default or error handling if no keys match\n return enumerationContent[key] as Content;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,yBACX,oBACA,aACgB;CAChB,MAAM,cAAc,OAAO,KAAK,mBAAmB;AAEnD,MAAK,MAAM,OAAO,aAAa;EAC7B,MAAM,UACH,CAAC,IAAI,WAAW,IAAI,IACnB,CAAC,IAAI,WAAW,IAAI,IACpB,CAAC,IAAI,WAAW,IAAI,IACpB,WAAW,IAAI,KAAK,YACrB,IAAI,WAAW,IAAI,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC,KAAK;EACvD,MAAM,aACJ,IAAI,WAAW,IAAI,IAAI,WAAW,WAAW,IAAI,MAAM,EAAE,CAAC;EAC5D,MAAM,oBACJ,IAAI,WAAW,KAAK,IAAI,YAAY,WAAW,IAAI,MAAM,EAAE,CAAC;EAC9D,MAAM,aACJ,IAAI,WAAW,IAAI,IAAI,WAAW,WAAW,IAAI,MAAM,EAAE,CAAC;EAC5D,MAAM,oBACJ,IAAI,WAAW,KAAK,IAAI,YAAY,WAAW,IAAI,MAAM,EAAE,CAAC;AAE9D,MACE,WACA,cACA,qBACA,cACA,kBAEA,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+Bb,MAAa,kBACX,oBACA,aACY;AAKZ,QAAO,mBAHL,sBAA+B,oBAAoB,SAAS,IAAI"}
|
|
@@ -1,39 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var getGender_exports = {};
|
|
20
|
-
__export(getGender_exports, {
|
|
21
|
-
getGender: () => getGender
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getGender_exports);
|
|
1
|
+
|
|
2
|
+
//#region src/interpreter/getGender.ts
|
|
24
3
|
const getGenderEntry = (gender) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
4
|
+
if (gender === "m" || gender === "male") return "male";
|
|
5
|
+
if (gender === "f" || gender === "female") return "female";
|
|
6
|
+
return "fallback";
|
|
28
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Allow to pick a content based on a gender.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* const content = getGender({
|
|
15
|
+
* 'true': 'The gender is validated',
|
|
16
|
+
* 'false': 'The gender is not validated',
|
|
17
|
+
* }, true);
|
|
18
|
+
* // 'The gender is validated'
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* The last key provided will be used as the fallback value.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* const content = getGender({
|
|
25
|
+
* 'false': 'The gender is not validated',
|
|
26
|
+
* 'true': 'The gender is validated',
|
|
27
|
+
* }, undefined);
|
|
28
|
+
* // 'The gender is validated'
|
|
29
|
+
*/
|
|
29
30
|
const getGender = (genderContent, gender) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return genderContent[genderEntry] ?? genderContent["fallback"] ?? genderContent[fallbackState];
|
|
31
|
+
const stateList = Object.keys(genderContent);
|
|
32
|
+
const fallbackState = stateList[stateList.length - 1];
|
|
33
|
+
return genderContent[getGenderEntry(gender)] ?? genderContent.fallback ?? genderContent[fallbackState];
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
});
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.getGender = getGender;
|
|
39
38
|
//# sourceMappingURL=getGender.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/interpreter/getGender.ts"],"sourcesContent":["import type { Gender, GenderContentStates } from '../transpiler
|
|
1
|
+
{"version":3,"file":"getGender.cjs","names":[],"sources":["../../../src/interpreter/getGender.ts"],"sourcesContent":["import type { Gender, GenderContentStates } from '../transpiler';\n\ntype GenderEntry = Gender | 'm' | 'f';\n\nconst getGenderEntry = (gender: GenderEntry): Gender => {\n if (gender === 'm' || gender === 'male') return 'male';\n if (gender === 'f' || gender === 'female') return 'female';\n return 'fallback';\n};\n\n/**\n * Allow to pick a content based on a gender.\n *\n * Usage:\n *\n * ```ts\n * const content = getGender({\n * 'true': 'The gender is validated',\n * 'false': 'The gender is not validated',\n * }, true);\n * // 'The gender is validated'\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n * ```ts\n * const content = getGender({\n * 'false': 'The gender is not validated',\n * 'true': 'The gender is validated',\n * }, undefined);\n * // 'The gender is validated'\n */\nexport const getGender = <Content>(\n genderContent: GenderContentStates<Content>,\n gender: GenderEntry\n): Content => {\n const stateList = Object.keys(genderContent);\n\n const fallbackState = stateList[\n stateList.length - 1\n ] as keyof typeof genderContent;\n\n const genderEntry = getGenderEntry(gender);\n\n // Default or error handling if no keys match\n return (\n genderContent[genderEntry as keyof typeof genderContent] ??\n genderContent.fallback ??\n (genderContent[fallbackState] as Content)\n );\n};\n"],"mappings":";;AAIA,MAAM,kBAAkB,WAAgC;AACtD,KAAI,WAAW,OAAO,WAAW,OAAQ,QAAO;AAChD,KAAI,WAAW,OAAO,WAAW,SAAU,QAAO;AAClD,QAAO;;;;;;;;;;;;;;;;;;;;;;;;AAyBT,MAAa,aACX,eACA,WACY;CACZ,MAAM,YAAY,OAAO,KAAK,cAAc;CAE5C,MAAM,gBAAgB,UACpB,UAAU,SAAS;AAMrB,QACE,cAJkB,eAAe,OAAO,KAKxC,cAAc,YACb,cAAc"}
|
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var getInsertion_exports = {};
|
|
20
|
-
__export(getInsertion_exports, {
|
|
21
|
-
getInsertion: () => getInsertion
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getInsertion_exports);
|
|
1
|
+
|
|
2
|
+
//#region src/interpreter/getInsertion.ts
|
|
3
|
+
/**
|
|
4
|
+
* Allow to insert values in a string.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* const content = getInsertion('Hello {{name}}!', {
|
|
10
|
+
* name: 'John',
|
|
11
|
+
* });
|
|
12
|
+
* // 'Hello John!'
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
24
16
|
const getInsertion = (content, values) => content.replace(/\{\{(.*?)\}\}/g, (_, key) => (values[key] ?? "").toString());
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.getInsertion = getInsertion;
|
|
29
20
|
//# sourceMappingURL=getInsertion.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/interpreter/getInsertion.ts"],"sourcesContent":["import type { InsertionContent } from '../transpiler';\n\n/**\n * Allow to insert values in a string.\n *\n * Usage:\n *\n * ```ts\n * const content = getInsertion('Hello {{name}}!', {\n * name: 'John',\n * });\n * // 'Hello John!'\n * ```\n *\n */\nexport const getInsertion = (\n content: string,\n values: { [K in InsertionContent['fields'][number]]: string | number }\n) =>\n content.replace(/\\{\\{(.*?)\\}\\}/g, (_, key) => (values[key] ?? '').toString());\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getInsertion.cjs","names":[],"sources":["../../../src/interpreter/getInsertion.ts"],"sourcesContent":["import type { InsertionContent } from '../transpiler';\n\n/**\n * Allow to insert values in a string.\n *\n * Usage:\n *\n * ```ts\n * const content = getInsertion('Hello {{name}}!', {\n * name: 'John',\n * });\n * // 'Hello John!'\n * ```\n *\n */\nexport const getInsertion = (\n content: string,\n values: { [K in InsertionContent['fields'][number]]: string | number }\n) =>\n content.replace(/\\{\\{(.*?)\\}\\}/g, (_, key) => (values[key] ?? '').toString());\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,gBACX,SACA,WAEA,QAAQ,QAAQ,mBAAmB,GAAG,SAAS,OAAO,QAAQ,IAAI,UAAU,CAAC"}
|
|
@@ -1,51 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var getIntlayer_exports = {};
|
|
30
|
-
__export(getIntlayer_exports, {
|
|
31
|
-
getIntlayer: () => getIntlayer
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(getIntlayer_exports);
|
|
34
|
-
var import_dictionaries_entry = __toESM(require("@intlayer/dictionaries-entry"));
|
|
35
|
-
var import_getDictionary = require('./getDictionary.cjs');
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_interpreter_getDictionary = require('./getDictionary.cjs');
|
|
3
|
+
let __intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
|
|
4
|
+
__intlayer_dictionaries_entry = require_rolldown_runtime.__toESM(__intlayer_dictionaries_entry);
|
|
5
|
+
|
|
6
|
+
//#region src/interpreter/getIntlayer.ts
|
|
36
7
|
const getIntlayer = (key, locale, plugins) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return (0, import_getDictionary.getDictionary)(
|
|
42
|
-
dictionary,
|
|
43
|
-
locale,
|
|
44
|
-
plugins
|
|
45
|
-
);
|
|
8
|
+
const dictionaries = (0, __intlayer_dictionaries_entry.getDictionaries)();
|
|
9
|
+
const dictionary = dictionaries[key];
|
|
10
|
+
if (!dictionary) throw new Error(`Dictionary ${key} not found`, dictionaries);
|
|
11
|
+
return require_interpreter_getDictionary.getDictionary(dictionary, locale, plugins);
|
|
46
12
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.getIntlayer = getIntlayer;
|
|
51
16
|
//# sourceMappingURL=getIntlayer.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"getIntlayer.cjs","names":["getDictionary"],"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":["import { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type {\n DeclaredLocales,\n DictionaryKeys,\n DictionaryRegistryContent,\n DictionaryRegistryElement,\n LocalesValues,\n} from '@intlayer/types';\nimport type {\n DeepTransformContent,\n IInterpreterPluginState,\n Plugins,\n} from './getContent';\nimport { getDictionary } from './getDictionary';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends LocalesValues = DeclaredLocales,\n>(\n key: T,\n locale?: L,\n plugins?: Plugins[]\n): DeepTransformContent<\n DictionaryRegistryContent<T>,\n IInterpreterPluginState,\n L\n> => {\n const dictionaries = getDictionaries();\n const dictionary = dictionaries[key as T] as DictionaryRegistryElement<T>;\n\n if (!dictionary) {\n throw new Error(`Dictionary ${key as string} not found`, dictionaries);\n }\n\n return getDictionary<DictionaryRegistryElement<T>, L>(\n dictionary,\n locale,\n plugins\n );\n};\n"],"mappings":";;;;;;AAeA,MAAa,eAIX,KACA,QACA,YAKG;CACH,MAAM,mEAAgC;CACtC,MAAM,aAAa,aAAa;AAEhC,KAAI,CAAC,WACH,OAAM,IAAI,MAAM,cAAc,IAAc,aAAa,aAAa;AAGxE,QAAOA,gDACL,YACA,QACA,QACD"}
|
|
@@ -1,44 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var getNesting_exports = {};
|
|
20
|
-
__export(getNesting_exports, {
|
|
21
|
-
getNesting: () => getNesting
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(getNesting_exports);
|
|
24
|
-
var import_getIntlayer = require('./getIntlayer.cjs');
|
|
1
|
+
const require_interpreter_getIntlayer = require('./getIntlayer.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/interpreter/getNesting.ts
|
|
4
|
+
/**
|
|
5
|
+
* Allow to extract the content of another dictionary.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```ts
|
|
9
|
+
* const content = getNesting("dictionaryKey", "path.to.content");
|
|
10
|
+
* // 'Example content'
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
25
13
|
const getNesting = (dictionaryKey, path, props) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
return dictionary;
|
|
14
|
+
const dictionary = require_interpreter_getIntlayer.getIntlayer(dictionaryKey, props?.locale, props?.plugins);
|
|
15
|
+
if (typeof path === "string") {
|
|
16
|
+
const pathArray = path.split(".");
|
|
17
|
+
let current = dictionary;
|
|
18
|
+
for (const key of pathArray) {
|
|
19
|
+
current = current?.[key];
|
|
20
|
+
if (current === void 0) return dictionary;
|
|
21
|
+
}
|
|
22
|
+
return current;
|
|
23
|
+
}
|
|
24
|
+
return dictionary;
|
|
39
25
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.getNesting = getNesting;
|
|
44
29
|
//# sourceMappingURL=getNesting.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/interpreter/getNesting.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"getNesting.cjs","names":["getIntlayer","current: any"],"sources":["../../../src/interpreter/getNesting.ts"],"sourcesContent":["import type {\n DictionaryKeys,\n DictionaryRegistryContent,\n GetSubPath,\n} from '@intlayer/types';\nimport type { ValidDotPathsFor } from '../transpiler';\nimport type {\n DeepTransformContent,\n IInterpreterPluginState,\n NodeProps,\n} from './getContent';\nimport { getIntlayer } from './getIntlayer';\n\nexport type GetNestingResult<\n K extends DictionaryKeys,\n P = undefined,\n S = IInterpreterPluginState,\n> = GetSubPath<DeepTransformContent<DictionaryRegistryContent<K>, S>, P>;\n\n/**\n * Allow to extract the content of another dictionary.\n *\n * Usage:\n * ```ts\n * const content = getNesting(\"dictionaryKey\", \"path.to.content\");\n * // 'Example content'\n * ```\n */\nexport const getNesting = <K extends DictionaryKeys, P>(\n dictionaryKey: K,\n path?: P extends ValidDotPathsFor<K> ? P : never,\n props?: NodeProps\n): GetNestingResult<K, P> => {\n const dictionary = getIntlayer(dictionaryKey, props?.locale, props?.plugins);\n\n if (typeof path === 'string') {\n const pathArray = (path as string).split('.');\n let current: any = dictionary;\n\n for (const key of pathArray) {\n // Safely traverse down the object using the path\n current = current?.[key];\n // If we cannot find the path, return the whole dictionary as a fallback\n if (current === undefined) {\n return dictionary as any;\n }\n }\n\n return current;\n }\n\n // Default or error handling if path is not a string or otherwise undefined\n return dictionary as any;\n};\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAa,cACX,eACA,MACA,UAC2B;CAC3B,MAAM,aAAaA,4CAAY,eAAe,OAAO,QAAQ,OAAO,QAAQ;AAE5E,KAAI,OAAO,SAAS,UAAU;EAC5B,MAAM,YAAa,KAAgB,MAAM,IAAI;EAC7C,IAAIC,UAAe;AAEnB,OAAK,MAAM,OAAO,WAAW;AAE3B,aAAU,UAAU;AAEpB,OAAI,YAAY,OACd,QAAO;;AAIX,SAAO;;AAIT,QAAO"}
|
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/interpreter/getTranslation.ts
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Allow to pick a content based on a locale.
|
|
6
|
+
* If not locale found, it will return the content related to the default locale.
|
|
7
|
+
*
|
|
8
|
+
* Return either the content editor, or the content itself depending on the configuration.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* const content = getTranslation<string>({
|
|
14
|
+
* en: 'Hello',
|
|
15
|
+
* fr: 'Bonjour',
|
|
16
|
+
* }, 'fr');
|
|
17
|
+
* // 'Bonjour'
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Using TypeScript:
|
|
21
|
+
* - this function will require each locale to be defined if defined in the project configuration.
|
|
22
|
+
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
23
|
+
*/
|
|
24
24
|
const getTranslation = (languageContent, locale, fallback) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
return result;
|
|
25
|
+
let result = languageContent[locale];
|
|
26
|
+
if (fallback && !result) result = languageContent[fallback];
|
|
27
|
+
return result;
|
|
30
28
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.getTranslation = getTranslation;
|
|
35
32
|
//# sourceMappingURL=getTranslation.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/interpreter/getTranslation.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/
|
|
1
|
+
{"version":3,"file":"getTranslation.cjs","names":[],"sources":["../../../src/interpreter/getTranslation.ts"],"sourcesContent":["import type { LocalesValues, StrictModeLocaleMap } from '@intlayer/types';\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 * Return either the content editor, or the content itself depending on the configuration.\n *\n * Usage:\n *\n * ```ts\n * const content = getTranslation<string>({\n * en: 'Hello',\n * fr: 'Bonjour',\n * }, 'fr');\n * // 'Bonjour'\n * ```\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 getTranslation = <Content = string>(\n languageContent: StrictModeLocaleMap<Content>,\n locale: LocalesValues,\n fallback?: LocalesValues\n): Content => {\n let result = languageContent[locale as keyof typeof languageContent];\n\n if (fallback && !result) {\n result = languageContent[fallback as keyof typeof languageContent];\n }\n\n return result as unknown as Content;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,kBACX,iBACA,QACA,aACY;CACZ,IAAI,SAAS,gBAAgB;AAE7B,KAAI,YAAY,CAAC,OACf,UAAS,gBAAgB;AAG3B,QAAO"}
|