@intlayer/core 4.1.11 → 4.1.12
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 +97 -0
- package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -0
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +46 -0
- package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -0
- package/dist/cjs/dictionaryManipulator/getSectionType.cjs +57 -0
- package/dist/cjs/dictionaryManipulator/getSectionType.cjs.map +1 -0
- package/dist/cjs/dictionaryManipulator/index.cjs +31 -0
- package/dist/cjs/dictionaryManipulator/index.cjs.map +1 -0
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs +64 -0
- package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -0
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs +73 -0
- package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -0
- package/dist/cjs/index.cjs +17 -47
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/{transpiler/content_transformers/enumeration/getEnumerationContent.cjs → interpreter/getCondition.cjs} +10 -10
- package/dist/cjs/interpreter/getCondition.cjs.map +1 -0
- package/dist/cjs/interpreter/getContent/deepTransform.cjs +66 -0
- package/dist/cjs/interpreter/getContent/deepTransform.cjs.map +1 -0
- package/dist/cjs/{transpiler/content_transformers/translation/translation.cjs → interpreter/getContent/getContent.cjs} +22 -23
- package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -0
- package/dist/cjs/interpreter/getContent/index.cjs +27 -0
- package/dist/cjs/interpreter/getContent/index.cjs.map +1 -0
- package/dist/cjs/interpreter/getContent/plugins.cjs +111 -0
- package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -0
- package/dist/cjs/interpreter/getDictionary.cjs +42 -0
- package/dist/cjs/interpreter/getDictionary.cjs.map +1 -0
- package/dist/cjs/{transpiler/content_transformers/enumeration/findMatchingCondition.cjs → interpreter/getEnumeration.cjs} +12 -7
- package/dist/cjs/interpreter/getEnumeration.cjs.map +1 -0
- package/dist/cjs/interpreter/getIntlayer.cjs +51 -0
- package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -0
- package/dist/cjs/interpreter/getIntlayerAsync.cjs +37 -0
- package/dist/cjs/interpreter/getIntlayerAsync.cjs.map +1 -0
- package/dist/cjs/interpreter/getNesting.cjs +44 -0
- package/dist/cjs/interpreter/getNesting.cjs.map +1 -0
- package/dist/cjs/{transpiler/content_transformers/translation/getTranslationContent.cjs → interpreter/getTranslation.cjs} +11 -8
- package/dist/cjs/interpreter/getTranslation.cjs.map +1 -0
- package/dist/cjs/interpreter/index.cjs +39 -0
- package/dist/cjs/interpreter/index.cjs.map +1 -0
- package/dist/cjs/localization/getHTMLTextDir.cjs.map +1 -0
- package/dist/cjs/localization/getLocaleLang.cjs.map +1 -0
- package/dist/cjs/localization/getLocaleName.cjs.map +1 -0
- package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -0
- package/dist/cjs/{getMultilingualUrls.cjs → localization/getMultilingualUrls.cjs} +1 -1
- package/dist/cjs/localization/getMultilingualUrls.cjs.map +1 -0
- package/dist/cjs/{getPathWithoutLocale.cjs → localization/getPathWithoutLocale.cjs} +1 -1
- package/dist/cjs/localization/getPathWithoutLocale.cjs.map +1 -0
- package/dist/cjs/localization/index.cjs +50 -0
- package/dist/cjs/localization/index.cjs.map +1 -0
- package/dist/cjs/localization/localeDetector.cjs.map +1 -0
- package/dist/cjs/localization/localeList.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/ar.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/du.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/en.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/es.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/fr.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/hi.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/it.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/ja.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/ko.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/ownLocalesName.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/pt.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/ru.cjs.map +1 -0
- package/dist/cjs/localization/localeNames/zh.cjs.map +1 -0
- package/dist/cjs/transpiler/condition/condition.cjs +33 -0
- package/dist/cjs/transpiler/condition/condition.cjs.map +1 -0
- package/dist/cjs/transpiler/{content_transformers → condition}/index.cjs +4 -6
- package/dist/cjs/transpiler/condition/index.cjs.map +1 -0
- package/dist/cjs/transpiler/{content_transformers/enumeration → enumeration}/enumeration.cjs +5 -15
- package/dist/cjs/transpiler/enumeration/enumeration.cjs.map +1 -0
- package/dist/cjs/transpiler/{content_transformers/enumeration → enumeration}/index.cjs +1 -5
- package/dist/cjs/transpiler/enumeration/index.cjs.map +1 -0
- package/dist/cjs/transpiler/index.cjs +10 -2
- package/dist/cjs/transpiler/index.cjs.map +1 -1
- package/dist/cjs/transpiler/markdown/index.cjs +23 -0
- package/dist/cjs/transpiler/markdown/index.cjs.map +1 -0
- package/dist/cjs/transpiler/{content_transformers/translation/types.cjs → markdown/markdown.cjs} +11 -7
- package/dist/cjs/transpiler/markdown/markdown.cjs.map +1 -0
- package/dist/cjs/transpiler/nesting/index.cjs +23 -0
- package/dist/cjs/transpiler/nesting/index.cjs.map +1 -0
- package/dist/cjs/transpiler/nesting/nesting.cjs +36 -0
- package/dist/cjs/transpiler/nesting/nesting.cjs.map +1 -0
- package/dist/cjs/transpiler/{content_transformers/translation → translation}/index.cjs +0 -2
- package/dist/cjs/transpiler/translation/index.cjs.map +1 -0
- package/dist/cjs/transpiler/translation/translation.cjs +33 -0
- package/dist/cjs/transpiler/translation/translation.cjs.map +1 -0
- package/dist/cjs/{types/declarationContent.cjs → transpiler/translation/types.cjs} +3 -3
- package/dist/cjs/transpiler/translation/types.cjs.map +1 -0
- package/dist/cjs/types/dictionary.cjs.map +1 -1
- package/dist/cjs/types/index.cjs +7 -9
- package/dist/cjs/types/index.cjs.map +1 -1
- package/dist/cjs/types/keyPath.cjs.map +1 -1
- package/dist/cjs/types/nodeType.cjs +3 -0
- package/dist/cjs/types/nodeType.cjs.map +1 -1
- package/dist/cjs/utils/checkIsURLAbsolute.cjs.map +1 -0
- package/dist/cjs/utils/isSameKeyPath.cjs.map +1 -1
- package/dist/cjs/utils/isValidReactElement.cjs +30 -0
- package/dist/cjs/utils/isValidReactElement.cjs.map +1 -0
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +73 -0
- package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -0
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +22 -0
- package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -0
- package/dist/esm/dictionaryManipulator/getSectionType.mjs +33 -0
- package/dist/esm/dictionaryManipulator/getSectionType.mjs.map +1 -0
- package/dist/esm/dictionaryManipulator/index.mjs +6 -0
- package/dist/esm/dictionaryManipulator/index.mjs.map +1 -0
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs +40 -0
- package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs.map +1 -0
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +49 -0
- package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -0
- package/dist/esm/index.mjs +8 -34
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/interpreter/getCondition.mjs +9 -0
- package/dist/esm/interpreter/getCondition.mjs.map +1 -0
- package/dist/esm/interpreter/getContent/deepTransform.mjs +42 -0
- package/dist/esm/interpreter/getContent/deepTransform.mjs.map +1 -0
- package/dist/esm/interpreter/getContent/getContent.mjs +27 -0
- package/dist/esm/interpreter/getContent/getContent.mjs.map +1 -0
- package/dist/esm/interpreter/getContent/index.mjs +4 -0
- package/dist/esm/interpreter/getContent/index.mjs.map +1 -0
- package/dist/esm/interpreter/getContent/plugins.mjs +84 -0
- package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -0
- package/dist/esm/interpreter/getDictionary.mjs +18 -0
- package/dist/esm/interpreter/getDictionary.mjs.map +1 -0
- package/dist/esm/{transpiler/content_transformers/enumeration/findMatchingCondition.mjs → interpreter/getEnumeration.mjs} +7 -3
- package/dist/esm/interpreter/getEnumeration.mjs.map +1 -0
- package/dist/esm/interpreter/getIntlayer.mjs +17 -0
- package/dist/esm/interpreter/getIntlayer.mjs.map +1 -0
- package/dist/esm/interpreter/getIntlayerAsync.mjs +13 -0
- package/dist/esm/interpreter/getIntlayerAsync.mjs.map +1 -0
- package/dist/esm/interpreter/getNesting.mjs +20 -0
- package/dist/esm/interpreter/getNesting.mjs.map +1 -0
- package/dist/esm/interpreter/getTranslation.mjs +10 -0
- package/dist/esm/interpreter/getTranslation.mjs.map +1 -0
- package/dist/esm/interpreter/index.mjs +10 -0
- package/dist/esm/interpreter/index.mjs.map +1 -0
- package/dist/esm/localization/getHTMLTextDir.mjs.map +1 -0
- package/dist/esm/localization/getLocaleLang.mjs.map +1 -0
- package/dist/esm/localization/getLocaleName.mjs.map +1 -0
- package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -0
- package/dist/esm/{getMultilingualUrls.mjs → localization/getMultilingualUrls.mjs} +1 -1
- package/dist/esm/localization/getMultilingualUrls.mjs.map +1 -0
- package/dist/esm/{getPathWithoutLocale.mjs → localization/getPathWithoutLocale.mjs} +1 -1
- package/dist/esm/localization/getPathWithoutLocale.mjs.map +1 -0
- package/dist/esm/localization/index.mjs +19 -0
- package/dist/esm/localization/index.mjs.map +1 -0
- package/dist/esm/localization/localeDetector.mjs.map +1 -0
- package/dist/esm/localization/localeList.mjs.map +1 -0
- package/dist/esm/localization/localeNames/ar.mjs.map +1 -0
- package/dist/esm/localization/localeNames/du.mjs.map +1 -0
- package/dist/esm/localization/localeNames/en.mjs.map +1 -0
- package/dist/esm/localization/localeNames/es.mjs.map +1 -0
- package/dist/esm/localization/localeNames/fr.mjs.map +1 -0
- package/dist/esm/localization/localeNames/hi.mjs.map +1 -0
- package/dist/esm/localization/localeNames/it.mjs.map +1 -0
- package/dist/esm/localization/localeNames/ja.mjs.map +1 -0
- package/dist/esm/localization/localeNames/ko.mjs.map +1 -0
- package/dist/esm/localization/localeNames/ownLocalesName.mjs.map +1 -0
- package/dist/esm/localization/localeNames/pt.mjs.map +1 -0
- package/dist/esm/localization/localeNames/ru.mjs.map +1 -0
- package/dist/esm/localization/localeNames/zh.mjs.map +1 -0
- package/dist/esm/transpiler/condition/condition.mjs +9 -0
- package/dist/esm/transpiler/condition/condition.mjs.map +1 -0
- package/dist/esm/transpiler/condition/index.mjs +2 -0
- package/dist/esm/transpiler/condition/index.mjs.map +1 -0
- package/dist/esm/transpiler/enumeration/enumeration.mjs +9 -0
- package/dist/esm/transpiler/enumeration/enumeration.mjs.map +1 -0
- package/dist/esm/transpiler/enumeration/index.mjs +2 -0
- package/dist/esm/transpiler/enumeration/index.mjs.map +1 -0
- package/dist/esm/transpiler/index.mjs +5 -1
- package/dist/esm/transpiler/index.mjs.map +1 -1
- package/dist/esm/transpiler/markdown/index.mjs +2 -0
- package/dist/esm/transpiler/markdown/index.mjs.map +1 -0
- package/dist/esm/transpiler/markdown/markdown.mjs +9 -0
- package/dist/esm/transpiler/markdown/markdown.mjs.map +1 -0
- package/dist/esm/transpiler/nesting/index.mjs +2 -0
- package/dist/esm/transpiler/nesting/index.mjs.map +1 -0
- package/dist/esm/transpiler/nesting/nesting.mjs +12 -0
- package/dist/esm/transpiler/nesting/nesting.mjs.map +1 -0
- package/dist/esm/transpiler/translation/index.mjs +3 -0
- package/dist/esm/transpiler/translation/index.mjs.map +1 -0
- package/dist/esm/transpiler/translation/translation.mjs +9 -0
- package/dist/esm/transpiler/translation/translation.mjs.map +1 -0
- package/dist/esm/transpiler/translation/types.mjs +1 -0
- package/dist/esm/types/index.mjs +3 -4
- package/dist/esm/types/index.mjs.map +1 -1
- package/dist/esm/types/nodeType.mjs +3 -0
- package/dist/esm/types/nodeType.mjs.map +1 -1
- package/dist/esm/utils/checkIsURLAbsolute.mjs.map +1 -0
- package/dist/esm/utils/isSameKeyPath.mjs.map +1 -1
- package/dist/esm/utils/isValidReactElement.mjs +6 -0
- package/dist/esm/utils/isValidReactElement.mjs.map +1 -0
- package/dist/types/dictionaryManipulator/editDictionaryByKeyPath.d.ts +4 -0
- package/dist/types/dictionaryManipulator/editDictionaryByKeyPath.d.ts.map +1 -0
- package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts +4 -0
- package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts.map +1 -0
- package/dist/types/dictionaryManipulator/getSectionType.d.ts +4 -0
- package/dist/types/dictionaryManipulator/getSectionType.d.ts.map +1 -0
- package/dist/types/dictionaryManipulator/index.d.ts +6 -0
- package/dist/types/dictionaryManipulator/index.d.ts.map +1 -0
- package/dist/types/dictionaryManipulator/removeContentNodeByKeyPath.d.ts +4 -0
- package/dist/types/dictionaryManipulator/removeContentNodeByKeyPath.d.ts.map +1 -0
- package/dist/types/dictionaryManipulator/renameContentNodeByKeyPath.d.ts +4 -0
- package/dist/types/dictionaryManipulator/renameContentNodeByKeyPath.d.ts.map +1 -0
- package/dist/types/index.d.ts +8 -13
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interpreter/getCondition.d.ts +25 -0
- package/dist/types/interpreter/getCondition.d.ts.map +1 -0
- package/dist/types/interpreter/getContent/deepTransform.d.ts +8 -0
- package/dist/types/interpreter/getContent/deepTransform.d.ts.map +1 -0
- package/dist/types/interpreter/getContent/getContent.d.ts +11 -0
- package/dist/types/interpreter/getContent/getContent.d.ts.map +1 -0
- package/dist/types/interpreter/getContent/index.d.ts +4 -0
- package/dist/types/interpreter/getContent/index.d.ts.map +1 -0
- package/dist/types/interpreter/getContent/plugins.d.ts +106 -0
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -0
- package/dist/types/interpreter/getDictionary.d.ts +13 -0
- package/dist/types/interpreter/getDictionary.d.ts.map +1 -0
- package/dist/types/interpreter/getEnumeration.d.ts +57 -0
- package/dist/types/interpreter/getEnumeration.d.ts.map +1 -0
- package/dist/types/interpreter/getIntlayer.d.ts +6 -0
- package/dist/types/interpreter/getIntlayer.d.ts.map +1 -0
- package/dist/types/interpreter/getIntlayerAsync.d.ts +13 -0
- package/dist/types/interpreter/getIntlayerAsync.d.ts.map +1 -0
- package/dist/types/interpreter/getNesting.d.ts +18 -0
- package/dist/types/interpreter/getNesting.d.ts.map +1 -0
- package/dist/types/{transpiler/content_transformers/translation/getTranslationContent.d.ts → interpreter/getTranslation.d.ts} +8 -8
- package/dist/types/interpreter/getTranslation.d.ts.map +1 -0
- package/dist/types/interpreter/index.d.ts +10 -0
- package/dist/types/interpreter/index.d.ts.map +1 -0
- package/dist/types/{getHTMLTextDir.d.ts → localization/getHTMLTextDir.d.ts} +1 -1
- package/dist/types/localization/getHTMLTextDir.d.ts.map +1 -0
- package/dist/types/{getLocaleLang.d.ts → localization/getLocaleLang.d.ts} +1 -1
- package/dist/types/localization/getLocaleLang.d.ts.map +1 -0
- package/dist/types/{getLocaleName.d.ts → localization/getLocaleName.d.ts} +1 -1
- package/dist/types/localization/getLocaleName.d.ts.map +1 -0
- package/dist/types/{getLocalizedUrl.d.ts → localization/getLocalizedUrl.d.ts} +1 -1
- package/dist/types/localization/getLocalizedUrl.d.ts.map +1 -0
- package/dist/types/{getMultilingualUrls.d.ts → localization/getMultilingualUrls.d.ts} +1 -1
- package/dist/types/localization/getMultilingualUrls.d.ts.map +1 -0
- package/dist/types/{getPathWithoutLocale.d.ts → localization/getPathWithoutLocale.d.ts} +1 -1
- package/dist/types/localization/getPathWithoutLocale.d.ts.map +1 -0
- package/dist/types/localization/index.d.ts +9 -0
- package/dist/types/localization/index.d.ts.map +1 -0
- package/dist/types/localization/localeDetector.d.ts.map +1 -0
- package/dist/types/localization/localeList.d.ts.map +1 -0
- package/dist/types/localization/localeNames/ar.d.ts.map +1 -0
- package/dist/types/localization/localeNames/du.d.ts.map +1 -0
- package/dist/types/localization/localeNames/en.d.ts.map +1 -0
- package/dist/types/localization/localeNames/es.d.ts.map +1 -0
- package/dist/types/localization/localeNames/fr.d.ts.map +1 -0
- package/dist/types/localization/localeNames/hi.d.ts.map +1 -0
- package/dist/types/localization/localeNames/it.d.ts.map +1 -0
- package/dist/types/localization/localeNames/ja.d.ts.map +1 -0
- package/dist/types/localization/localeNames/ko.d.ts.map +1 -0
- package/dist/types/localization/localeNames/ownLocalesName.d.ts.map +1 -0
- package/dist/types/localization/localeNames/pt.d.ts.map +1 -0
- package/dist/types/localization/localeNames/ru.d.ts.map +1 -0
- package/dist/types/localization/localeNames/zh.d.ts.map +1 -0
- package/dist/types/transpiler/condition/condition.d.ts +35 -0
- package/dist/types/transpiler/condition/condition.d.ts.map +1 -0
- package/dist/types/transpiler/condition/index.d.ts +2 -0
- package/dist/types/transpiler/condition/index.d.ts.map +1 -0
- package/dist/types/transpiler/enumeration/enumeration.d.ts +58 -0
- package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -0
- package/dist/types/transpiler/enumeration/index.d.ts +2 -0
- package/dist/types/transpiler/enumeration/index.d.ts.map +1 -0
- package/dist/types/transpiler/index.d.ts +5 -1
- package/dist/types/transpiler/index.d.ts.map +1 -1
- package/dist/types/transpiler/markdown/index.d.ts +2 -0
- package/dist/types/transpiler/markdown/index.d.ts.map +1 -0
- package/dist/types/transpiler/markdown/markdown.d.ts +21 -0
- package/dist/types/transpiler/markdown/markdown.d.ts.map +1 -0
- package/dist/types/transpiler/nesting/index.d.ts +2 -0
- package/dist/types/transpiler/nesting/index.d.ts.map +1 -0
- package/dist/types/transpiler/nesting/nesting.d.ts +54 -0
- package/dist/types/transpiler/nesting/nesting.d.ts.map +1 -0
- package/dist/types/transpiler/translation/index.d.ts +3 -0
- package/dist/types/transpiler/translation/index.d.ts.map +1 -0
- package/dist/types/transpiler/{content_transformers/translation → translation}/translation.d.ts +2 -2
- package/dist/types/transpiler/translation/translation.d.ts.map +1 -0
- package/dist/types/transpiler/{content_transformers/translation → translation}/types.d.ts +4 -5
- package/dist/types/transpiler/translation/types.d.ts.map +1 -0
- package/dist/types/types/dictionary.d.ts +36 -7
- package/dist/types/types/dictionary.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +3 -4
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/keyPath.d.ts +17 -1
- package/dist/types/types/keyPath.d.ts.map +1 -1
- package/dist/types/types/nodeType.d.ts +4 -1
- package/dist/types/types/nodeType.d.ts.map +1 -1
- package/dist/types/utils/checkIsURLAbsolute.d.ts.map +1 -0
- package/dist/types/utils/isSameKeyPath.d.ts.map +1 -1
- package/dist/types/utils/isValidReactElement.d.ts +9 -0
- package/dist/types/utils/isValidReactElement.d.ts.map +1 -0
- package/package.json +11 -8
- package/dist/cjs/checkIsURLAbsolute.cjs.map +0 -1
- package/dist/cjs/getHTMLTextDir.cjs.map +0 -1
- package/dist/cjs/getLocaleLang.cjs.map +0 -1
- package/dist/cjs/getLocaleName.cjs.map +0 -1
- package/dist/cjs/getLocalizedUrl.cjs.map +0 -1
- package/dist/cjs/getMultilingualUrls.cjs.map +0 -1
- package/dist/cjs/getPathWithoutLocale.cjs.map +0 -1
- package/dist/cjs/localeDetector.cjs.map +0 -1
- package/dist/cjs/localeList.cjs.map +0 -1
- package/dist/cjs/localeNames/ar.cjs.map +0 -1
- package/dist/cjs/localeNames/du.cjs.map +0 -1
- package/dist/cjs/localeNames/en.cjs.map +0 -1
- package/dist/cjs/localeNames/es.cjs.map +0 -1
- package/dist/cjs/localeNames/fr.cjs.map +0 -1
- package/dist/cjs/localeNames/hi.cjs.map +0 -1
- package/dist/cjs/localeNames/it.cjs.map +0 -1
- package/dist/cjs/localeNames/ja.cjs.map +0 -1
- package/dist/cjs/localeNames/ko.cjs.map +0 -1
- package/dist/cjs/localeNames/ownLocalesName.cjs.map +0 -1
- package/dist/cjs/localeNames/pt.cjs.map +0 -1
- package/dist/cjs/localeNames/ru.cjs.map +0 -1
- package/dist/cjs/localeNames/zh.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/enumeration.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/findMatchingCondition.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/getEnumerationContent.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/enumeration/index.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/index.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/translation/getTranslationContent.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/translation/index.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/translation/translation.cjs.map +0 -1
- package/dist/cjs/transpiler/content_transformers/translation/types.cjs.map +0 -1
- package/dist/cjs/types/declarationContent.cjs.map +0 -1
- package/dist/esm/checkIsURLAbsolute.mjs.map +0 -1
- package/dist/esm/getHTMLTextDir.mjs.map +0 -1
- package/dist/esm/getLocaleLang.mjs.map +0 -1
- package/dist/esm/getLocaleName.mjs.map +0 -1
- package/dist/esm/getLocalizedUrl.mjs.map +0 -1
- package/dist/esm/getMultilingualUrls.mjs.map +0 -1
- package/dist/esm/getPathWithoutLocale.mjs.map +0 -1
- package/dist/esm/localeDetector.mjs.map +0 -1
- package/dist/esm/localeList.mjs.map +0 -1
- package/dist/esm/localeNames/ar.mjs.map +0 -1
- package/dist/esm/localeNames/du.mjs.map +0 -1
- package/dist/esm/localeNames/en.mjs.map +0 -1
- package/dist/esm/localeNames/es.mjs.map +0 -1
- package/dist/esm/localeNames/fr.mjs.map +0 -1
- package/dist/esm/localeNames/hi.mjs.map +0 -1
- package/dist/esm/localeNames/it.mjs.map +0 -1
- package/dist/esm/localeNames/ja.mjs.map +0 -1
- package/dist/esm/localeNames/ko.mjs.map +0 -1
- package/dist/esm/localeNames/ownLocalesName.mjs.map +0 -1
- package/dist/esm/localeNames/pt.mjs.map +0 -1
- package/dist/esm/localeNames/ru.mjs.map +0 -1
- package/dist/esm/localeNames/zh.mjs.map +0 -1
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.mjs +0 -19
- package/dist/esm/transpiler/content_transformers/enumeration/enumeration.mjs.map +0 -1
- package/dist/esm/transpiler/content_transformers/enumeration/findMatchingCondition.mjs.map +0 -1
- package/dist/esm/transpiler/content_transformers/enumeration/getEnumerationContent.mjs +0 -9
- package/dist/esm/transpiler/content_transformers/enumeration/getEnumerationContent.mjs.map +0 -1
- package/dist/esm/transpiler/content_transformers/enumeration/index.mjs +0 -4
- package/dist/esm/transpiler/content_transformers/enumeration/index.mjs.map +0 -1
- package/dist/esm/transpiler/content_transformers/index.mjs +0 -3
- package/dist/esm/transpiler/content_transformers/index.mjs.map +0 -1
- package/dist/esm/transpiler/content_transformers/translation/getTranslationContent.mjs +0 -7
- package/dist/esm/transpiler/content_transformers/translation/getTranslationContent.mjs.map +0 -1
- package/dist/esm/transpiler/content_transformers/translation/index.mjs +0 -4
- package/dist/esm/transpiler/content_transformers/translation/index.mjs.map +0 -1
- package/dist/esm/transpiler/content_transformers/translation/translation.mjs +0 -23
- package/dist/esm/transpiler/content_transformers/translation/translation.mjs.map +0 -1
- package/dist/esm/transpiler/content_transformers/translation/types.mjs +0 -5
- package/dist/esm/transpiler/content_transformers/translation/types.mjs.map +0 -1
- package/dist/esm/types/declarationContent.mjs +0 -1
- package/dist/types/checkIsURLAbsolute.d.ts.map +0 -1
- package/dist/types/getHTMLTextDir.d.ts.map +0 -1
- package/dist/types/getLocaleLang.d.ts.map +0 -1
- package/dist/types/getLocaleName.d.ts.map +0 -1
- package/dist/types/getLocalizedUrl.d.ts.map +0 -1
- package/dist/types/getMultilingualUrls.d.ts.map +0 -1
- package/dist/types/getPathWithoutLocale.d.ts.map +0 -1
- package/dist/types/localeDetector.d.ts.map +0 -1
- package/dist/types/localeList.d.ts.map +0 -1
- package/dist/types/localeNames/ar.d.ts.map +0 -1
- package/dist/types/localeNames/du.d.ts.map +0 -1
- package/dist/types/localeNames/en.d.ts.map +0 -1
- package/dist/types/localeNames/es.d.ts.map +0 -1
- package/dist/types/localeNames/fr.d.ts.map +0 -1
- package/dist/types/localeNames/hi.d.ts.map +0 -1
- package/dist/types/localeNames/it.d.ts.map +0 -1
- package/dist/types/localeNames/ja.d.ts.map +0 -1
- package/dist/types/localeNames/ko.d.ts.map +0 -1
- package/dist/types/localeNames/ownLocalesName.d.ts.map +0 -1
- package/dist/types/localeNames/pt.d.ts.map +0 -1
- package/dist/types/localeNames/ru.d.ts.map +0 -1
- package/dist/types/localeNames/zh.d.ts.map +0 -1
- package/dist/types/transpiler/content_transformers/enumeration/enumeration.d.ts +0 -38
- package/dist/types/transpiler/content_transformers/enumeration/enumeration.d.ts.map +0 -1
- package/dist/types/transpiler/content_transformers/enumeration/findMatchingCondition.d.ts +0 -30
- package/dist/types/transpiler/content_transformers/enumeration/findMatchingCondition.d.ts.map +0 -1
- package/dist/types/transpiler/content_transformers/enumeration/getEnumerationContent.d.ts +0 -29
- package/dist/types/transpiler/content_transformers/enumeration/getEnumerationContent.d.ts.map +0 -1
- package/dist/types/transpiler/content_transformers/enumeration/index.d.ts +0 -4
- package/dist/types/transpiler/content_transformers/enumeration/index.d.ts.map +0 -1
- package/dist/types/transpiler/content_transformers/index.d.ts +0 -3
- package/dist/types/transpiler/content_transformers/index.d.ts.map +0 -1
- package/dist/types/transpiler/content_transformers/translation/getTranslationContent.d.ts.map +0 -1
- package/dist/types/transpiler/content_transformers/translation/index.d.ts +0 -4
- package/dist/types/transpiler/content_transformers/translation/index.d.ts.map +0 -1
- package/dist/types/transpiler/content_transformers/translation/translation.d.ts.map +0 -1
- package/dist/types/transpiler/content_transformers/translation/types.d.ts.map +0 -1
- package/dist/types/types/declarationContent.d.ts +0 -27
- package/dist/types/types/declarationContent.d.ts.map +0 -1
- /package/dist/cjs/{getHTMLTextDir.cjs → localization/getHTMLTextDir.cjs} +0 -0
- /package/dist/cjs/{getLocaleLang.cjs → localization/getLocaleLang.cjs} +0 -0
- /package/dist/cjs/{getLocaleName.cjs → localization/getLocaleName.cjs} +0 -0
- /package/dist/cjs/{getLocalizedUrl.cjs → localization/getLocalizedUrl.cjs} +0 -0
- /package/dist/cjs/{localeDetector.cjs → localization/localeDetector.cjs} +0 -0
- /package/dist/cjs/{localeList.cjs → localization/localeList.cjs} +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/ar.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/du.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/en.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/es.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/fr.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/hi.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/it.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/ja.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/ko.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/ownLocalesName.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/pt.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/ru.cjs +0 -0
- /package/dist/cjs/{localeNames → localization/localeNames}/zh.cjs +0 -0
- /package/dist/cjs/{checkIsURLAbsolute.cjs → utils/checkIsURLAbsolute.cjs} +0 -0
- /package/dist/esm/{getHTMLTextDir.mjs → localization/getHTMLTextDir.mjs} +0 -0
- /package/dist/esm/{getLocaleLang.mjs → localization/getLocaleLang.mjs} +0 -0
- /package/dist/esm/{getLocaleName.mjs → localization/getLocaleName.mjs} +0 -0
- /package/dist/esm/{getLocalizedUrl.mjs → localization/getLocalizedUrl.mjs} +0 -0
- /package/dist/esm/{localeDetector.mjs → localization/localeDetector.mjs} +0 -0
- /package/dist/esm/{localeList.mjs → localization/localeList.mjs} +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/ar.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/du.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/en.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/es.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/fr.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/hi.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/it.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/ja.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/ko.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/ownLocalesName.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/pt.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/ru.mjs +0 -0
- /package/dist/esm/{localeNames → localization/localeNames}/zh.mjs +0 -0
- /package/dist/esm/{types/declarationContent.mjs.map → transpiler/translation/types.mjs.map} +0 -0
- /package/dist/esm/{checkIsURLAbsolute.mjs → utils/checkIsURLAbsolute.mjs} +0 -0
- /package/dist/types/{localeDetector.d.ts → localization/localeDetector.d.ts} +0 -0
- /package/dist/types/{localeList.d.ts → localization/localeList.d.ts} +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/ar.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/du.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/en.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/es.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/fr.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/hi.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/it.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/ja.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/ko.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/ownLocalesName.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/pt.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/ru.d.ts +0 -0
- /package/dist/types/{localeNames → localization/localeNames}/zh.d.ts +0 -0
- /package/dist/types/{checkIsURLAbsolute.d.ts → utils/checkIsURLAbsolute.d.ts} +0 -0
|
@@ -16,32 +16,31 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var getContent_exports = {};
|
|
20
|
+
__export(getContent_exports, {
|
|
21
|
+
getContent: () => getContent
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(getContent_exports);
|
|
24
24
|
var import_client = require("@intlayer/config/client");
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
return result;
|
|
25
|
+
var import_deepTransform = require('./deepTransform.cjs');
|
|
26
|
+
var import_plugins = require('./plugins.cjs');
|
|
27
|
+
const getContent = (node, nodeProps, locale) => {
|
|
28
|
+
const plugins = [
|
|
29
|
+
(0, import_plugins.translationPlugin)(
|
|
30
|
+
locale ?? (0, import_client.getConfiguration)().internationalization.defaultLocale
|
|
31
|
+
),
|
|
32
|
+
import_plugins.enumerationPlugin,
|
|
33
|
+
import_plugins.conditionPlugin,
|
|
34
|
+
import_plugins.nestedPlugin,
|
|
35
|
+
...nodeProps.plugins ?? []
|
|
36
|
+
];
|
|
37
|
+
return (0, import_deepTransform.deepTransformNode)(node, {
|
|
38
|
+
...nodeProps,
|
|
39
|
+
plugins
|
|
40
|
+
});
|
|
42
41
|
};
|
|
43
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
43
|
0 && (module.exports = {
|
|
45
|
-
|
|
44
|
+
getContent
|
|
46
45
|
});
|
|
47
|
-
//# sourceMappingURL=
|
|
46
|
+
//# sourceMappingURL=getContent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/interpreter/getContent/getContent.ts"],"sourcesContent":["import { getConfiguration, type Locales } from '@intlayer/config/client';\nimport type { ContentNode } from '../../types';\nimport { deepTransformNode } from './deepTransform';\nimport {\n translationPlugin,\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin,\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\n} from './plugins';\n\n/**\n * Transforms a node in a single pass, applying each plugin as needed.\n *\n * @param node The node to transform.\n * @param locale The locale to use if your transformers need it (e.g. for translations).\n */\nexport const getContent = <\n T extends ContentNode,\n L extends Locales | `${Locales}` = Locales,\n>(\n node: T,\n nodeProps: NodeProps,\n locale?: L\n) => {\n const plugins: Plugins[] = [\n translationPlugin(\n locale ?? getConfiguration().internationalization.defaultLocale\n ),\n enumerationPlugin,\n conditionPlugin,\n nestedPlugin,\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+C;AAE/C,2BAAkC;AAClC,qBAQO;AAQA,MAAM,aAAa,CAIxB,MACA,WACA,WACG;AACH,QAAM,UAAqB;AAAA,QACzB;AAAA,MACE,cAAU,gCAAiB,EAAE,qBAAqB;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,UAAU,WAAW,CAAC;AAAA,EAC5B;AAEA,aAAO,wCAAkB,MAAM;AAAA,IAC7B,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var getContent_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(getContent_exports);
|
|
18
|
+
__reExport(getContent_exports, require('../getDictionary.cjs'), module.exports);
|
|
19
|
+
__reExport(getContent_exports, require('./deepTransform.cjs'), module.exports);
|
|
20
|
+
__reExport(getContent_exports, require('./plugins.cjs'), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require('../getDictionary.cjs'),
|
|
24
|
+
...require('./deepTransform.cjs'),
|
|
25
|
+
...require('./plugins.cjs')
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/interpreter/getContent/index.ts"],"sourcesContent":["export * from '../getDictionary';\nexport * from './deepTransform';\nexport * from './plugins';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,6BAAd;AACA,+BAAc,4BADd;AAEA,+BAAc,sBAFd;","names":[]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
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 plugins_exports = {};
|
|
20
|
+
__export(plugins_exports, {
|
|
21
|
+
conditionPlugin: () => conditionPlugin,
|
|
22
|
+
enumerationPlugin: () => enumerationPlugin,
|
|
23
|
+
nestedPlugin: () => nestedPlugin,
|
|
24
|
+
translationPlugin: () => translationPlugin
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(plugins_exports);
|
|
27
|
+
var import_types = require('../../types/index.cjs');
|
|
28
|
+
var import_getTranslation = require('../getTranslation.cjs');
|
|
29
|
+
var import_getEnumeration = require('../getEnumeration.cjs');
|
|
30
|
+
var import_getCondition = require('../getCondition.cjs');
|
|
31
|
+
var import_getNesting = require('../getNesting.cjs');
|
|
32
|
+
const translationPlugin = (locale) => ({
|
|
33
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === import_types.NodeType.Translation,
|
|
34
|
+
transform: (node, props, deepTransformNode) => {
|
|
35
|
+
const result = structuredClone(node.translation);
|
|
36
|
+
for (const key in result) {
|
|
37
|
+
const childProps = {
|
|
38
|
+
...props,
|
|
39
|
+
content: result[key],
|
|
40
|
+
keyPath: [
|
|
41
|
+
...props.keyPath,
|
|
42
|
+
{ type: import_types.NodeType.Translation, key }
|
|
43
|
+
]
|
|
44
|
+
};
|
|
45
|
+
result[key] = deepTransformNode(
|
|
46
|
+
result[key],
|
|
47
|
+
childProps
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
return (0, import_getTranslation.getTranslation)(result, locale);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const enumerationPlugin = {
|
|
54
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === import_types.NodeType.Enumeration,
|
|
55
|
+
transform: (node, props, deepTransformNode) => {
|
|
56
|
+
const result = structuredClone(node.enumeration);
|
|
57
|
+
for (const key in result) {
|
|
58
|
+
const child = result[key];
|
|
59
|
+
const childProps = {
|
|
60
|
+
...props,
|
|
61
|
+
content: child,
|
|
62
|
+
keyPath: [
|
|
63
|
+
...props.keyPath,
|
|
64
|
+
{ type: import_types.NodeType.Enumeration, key }
|
|
65
|
+
]
|
|
66
|
+
};
|
|
67
|
+
result[key] = deepTransformNode(
|
|
68
|
+
child,
|
|
69
|
+
childProps
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return (quantity) => (0, import_getEnumeration.getEnumeration)(result, quantity);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const conditionPlugin = {
|
|
76
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === import_types.NodeType.Condition,
|
|
77
|
+
transform: (node, props, deepTransformNode) => {
|
|
78
|
+
const result = structuredClone(node.condition);
|
|
79
|
+
for (const key in result) {
|
|
80
|
+
const child = result[key];
|
|
81
|
+
const childProps = {
|
|
82
|
+
...props,
|
|
83
|
+
content: child,
|
|
84
|
+
keyPath: [
|
|
85
|
+
...props.keyPath,
|
|
86
|
+
{ type: import_types.NodeType.Condition, key }
|
|
87
|
+
]
|
|
88
|
+
};
|
|
89
|
+
result[key] = deepTransformNode(
|
|
90
|
+
child,
|
|
91
|
+
childProps
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return (value) => (0, import_getCondition.getCondition)(result, value);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
const nestedPlugin = {
|
|
98
|
+
canHandle: (node) => typeof node === "object" && node?.nodeType === import_types.NodeType.Nested,
|
|
99
|
+
transform: (node, props) => (
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
(0, import_getNesting.getNesting)(node.nested.dictionaryKey, node.nested.path, props)
|
|
102
|
+
)
|
|
103
|
+
};
|
|
104
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
+
0 && (module.exports = {
|
|
106
|
+
conditionPlugin,
|
|
107
|
+
enumerationPlugin,
|
|
108
|
+
nestedPlugin,
|
|
109
|
+
translationPlugin
|
|
110
|
+
});
|
|
111
|
+
//# sourceMappingURL=plugins.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/interpreter/getContent/plugins.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Locales } from '@intlayer/config/client';\n\nimport { type DictionaryKeys, type KeyPath, NodeType } from '../../types/index';\nimport type {\n ConditionContent,\n EnumerationContent,\n MarkdownContent,\n NestedContent,\n TranslationContent,\n} from '../../transpiler';\nimport { getTranslation } from '../getTranslation';\nimport { getEnumeration } from '../getEnumeration';\nimport { getCondition } from '../getCondition';\nimport { type GetNestingResult, getNesting } from '../getNesting';\n\n/** ---------------------------------------------\n * PLUGIN DEFINITION\n * --------------------------------------------- */\n\n/**\n * A plugin/transformer that can optionally transform a node during a single DFS pass.\n * - `canHandle` decides if the node is transformable by this plugin.\n * - `transform` returns the transformed node (and does not recurse further).\n *\n * > `transformFn` is a function that can be used to deeply transform inside the plugin.\n */\nexport type Plugins = {\n canHandle: (node: any) => boolean;\n transform: (\n node: any,\n props: NodeProps,\n transformFn: (node: any, props: NodeProps) => any\n ) => any;\n};\n\n/** ---------------------------------------------\n * TRANSLATION PLUGIN\n * --------------------------------------------- */\n\nexport type TranslationCond<T, S> = T extends {\n nodeType: NodeType | string;\n [NodeType.Translation]: object;\n}\n ? DeepTransformContent<\n T[NodeType.Translation][keyof T[NodeType.Translation]],\n S\n >\n : never;\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const translationPlugin = (locale: Locales | `${Locales}`): Plugins => ({\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node: TranslationContent, props, deepTransformNode) => {\n const result = structuredClone(node.translation);\n\n for (const key in result) {\n const childProps = {\n ...props,\n content: result[key as unknown as keyof typeof result],\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Translation, key } as KeyPath,\n ],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n result[key as unknown as keyof typeof result],\n childProps\n );\n }\n return getTranslation(result, locale);\n },\n});\n\n/** ---------------------------------------------\n * ENUMERATION PLUGIN\n * --------------------------------------------- */\n\nexport type EnumerationCond<T, S> = T extends {\n nodeType: NodeType | string;\n [NodeType.Enumeration]: object;\n}\n ? (\n quantity: number\n ) => DeepTransformContent<\n T[NodeType.Enumeration][keyof T[NodeType.Enumeration]],\n S\n >\n : never;\n\n/** Enumeration plugin. Replaces node with a function that takes quantity => string. */\nexport const enumerationPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Enumeration,\n transform: (node: EnumerationContent, props, deepTransformNode) => {\n const result = structuredClone(node.enumeration);\n\n for (const key in result) {\n const child = result[key as unknown as keyof typeof result];\n const childProps = {\n ...props,\n content: child,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Enumeration, key } as KeyPath,\n ],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n child,\n childProps\n );\n }\n\n return (quantity: number) => getEnumeration(result, quantity);\n },\n};\n\n/** ---------------------------------------------\n * CONDITION PLUGIN\n * --------------------------------------------- */\n\nexport type ConditionCond<T, S> = T extends {\n nodeType: NodeType | string;\n [NodeType.Condition]: object;\n}\n ? (\n value: boolean\n ) => DeepTransformContent<\n T[NodeType.Condition][keyof T[NodeType.Condition]],\n S\n >\n : never;\n\n/** Condition plugin. Replaces node with a function that takes boolean => string. */\nexport const conditionPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Condition,\n transform: (node: ConditionContent, props, deepTransformNode) => {\n const result = structuredClone(node.condition);\n\n for (const key in result) {\n const child = result[key as keyof typeof result];\n const childProps = {\n ...props,\n content: child,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Condition, key } as KeyPath,\n ],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n child,\n childProps\n );\n }\n\n return (value: boolean) => getCondition(result, value);\n },\n};\n\n/** ---------------------------------------------\n * NESTED PLUGIN\n * --------------------------------------------- */\n\nexport type NestedCond<T, S> = T extends {\n nodeType: NodeType | string;\n [NodeType.Nested]: infer U;\n}\n ? U extends {\n dictionaryKey: infer K extends DictionaryKeys;\n path?: infer P;\n }\n ? GetNestingResult<K, P, S>\n : never\n : never;\n\n/** Nested plugin. Replaces node with the result of `getNesting`. */\nexport const nestedPlugin: Plugins = {\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Nested,\n transform: (node: NestedContent, props) =>\n // @ts-ignore\n getNesting(node.nested.dictionaryKey, node.nested.path, props),\n};\n\n/**\n * PLUGIN RESULT\n */\n\n/**\n * Interface that defines the properties of a node.\n * This interface can be augmented in other packages, such as `react-intlayer`.\n */\nexport interface NodeProps {\n dictionaryKey: string;\n keyPath: KeyPath[];\n plugins?: Plugins[];\n locale?: Locales;\n dictionaryPath?: string;\n content?: any;\n}\n\n/**\n * Interface that defines the plugins that can be used to transform a node.\n * This interface can be augmented in other packages, such as `react-intlayer`.\n */\nexport interface IInterpreterPlugin<T, S> {\n translation: TranslationCond<T, S>;\n enumeration: EnumerationCond<T, S>;\n condition: ConditionCond<T, S>;\n nested: NestedCond<T, S>;\n}\n\n/**\n * Allow to avoid overwriting import from `intlayer` package when `IInterpreterPlugin<T>` interface is augmented in another package, such as `react-intlayer`.\n */\nexport type IInterpreterPluginState = {\n translation: true;\n enumeration: true;\n condition: true;\n nested: true;\n};\n\n/**\n * Utility type to check if a plugin can be applied to a node.\n */\ntype CheckApplyPlugin<T, K extends keyof IInterpreterPlugin<T, S>, S> =\n // Test if the key is a key of S.\n K extends keyof S\n ? // Test if the key of S is true. Then the plugin can be applied.\n S[K] extends true\n ? // Test if the key of S exist\n IInterpreterPlugin<T, S>[K] extends never\n ? never\n : // Test if the plugin condition is true (if it's not, the plugin is skipped for this node)\n IInterpreterPlugin<T, S>[K]\n : never\n : never;\n\n/**\n * Traverse recursively through an object or array, applying each plugin as needed.\n */\ntype Traverse<T, S> = T extends object\n ? T extends (infer U)[]\n ? DeepTransformContent<U, S>[] // Transform each element in an array.\n : { [K in keyof T]: DeepTransformContent<T[K], S> } // Recursively transform each property.\n : T;\n\n/**\n * Traverse recursively through an object or array, applying each plugin as needed.\n */\nexport type DeepTransformContent<T, S = IInterpreterPluginState> =\n // Check if there is a plugin for T:\n CheckApplyPlugin<T, keyof IInterpreterPlugin<T, S>, S> extends never\n ? // No plugin was found, so try to transform T recursively:\n Traverse<T, S>\n : // A plugin was found – use the plugin’s transformation.\n IInterpreterPlugin<T, S>[keyof IInterpreterPlugin<T, S>];\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA4D;AAQ5D,4BAA+B;AAC/B,4BAA+B;AAC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AAgB,KAAK,SAAS;AAE7C,eAAW,OAAO,QAAQ;AACxB,YAAM,QAAQ,OAAO,GAA0B;AAC/C,YAAM,aAAa;AAAA,QACjB,GAAG;AAAA,QACH,SAAS;AAAA,QACT,SAAS;AAAA,UACP,GAAG,MAAM;AAAA,UACT,EAAE,MAAM,sBAAS,WAAW,IAAI;AAAA,QAClC;AAAA,MACF;AACA,aAAO,GAAqC,IAAI;AAAA,QAC9C;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO,CAAC,cAAmB,kCAAa,QAAQ,KAAK;AAAA,EACvD;AACF;AAmBO,MAAM,eAAwB;AAAA,EACnC,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,sBAAS;AAAA,EAC1D,WAAW,CAAC,MAAqB;AAAA;AAAA,QAE/B,8BAAW,KAAK,OAAO,eAAe,KAAK,OAAO,MAAM,KAAK;AAAA;AACjE;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
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 getDictionary_exports = {};
|
|
20
|
+
__export(getDictionary_exports, {
|
|
21
|
+
getDictionary: () => getDictionary
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getDictionary_exports);
|
|
24
|
+
var import_getContent = require('./getContent/getContent.cjs');
|
|
25
|
+
const getDictionary = (dictionary, locale, plugins) => {
|
|
26
|
+
const props = {
|
|
27
|
+
dictionaryKey: dictionary.key,
|
|
28
|
+
dictionaryPath: dictionary.filePath,
|
|
29
|
+
keyPath: [],
|
|
30
|
+
plugins
|
|
31
|
+
};
|
|
32
|
+
return (0, import_getContent.getContent)(
|
|
33
|
+
dictionary.content,
|
|
34
|
+
props,
|
|
35
|
+
locale
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
getDictionary
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=getDictionary.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/interpreter/getDictionary.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Locales } from '@intlayer/config/client';\nimport type { Dictionary } from '../types';\nimport { getContent } from './getContent/getContent';\nimport type { Plugins, NodeProps, DeepTransformContent } from './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 Locales | `${Locales}` = Locales,\n>(\n dictionary: T,\n locale?: L,\n plugins?: Plugins[]\n) => {\n const props: NodeProps = {\n dictionaryKey: dictionary.key,\n dictionaryPath: dictionary.filePath,\n keyPath: [],\n plugins,\n };\n\n // @ts-ignore\n return getContent(\n dictionary.content,\n props,\n locale\n ) as any as DeepTransformContent<T['content']>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA2B;AAWpB,MAAM,gBAAgB,CAI3B,YACA,QACA,YACG;AACH,QAAM,QAAmB;AAAA,IACvB,eAAe,WAAW;AAAA,IAC1B,gBAAgB,WAAW;AAAA,IAC3B,SAAS,CAAC;AAAA,IACV;AAAA,EACF;AAGA,aAAO;AAAA,IACL,WAAW;AAAA,IACX;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -16,11 +16,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
findMatchingCondition: () => findMatchingCondition
|
|
19
|
+
var getEnumeration_exports = {};
|
|
20
|
+
__export(getEnumeration_exports, {
|
|
21
|
+
findMatchingCondition: () => findMatchingCondition,
|
|
22
|
+
getEnumeration: () => getEnumeration
|
|
22
23
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(getEnumeration_exports);
|
|
24
25
|
const findMatchingCondition = (enumerationContent, quantity) => {
|
|
25
26
|
const numericKeys = Object.keys(enumerationContent);
|
|
26
27
|
for (const key of numericKeys) {
|
|
@@ -33,10 +34,14 @@ const findMatchingCondition = (enumerationContent, quantity) => {
|
|
|
33
34
|
return key;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
+
};
|
|
38
|
+
const getEnumeration = (enumerationContent, quantity) => {
|
|
39
|
+
const key = findMatchingCondition(enumerationContent, quantity) ?? "fallback";
|
|
40
|
+
return enumerationContent[key];
|
|
37
41
|
};
|
|
38
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
39
43
|
0 && (module.exports = {
|
|
40
|
-
findMatchingCondition
|
|
44
|
+
findMatchingCondition,
|
|
45
|
+
getEnumeration
|
|
41
46
|
});
|
|
42
|
-
//# sourceMappingURL=
|
|
47
|
+
//# sourceMappingURL=getEnumeration.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/interpreter/getEnumeration.ts"],"sourcesContent":["import type {\n EnterFormat,\n EnumerationContentState,\n} from '../transpiler/enumeration/enumeration';\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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCO,MAAM,wBAAwB,CACnC,oBACA,aACgB;AAChB,QAAM,cAAc,OAAO,KAAK,kBAAkB;AAElD,aAAW,OAAO,aAAa;AAC7B,UAAM,UACH,CAAC,IAAI,WAAW,GAAG,KAClB,CAAC,IAAI,WAAW,GAAG,KACnB,CAAC,IAAI,WAAW,GAAG,KACnB,WAAW,GAAG,MAAM,YACrB,IAAI,WAAW,GAAG,KAAK,WAAW,IAAI,MAAM,CAAC,CAAC,MAAM;AACvD,UAAM,aACJ,IAAI,WAAW,GAAG,KAAK,WAAW,WAAW,IAAI,MAAM,CAAC,CAAC;AAC3D,UAAM,oBACJ,IAAI,WAAW,IAAI,KAAK,YAAY,WAAW,IAAI,MAAM,CAAC,CAAC;AAC7D,UAAM,aACJ,IAAI,WAAW,GAAG,KAAK,WAAW,WAAW,IAAI,MAAM,CAAC,CAAC;AAC3D,UAAM,oBACJ,IAAI,WAAW,IAAI,KAAK,YAAY,WAAW,IAAI,MAAM,CAAC,CAAC;AAE7D,QACE,WACA,cACA,qBACA,cACA,mBACA;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;AA4BO,MAAM,iBAAiB,CAC5B,oBACA,aACY;AACZ,QAAM,MACJ,sBAA+B,oBAAoB,QAAQ,KAAK;AAGlE,SAAO,mBAAmB,GAAG;AAC/B;","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
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');
|
|
36
|
+
const getIntlayer = (key, locale, plugins) => {
|
|
37
|
+
const dictionary = import_dictionaries_entry.default[key];
|
|
38
|
+
if (!dictionary) {
|
|
39
|
+
throw new Error(`Dictionary ${key} not found`, import_dictionaries_entry.default);
|
|
40
|
+
}
|
|
41
|
+
return (0, import_getDictionary.getDictionary)(
|
|
42
|
+
dictionary,
|
|
43
|
+
locale,
|
|
44
|
+
plugins
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
getIntlayer
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=getIntlayer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Locales } from '@intlayer/config';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport type { Dictionary, DictionaryKeys } from '../types';\nimport { getDictionary } from './getDictionary';\n// @ts-ignore intlayer declared for module augmentation\nimport { IntlayerDictionaryTypesConnector } from 'intlayer';\nimport type { DeepTransformContent, Plugins } from './getContent/plugins';\n\nexport const getIntlayer = <\n T extends DictionaryKeys,\n L extends Locales | `${Locales}`,\n>(\n key: T,\n locale?: L,\n plugins?: Plugins[]\n) => {\n const dictionary = dictionaries[key as T];\n\n if (!dictionary) {\n throw new Error(`Dictionary ${key as string} not found`, dictionaries);\n }\n\n return getDictionary(\n dictionary as unknown as Dictionary,\n locale,\n plugins\n ) as any as DeepTransformContent<\n IntlayerDictionaryTypesConnector[T]['content']\n >;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,gCAAyB;AAEzB,2BAA8B;AAKvB,MAAM,cAAc,CAIzB,KACA,QACA,YACG;AACH,QAAM,aAAa,0BAAAA,QAAa,GAAQ;AAExC,MAAI,CAAC,YAAY;AACf,UAAM,IAAI,MAAM,cAAc,GAAa,cAAc,0BAAAA,OAAY;AAAA,EACvE;AAEA,aAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAGF;","names":["dictionaries"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
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 getIntlayerAsync_exports = {};
|
|
20
|
+
__export(getIntlayerAsync_exports, {
|
|
21
|
+
getIntlayerAsync: () => getIntlayerAsync
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getIntlayerAsync_exports);
|
|
24
|
+
var import_api = require("@intlayer/api");
|
|
25
|
+
var import_getDictionary = require('./getDictionary.cjs');
|
|
26
|
+
const getIntlayerAsync = async (key, locale, plugins) => {
|
|
27
|
+
const jsonDistantDictionary = await (0, import_api.fetchDistantDictionary)(key);
|
|
28
|
+
if (jsonDistantDictionary) {
|
|
29
|
+
return (0, import_getDictionary.getDictionary)(jsonDistantDictionary, locale, plugins);
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
getIntlayerAsync
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=getIntlayerAsync.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/interpreter/getIntlayerAsync.ts"],"sourcesContent":["import { fetchDistantDictionary } from '@intlayer/api';\nimport type { Locales } from '@intlayer/config/client';\nimport { getDictionary } from './getDictionary';\nimport type { DictionaryKeys } from '../types';\nimport type { Plugins } from './getContent';\n\n/**\n * On the client side, Hook that picking one dictionary by its key and return the content\n *\n * This hook will prerender the locale dictionary and fetch simultaneously the distant dictionaries to hydrate it.\n *\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const getIntlayerAsync = async <\n T extends DictionaryKeys,\n L extends Locales | `${Locales}`,\n>(\n key: T,\n locale?: L,\n plugins?: Plugins[]\n) => {\n const jsonDistantDictionary = await fetchDistantDictionary(key as string);\n\n if (jsonDistantDictionary) {\n return getDictionary(jsonDistantDictionary, locale, plugins);\n }\n\n return null;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAuC;AAEvC,2BAA8B;AAYvB,MAAM,mBAAmB,OAI9B,KACA,QACA,YACG;AACH,QAAM,wBAAwB,UAAM,mCAAuB,GAAa;AAExE,MAAI,uBAAuB;AACzB,eAAO,oCAAc,uBAAuB,QAAQ,OAAO;AAAA,EAC7D;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
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 getNesting_exports = {};
|
|
20
|
+
__export(getNesting_exports, {
|
|
21
|
+
getNesting: () => getNesting
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(getNesting_exports);
|
|
24
|
+
var import_getIntlayer = require('./getIntlayer.cjs');
|
|
25
|
+
const getNesting = (dictionaryKey, path, props) => {
|
|
26
|
+
const dictionary = (0, import_getIntlayer.getIntlayer)(dictionaryKey, props?.locale, props?.plugins);
|
|
27
|
+
if (typeof path === "string") {
|
|
28
|
+
const pathArray = path.split(".");
|
|
29
|
+
let current = dictionary;
|
|
30
|
+
for (const key of pathArray) {
|
|
31
|
+
current = current?.[key];
|
|
32
|
+
if (current === void 0) {
|
|
33
|
+
return dictionary;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return current;
|
|
37
|
+
}
|
|
38
|
+
return dictionary;
|
|
39
|
+
};
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
getNesting
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=getNesting.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/interpreter/getNesting.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { ValidDotPathsFor } from '../transpiler';\nimport type { DictionaryKeys } from '../types';\nimport type {\n DeepTransformContent,\n IInterpreterPluginState,\n NodeProps,\n} from './getContent';\nimport { getIntlayer } from './getIntlayer';\n// @ts-ignore intlayer declared for module augmentation\nimport { IntlayerDictionaryTypesConnector } from 'intlayer';\n\ntype GetSubPath<T, P> = P extends `${infer K}.${infer Rest}`\n ? K extends keyof T\n ? GetSubPath<T[K], Rest>\n : never\n : P extends keyof T\n ? T[P]\n : T;\n\nexport type GetNestingResult<\n K extends DictionaryKeys,\n P = undefined,\n S = IInterpreterPluginState,\n> = GetSubPath<\n DeepTransformContent<IntlayerDictionaryTypesConnector[K]['content'], S>,\n P\n>;\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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,yBAA4B;AA8BrB,MAAM,aAAa,CACxB,eACA,MACA,UAC2B;AAC3B,QAAM,iBAAa,gCAAY,eAAe,OAAO,QAAQ,OAAO,OAAO;AAE3E,MAAI,OAAO,SAAS,UAAU;AAC5B,UAAM,YAAa,KAAgB,MAAM,GAAG;AAC5C,QAAI,UAAe;AAEnB,eAAW,OAAO,WAAW;AAE3B,gBAAU,UAAU,GAAG;AAEvB,UAAI,YAAY,QAAW;AACzB,eAAO;AAAA,MACT;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAGA,SAAO;AACT;","names":[]}
|
|
@@ -16,16 +16,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var getTranslation_exports = {};
|
|
20
|
+
__export(getTranslation_exports, {
|
|
21
|
+
getTranslation: () => getTranslation
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(getTranslation_exports);
|
|
24
24
|
var import_client = require("@intlayer/config/client");
|
|
25
|
-
const
|
|
26
|
-
const
|
|
25
|
+
const getTranslation = (languageContent, locale) => {
|
|
26
|
+
const { defaultLocale } = (0, import_client.getConfiguration)().internationalization;
|
|
27
|
+
const result = languageContent[locale ?? defaultLocale] ?? languageContent[defaultLocale];
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
27
30
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
31
|
0 && (module.exports = {
|
|
29
|
-
|
|
32
|
+
getTranslation
|
|
30
33
|
});
|
|
31
|
-
//# sourceMappingURL=
|
|
34
|
+
//# sourceMappingURL=getTranslation.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/interpreter/getTranslation.ts"],"sourcesContent":["import { type Locales, getConfiguration } from '@intlayer/config/client';\nimport type { LanguageContent } from '../transpiler/translation/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: LanguageContent<Content>,\n locale?: Locales | `${Locales}`\n): Content => {\n const { defaultLocale } = getConfiguration().internationalization;\n\n const result =\n languageContent[\n (locale ?? defaultLocale) as unknown as keyof typeof languageContent\n ] ??\n (languageContent[\n defaultLocale as unknown as keyof typeof languageContent\n ] as Content);\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA+C;AAwBxC,MAAM,iBAAiB,CAC5B,iBACA,WACY;AACZ,QAAM,EAAE,cAAc,QAAI,gCAAiB,EAAE;AAE7C,QAAM,SACJ,gBACG,UAAU,aACb,KACC,gBACC,aACF;AAEF,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var interpreter_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(interpreter_exports);
|
|
18
|
+
__reExport(interpreter_exports, require('./getContent/index.cjs'), module.exports);
|
|
19
|
+
__reExport(interpreter_exports, require('./getNesting.cjs'), module.exports);
|
|
20
|
+
__reExport(interpreter_exports, require('./getEnumeration.cjs'), module.exports);
|
|
21
|
+
__reExport(interpreter_exports, require('./getEnumeration.cjs'), module.exports);
|
|
22
|
+
__reExport(interpreter_exports, require('./getIntlayer.cjs'), module.exports);
|
|
23
|
+
__reExport(interpreter_exports, require('./getDictionary.cjs'), module.exports);
|
|
24
|
+
__reExport(interpreter_exports, require('./getIntlayerAsync.cjs'), module.exports);
|
|
25
|
+
__reExport(interpreter_exports, require('./getTranslation.cjs'), module.exports);
|
|
26
|
+
__reExport(interpreter_exports, require('./getCondition.cjs'), module.exports);
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
...require('./getContent/index.cjs'),
|
|
30
|
+
...require('./getNesting.cjs'),
|
|
31
|
+
...require('./getEnumeration.cjs'),
|
|
32
|
+
...require('./getEnumeration.cjs'),
|
|
33
|
+
...require('./getIntlayer.cjs'),
|
|
34
|
+
...require('./getDictionary.cjs'),
|
|
35
|
+
...require('./getIntlayerAsync.cjs'),
|
|
36
|
+
...require('./getTranslation.cjs'),
|
|
37
|
+
...require('./getCondition.cjs')
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/interpreter/index.ts"],"sourcesContent":["export * from './getContent/index';\nexport * from './getNesting';\nexport * from './getEnumeration';\nexport * from './getEnumeration';\nexport * from './getIntlayer';\nexport * from './getDictionary';\nexport * from './getIntlayerAsync';\nexport * from './getTranslation';\nexport * from './getCondition';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gCAAc,+BAAd;AACA,gCAAc,yBADd;AAEA,gCAAc,6BAFd;AAGA,gCAAc,6BAHd;AAIA,gCAAc,0BAJd;AAKA,gCAAc,4BALd;AAMA,gCAAc,+BANd;AAOA,gCAAc,6BAPd;AAQA,gCAAc,2BARd;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/localization/getHTMLTextDir.ts"],"sourcesContent":["import { Locales } from '@intlayer/config/client';\n\ntype Dir = 'ltr' | 'rtl' | 'auto';\n\n/**\n * Returns the text direction of the given locale.\n *\n * Example:\n *\n * getHTMLTextDir('en-US') // 'ltr'\n * getHTMLTextDir('en') // 'ltr'\n * getHTMLTextDir('fr-CA') // 'ltr'\n * getHTMLTextDir('fr') // 'ltr'\n *\n * @param locale The locale to get the text direction for.\n * @returns The text direction of the given locale.\n */\nexport const getHTMLTextDir = (locale?: Locales | `${Locales}`): Dir => {\n switch (locale) {\n case Locales.ENGLISH:\n case Locales.FRENCH:\n case Locales.SPANISH:\n case Locales.PORTUGUESE:\n case Locales.GERMAN:\n case Locales.AFRIKAANS:\n case Locales.AZERI_LATIN:\n case Locales.BELARUSIAN:\n case Locales.BULGARIAN:\n case Locales.BOSNIAN:\n case Locales.CATALAN:\n case Locales.CZECH:\n case Locales.WELSH:\n case Locales.DANISH:\n case Locales.ESPERANTO:\n case Locales.ESTONIAN:\n case Locales.BASQUE:\n case Locales.FINNISH:\n case Locales.FAROESE:\n case Locales.GALICIAN:\n case Locales.GREEK:\n case Locales.CROATIAN:\n case Locales.HUNGARIAN:\n case Locales.ARMENIAN:\n case Locales.INDONESIAN:\n case Locales.ICELANDIC:\n case Locales.ITALIAN:\n case Locales.JAPANESE:\n case Locales.GEORGIAN:\n case Locales.KAZAKH:\n case Locales.KANNADA:\n case Locales.KOREAN:\n case Locales.KONKANI:\n case Locales.KYRGYZ:\n case Locales.LITHUANIAN:\n case Locales.LATVIAN:\n case Locales.MAORI:\n case Locales.FYRO_MACEDONIAN:\n case Locales.MONGOLIAN:\n case Locales.MARATHI:\n case Locales.MALAY:\n case Locales.MALTESE:\n case Locales.NORWEGIAN_BOKMAL:\n case Locales.DUTCH:\n case Locales.NORTHERN_SOTHO:\n case Locales.PUNJABI:\n case Locales.POLISH:\n case Locales.QUECHUA:\n case Locales.ROMANIAN:\n case Locales.RUSSIAN:\n case Locales.SANSKRIT:\n case Locales.SAMI_NORTHERN:\n case Locales.SLOVAK:\n case Locales.SLOVENIAN:\n case Locales.ALBANIAN:\n case Locales.SERBIAN_LATIN:\n case Locales.SWEDISH:\n case Locales.SWAHILI:\n case Locales.TAMIL:\n case Locales.TELUGU:\n case Locales.THAI:\n case Locales.TAGALOG:\n case Locales.TSWANA:\n case Locales.TURKISH:\n case Locales.UKRAINIAN:\n case Locales.UZBEK_LATIN:\n case Locales.VIETNAMESE:\n case Locales.XHOSA:\n case Locales.CHINESE_SIMPLIFIED:\n case Locales.CHINESE_TRADITIONAL:\n case Locales.ZULU:\n case Locales.AFRIKAANS_SOUTH_AFRICA:\n case Locales.AZERI_LATIN_AZERBAIJAN:\n case Locales.BELARUSIAN_BELARUS:\n case Locales.BULGARIAN_BULGARIA:\n case Locales.BOSNIAN_BOSNIA_AND_HERZEGOVINA:\n case Locales.CATALAN_SPAIN:\n case Locales.CZECH_CZECH_REPUBLIC:\n case Locales.WELSH_UNITED_KINGDOM:\n case Locales.DANISH_DENMARK:\n case Locales.GERMAN_AUSTRIA:\n case Locales.GERMAN_SWITZERLAND:\n case Locales.GERMAN_GERMANY:\n case Locales.GERMAN_LIECHTENSTEIN:\n case Locales.GERMAN_LUXEMBOURG:\n case Locales.GREEK_GREECE:\n case Locales.ENGLISH_AUSTRALIA:\n case Locales.ENGLISH_BELIZE:\n case Locales.ENGLISH_CANADA:\n case Locales.ENGLISH_CARIBBEAN:\n case Locales.ENGLISH_UNITED_KINGDOM:\n case Locales.ENGLISH_IRELAND:\n case Locales.ENGLISH_JAMAICA:\n case Locales.ENGLISH_NEW_ZEALAND:\n case Locales.ENGLISH_PHILIPPINES:\n case Locales.ENGLISH_TRINIDAD_AND_TOBAGO:\n case Locales.ENGLISH_UNITED_STATES:\n case Locales.ENGLISH_SOUTH_AFRICA:\n case Locales.ENGLISH_ZIMBABWE:\n case Locales.SPANISH_ARGENTINA:\n case Locales.SPANISH_BOLIVIA:\n case Locales.SPANISH_CHILE:\n case Locales.SPANISH_COLOMBIA:\n case Locales.SPANISH_COSTA_RICA:\n case Locales.SPANISH_DOMINICAN_REPUBLIC:\n case Locales.SPANISH_ECUADOR:\n case Locales.SPANISH_SPAIN:\n case Locales.SPANISH_GUATEMALA:\n case Locales.SPANISH_HONDURAS:\n case Locales.SPANISH_MEXICO:\n case Locales.SPANISH_NICARAGUA:\n case Locales.SPANISH_PANAMA:\n case Locales.SPANISH_PERU:\n case Locales.SPANISH_PUERTO_RICO:\n case Locales.SPANISH_PARAGUAY:\n case Locales.SPANISH_EL_SALVADOR:\n case Locales.SPANISH_URUGUAY:\n case Locales.SPANISH_VENEZUELA:\n case Locales.ESTONIAN_ESTONIA:\n case Locales.BASQUE_SPAIN:\n case Locales.FINNISH_FINLAND:\n case Locales.FAROESE_FAROE_ISLANDS:\n case Locales.FRENCH_BELGIUM:\n case Locales.FRENCH_CANADA:\n case Locales.FRENCH_SWITZERLAND:\n case Locales.FRENCH_FRANCE:\n case Locales.FRENCH_LUXEMBOURG:\n case Locales.FRENCH_PRINCIPALITY_OF_MONACO:\n case Locales.GALICIAN_SPAIN:\n case Locales.GUJARATI_INDIA:\n case Locales.HEBREW_ISRAEL:\n case Locales.HINDI_INDIA:\n case Locales.CROATIAN_BOSNIA_AND_HERZEGOVINA:\n case Locales.CROATIAN_CROATIA:\n case Locales.HUNGARIAN_HUNGARY:\n case Locales.ARMENIAN_ARMENIA:\n case Locales.INDONESIAN_INDONESIA:\n case Locales.ICELANDIC_ICELAND:\n case Locales.ITALIAN_SWITZERLAND:\n case Locales.ITALIAN_ITALY:\n case Locales.JAPANESE_JAPAN:\n case Locales.GEORGIAN_GEORGIA:\n case Locales.KAZAKH_KAZAKHSTAN:\n case Locales.KANNADA_INDIA:\n case Locales.KOREAN_KOREA:\n case Locales.KONKANI_INDIA:\n case Locales.KYRGYZ_KYRGYZSTAN:\n case Locales.LITHUANIAN_LITHUANIA:\n case Locales.LATVIAN_LATVIA:\n case Locales.MAORI_NEW_ZEALAND:\n case Locales.FYRO_MACEDONIAN_MACEDONIA:\n case Locales.MONGOLIAN_MONGOLIA:\n case Locales.MARATHI_INDIA:\n case Locales.MALAY_BRUNEI_DARUSSALAM:\n case Locales.MALAY_MALAYSIA:\n case Locales.MALTESE_MALTA:\n case Locales.NORWEGIAN_BOKMAL_NORWAY:\n case Locales.DUTCH_BELGIUM:\n case Locales.DUTCH_NETHERLANDS:\n case Locales.NORWEGIAN_NYNORSK_NORWAY:\n case Locales.NORTHERN_SOTHO_SOUTH_AFRICA:\n case Locales.PUNJABI_INDIA:\n case Locales.POLISH_POLAND:\n case Locales.PORTUGUESE_BRAZIL:\n case Locales.PORTUGUESE_PORTUGAL:\n case Locales.QUECHUA_BOLIVIA:\n case Locales.QUECHUA_ECUADOR:\n case Locales.QUECHUA_PERU:\n case Locales.ROMANIAN_ROMANIA:\n case Locales.RUSSIAN_RUSSIA:\n case Locales.SANSKRIT_INDIA:\n case Locales.SAMI_NORTHERN_FINLAND:\n case Locales.SAMI_NORTHERN_NORWAY:\n case Locales.SAMI_NORTHERN_SWEDEN:\n case Locales.SLOVAK_SLOVAKIA:\n case Locales.SLOVENIAN_SLOVENIA:\n case Locales.ALBANIAN_ALBANIA:\n case Locales.SERBIAN_LATIN_BOSNIA_AND_HERZEGOVINA:\n case Locales.SERBIAN_LATIN_SERBIA_AND_MONTENEGRO:\n case Locales.SWAHILI_KENYA:\n case Locales.TAMIL_INDIA:\n case Locales.TELUGU_INDIA:\n case Locales.THAI_THAILAND:\n case Locales.TAGALOG_PHILIPPINES:\n case Locales.TSWANA_SOUTH_AFRICA:\n case Locales.TURKISH_TURKEY:\n case Locales.TATAR_RUSSIA:\n case Locales.TSOGA:\n case Locales.UKRAINIAN_UKRAINE:\n case Locales.UZBEK_LATIN_UZBEKISTAN:\n case Locales.VIETNAMESE_VIET_NAM:\n case Locales.XHOSA_SOUTH_AFRICA:\n case Locales.CHINESE_HONG_KONG:\n case Locales.CHINESE_MACAU:\n case Locales.CHINESE_SINGAPORE:\n case Locales.ZULU_SOUTH_AFRICA:\n return 'ltr';\n\n case Locales.ARABIC:\n case Locales.FARSI:\n case Locales.URDU:\n case Locales.PASHTO:\n case Locales.SYRIAC:\n case Locales.ARABIC_UNITED_ARAB_EMIRATES:\n case Locales.ARABIC_BAHRAIN:\n case Locales.ARABIC_ALGERIA:\n case Locales.ARABIC_EGYPT:\n case Locales.ARABIC_IRAQ:\n case Locales.ARABIC_JORDAN:\n case Locales.ARABIC_KUWAIT:\n case Locales.ARABIC_LEBANON:\n case Locales.ARABIC_LIBYA:\n case Locales.ARABIC_MOROCCO:\n case Locales.ARABIC_OMAN:\n case Locales.ARABIC_QATAR:\n case Locales.ARABIC_SAUDI_ARABIA:\n case Locales.ARABIC_SYRIA:\n case Locales.ARABIC_TUNISIA:\n case Locales.ARABIC_YEMEN:\n case Locales.FARSI_IRAN:\n case Locales.URDU_ISLAMIC_REPUBLIC_OF_PAKISTAN:\n case Locales.PASHTO_AFGHANISTAN:\n case Locales.SYRIAC_SYRIA:\n return 'rtl';\n\n default:\n return 'auto';\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAwB;AAiBjB,MAAM,iBAAiB,CAAC,WAAyC;AACtE,UAAQ,QAAQ;AAAA,IACd,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAA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AAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AAAA,IACb,KAAK,sBAAQ;AACX,aAAO;AAAA,IAET;AACE,aAAO;AAAA,EACX;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/localization/getLocaleLang.ts"],"sourcesContent":["import type { Locales } from '@intlayer/config/client';\n\n/**\n * Returns the language code of the given locale for locales including the country code.\n *\n * Example:\n *\n * getLocaleLang('en-US') // 'en'\n * getLocaleLang('en') // 'en'\n * getLocaleLang('fr-CA') // 'fr'\n * getLocaleLang('fr') // 'fr'\n *\n * @param locale The locale to get the language code for.\n * @returns The language code of the given locale.\n */\nexport const getLocaleLang = (locale?: Locales | `${Locales}`): string =>\n locale?.split('-')[0] ?? '';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,MAAM,gBAAgB,CAAC,WAC5B,QAAQ,MAAM,GAAG,EAAE,CAAC,KAAK;","names":[]}
|