@intlayer/core 7.0.8 → 7.0.9-canary.2
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/README.md +6 -5
- package/dist/cjs/config/dist/esm/_virtual/rolldown_runtime.cjs +20 -0
- package/dist/cjs/config/dist/esm/_virtual/rolldown_runtime.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/built.cjs +8 -0
- package/dist/cjs/config/dist/esm/built.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/configFile/buildConfigurationFields.cjs +119 -0
- package/dist/cjs/config/dist/esm/configFile/buildConfigurationFields.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/configFile/getConfiguration.cjs +69 -0
- package/dist/cjs/config/dist/esm/configFile/getConfiguration.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/configFile/loadConfigurationFile.cjs +26 -0
- package/dist/cjs/config/dist/esm/configFile/loadConfigurationFile.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/configFile/searchConfigurationFile.cjs +51 -0
- package/dist/cjs/config/dist/esm/configFile/searchConfigurationFile.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/build.cjs +24 -0
- package/dist/cjs/config/dist/esm/defaultValues/build.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/content.cjs +78 -0
- package/dist/cjs/config/dist/esm/defaultValues/content.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/dictionary.cjs +7 -0
- package/dist/cjs/config/dist/esm/defaultValues/dictionary.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/editor.cjs +36 -0
- package/dist/cjs/config/dist/esm/defaultValues/editor.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/index.cjs +21 -0
- package/dist/cjs/config/dist/esm/defaultValues/index.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/internationalization.cjs +22 -0
- package/dist/cjs/config/dist/esm/defaultValues/internationalization.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/log.cjs +16 -0
- package/dist/cjs/config/dist/esm/defaultValues/log.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/defaultValues/routing.cjs +26 -0
- package/dist/cjs/config/dist/esm/defaultValues/routing.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/loadEnvFile.cjs +26 -0
- package/dist/cjs/config/dist/esm/loadEnvFile.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/bundleFile.cjs +23 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/bundleFile.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/loadExternalFile.cjs +47 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/loadExternalFile.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/parseFileContent.cjs +65 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/parseFileContent.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs +45 -0
- package/dist/cjs/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/logger.cjs +65 -0
- package/dist/cjs/config/dist/esm/logger.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs +15 -0
- package/dist/cjs/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/types/dist/esm/locales.cjs +1128 -0
- package/dist/cjs/config/dist/esm/types/dist/esm/locales.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/utils/ESMxCJSHelpers.cjs +27 -0
- package/dist/cjs/config/dist/esm/utils/ESMxCJSHelpers.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/utils/cache.cjs +261 -0
- package/dist/cjs/config/dist/esm/utils/cache.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/utils/clearModuleCache.cjs +26 -0
- package/dist/cjs/config/dist/esm/utils/clearModuleCache.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/utils/getPackageJsonPath.cjs +34 -0
- package/dist/cjs/config/dist/esm/utils/getPackageJsonPath.cjs.map +1 -0
- package/dist/cjs/config/dist/esm/utils/normalizePath.cjs +17 -0
- package/dist/cjs/config/dist/esm/utils/normalizePath.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/_virtual/rolldown_runtime.cjs +10 -0
- package/dist/cjs/dictionaries-entry/dist/esm/_virtual/rolldown_runtime.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/_virtual/rolldown_runtime.cjs +11 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/_virtual/rolldown_runtime.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/built.cjs +8 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/built.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/buildConfigurationFields.cjs +119 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/buildConfigurationFields.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/getConfiguration.cjs +69 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/getConfiguration.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/loadConfigurationFile.cjs +26 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/loadConfigurationFile.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/searchConfigurationFile.cjs +51 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/configFile/searchConfigurationFile.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/build.cjs +15 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/build.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/content.cjs +54 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/content.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/dictionary.cjs +7 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/dictionary.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/editor.cjs +23 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/editor.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/internationalization.cjs +14 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/internationalization.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/log.cjs +10 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/log.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/routing.cjs +11 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/routing.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadEnvFile.cjs +26 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadEnvFile.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/bundleFile.cjs +23 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/bundleFile.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.cjs +47 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.cjs +65 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs +45 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/logger.cjs +47 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/logger.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs +15 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/locales.cjs +1128 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/locales.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.cjs +27 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/cache.cjs +261 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/cache.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/getPackageJsonPath.cjs +34 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/getPackageJsonPath.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/normalizePath.cjs +17 -0
- package/dist/cjs/dictionaries-entry/dist/esm/config/dist/esm/utils/normalizePath.cjs.map +1 -0
- package/dist/cjs/dictionaries-entry/dist/esm/index.cjs +27 -0
- package/dist/cjs/dictionaries-entry/dist/esm/index.cjs.map +1 -0
- package/dist/cjs/types/dist/esm/_virtual/rolldown_runtime.cjs +15 -0
- package/dist/cjs/types/dist/esm/_virtual/rolldown_runtime.cjs.map +1 -0
- package/dist/cjs/types/dist/esm/locales.cjs +1128 -0
- package/dist/cjs/types/dist/esm/locales.cjs.map +1 -0
- package/dist/cjs/types/dist/esm/nodeType.cjs +31 -0
- package/dist/cjs/types/dist/esm/nodeType.cjs.map +1 -0
- package/dist/esm/_virtual/rolldown_runtime.mjs +8 -0
- package/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs +20 -0
- package/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs.map +1 -0
- package/dist/esm/config/dist/esm/built.mjs +8 -0
- package/dist/esm/config/dist/esm/built.mjs.map +1 -0
- package/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs +118 -0
- package/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -0
- package/dist/esm/config/dist/esm/configFile/getConfiguration.mjs +67 -0
- package/dist/esm/config/dist/esm/configFile/getConfiguration.mjs.map +1 -0
- package/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs +26 -0
- package/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -0
- package/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs +50 -0
- package/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/build.mjs +19 -0
- package/dist/esm/config/dist/esm/defaultValues/build.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/content.mjs +64 -0
- package/dist/esm/config/dist/esm/defaultValues/content.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/dictionary.mjs +6 -0
- package/dist/esm/config/dist/esm/defaultValues/dictionary.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/editor.mjs +27 -0
- package/dist/esm/config/dist/esm/defaultValues/editor.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/index.mjs +21 -0
- package/dist/esm/config/dist/esm/defaultValues/index.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/internationalization.mjs +18 -0
- package/dist/esm/config/dist/esm/defaultValues/internationalization.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/log.mjs +14 -0
- package/dist/esm/config/dist/esm/defaultValues/log.mjs.map +1 -0
- package/dist/esm/config/dist/esm/defaultValues/routing.mjs +23 -0
- package/dist/esm/config/dist/esm/defaultValues/routing.mjs.map +1 -0
- package/dist/esm/config/dist/esm/loadEnvFile.mjs +24 -0
- package/dist/esm/config/dist/esm/loadEnvFile.mjs.map +1 -0
- package/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs +23 -0
- package/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs.map +1 -0
- package/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs +47 -0
- package/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -0
- package/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs +63 -0
- package/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -0
- package/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs +44 -0
- package/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs.map +1 -0
- package/dist/esm/config/dist/esm/logger.mjs +59 -0
- package/dist/esm/config/dist/esm/logger.mjs.map +1 -0
- package/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs +14 -0
- package/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs.map +1 -0
- package/dist/esm/config/dist/esm/types/dist/esm/locales.mjs +1128 -0
- package/dist/esm/config/dist/esm/types/dist/esm/locales.mjs.map +1 -0
- package/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs +25 -0
- package/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -0
- package/dist/esm/config/dist/esm/utils/cache.mjs +263 -0
- package/dist/esm/config/dist/esm/utils/cache.mjs.map +1 -0
- package/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs +33 -0
- package/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs.map +1 -0
- package/dist/esm/config/dist/esm/utils/normalizePath.mjs +16 -0
- package/dist/esm/config/dist/esm/utils/normalizePath.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/_virtual/rolldown_runtime.mjs +11 -0
- package/dist/esm/dictionaries-entry/dist/esm/_virtual/rolldown_runtime.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs +11 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/_virtual/rolldown_runtime.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/built.mjs +8 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/built.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs +118 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/buildConfigurationFields.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/getConfiguration.mjs +67 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/getConfiguration.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs +26 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/loadConfigurationFile.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs +50 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/configFile/searchConfigurationFile.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/build.mjs +10 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/build.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/content.mjs +40 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/content.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/dictionary.mjs +6 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/dictionary.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/editor.mjs +14 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/editor.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/internationalization.mjs +11 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/internationalization.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/log.mjs +9 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/log.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/routing.mjs +8 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/defaultValues/routing.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadEnvFile.mjs +24 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadEnvFile.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs +23 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/bundleFile.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs +47 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/loadExternalFile.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs +63 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/parseFileContent.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs +44 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/loadExternalFile/transpileTSToMJS.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/logger.mjs +45 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/logger.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs +14 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/locales.mjs +1128 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/types/dist/esm/locales.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs +25 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/ESMxCJSHelpers.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/cache.mjs +263 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/cache.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs +33 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/getPackageJsonPath.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/normalizePath.mjs +16 -0
- package/dist/esm/dictionaries-entry/dist/esm/config/dist/esm/utils/normalizePath.mjs.map +1 -0
- package/dist/esm/dictionaries-entry/dist/esm/index.mjs +25 -0
- package/dist/esm/dictionaries-entry/dist/esm/index.mjs.map +1 -0
- package/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs +14 -0
- package/dist/esm/types/dist/esm/_virtual/rolldown_runtime.mjs.map +1 -0
- package/dist/esm/types/dist/esm/locales.mjs +1128 -0
- package/dist/esm/types/dist/esm/locales.mjs.map +1 -0
- package/dist/esm/types/dist/esm/nodeType.mjs +29 -0
- package/dist/esm/types/dist/esm/nodeType.mjs.map +1 -0
- package/dist/index.d.mts +1323 -0
- package/dist/index.mjs +3348 -0
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +7 -7
- package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +7 -7
- package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -1
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +7 -7
- package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -1
- package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
- package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -1
- package/package.json +20 -17
- package/dist/cjs/dictionaryManipulator/getUnmergedDictionaryByKeyPath.cjs +0 -20
- package/dist/cjs/dictionaryManipulator/getUnmergedDictionaryByKeyPath.cjs.map +0 -1
- package/dist/esm/dictionaryManipulator/getUnmergedDictionaryByKeyPath.mjs +0 -17
- package/dist/esm/dictionaryManipulator/getUnmergedDictionaryByKeyPath.mjs.map +0 -1
- package/dist/types/deepTransformPlugins/index.d.ts.map +0 -1
- package/dist/types/dictionaryManipulator/getUnmergedDictionaryByKeyPath.d.ts +0 -9
- package/dist/types/dictionaryManipulator/getUnmergedDictionaryByKeyPath.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
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1323 @@
|
|
|
1
|
+
import * as _intlayer_types0 from "@intlayer/types";
|
|
2
|
+
import { ContentNode, CookiesAttributes, DeclaredLocales, Dictionary, DictionaryKeys, DictionaryRegistryContent, GetSubPath, IntlayerConfig, KeyPath, Locale, LocalesValues, NodeType, StrictModeLocaleMap, TypedNodeModel } from "@intlayer/types";
|
|
3
|
+
|
|
4
|
+
//#region src/transpiler/condition/condition.d.ts
|
|
5
|
+
type ConditionContentStates<Content> = Record<`${boolean}`, Content> & {
|
|
6
|
+
fallback?: Content;
|
|
7
|
+
};
|
|
8
|
+
type ConditionContent<Content = unknown> = TypedNodeModel<NodeType.Condition, ConditionContentStates<Content>>;
|
|
9
|
+
/**
|
|
10
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
11
|
+
*
|
|
12
|
+
* Allow to pick a content based on a condition.
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* cond({
|
|
18
|
+
* 'true': 'The condition is validated',
|
|
19
|
+
* 'false': 'The condition is not validated',
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* The last key provided will be used as the fallback value.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
declare const condition: <Content>(content?: ConditionContentStates<Content>) => TypedNodeModel<NodeType.Condition, ConditionContentStates<Content> | undefined, {}>;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/transpiler/enumeration/enumeration.d.ts
|
|
29
|
+
type Positive = number | `${number}`;
|
|
30
|
+
type Negative = `-${number}`;
|
|
31
|
+
type Numbers = Positive | Negative;
|
|
32
|
+
type Equal = Numbers;
|
|
33
|
+
type EqualString = `=${Numbers}`;
|
|
34
|
+
type Superior = `>${Numbers}`;
|
|
35
|
+
type SuperiorOrEqual = `>=${Numbers}`;
|
|
36
|
+
type Inferior = `<${Numbers}`;
|
|
37
|
+
type InferiorOrEqual = `<=${Numbers}`;
|
|
38
|
+
type EnterFormat = Equal | EqualString | Superior | SuperiorOrEqual | Inferior | InferiorOrEqual;
|
|
39
|
+
type EnumerationContentState<Content> = Partial<Record<EnterFormat, Content>> & {
|
|
40
|
+
fallback?: Content;
|
|
41
|
+
};
|
|
42
|
+
type EnumerationContent<Content = unknown> = TypedNodeModel<NodeType.Enumeration, EnumerationContentState<Content>>;
|
|
43
|
+
/**
|
|
44
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
45
|
+
*
|
|
46
|
+
* Allow to pick a content based on a quantity.
|
|
47
|
+
*
|
|
48
|
+
* Usage:
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* enu({
|
|
52
|
+
* '<=-2.3': 'You have less than -2.3',
|
|
53
|
+
* '<1': 'You have less than one',
|
|
54
|
+
* '2': 'You have two',
|
|
55
|
+
* '>=3': 'You have three or more',
|
|
56
|
+
* });
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* > The order of the keys will define the priority of the content.
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
declare const enumeration: <Content>(content?: EnumerationContentState<Content>) => TypedNodeModel<NodeType.Enumeration, EnumerationContentState<Content> | undefined, {}>;
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/transpiler/file/file.d.ts
|
|
65
|
+
type FileContentConstructor<T extends Record<string, any> = {}> = TypedNodeModel<NodeType.File, string, T>;
|
|
66
|
+
type FileContent = FileContentConstructor<{
|
|
67
|
+
content: string;
|
|
68
|
+
fixedPath?: string;
|
|
69
|
+
}>;
|
|
70
|
+
declare const fileContent: (path: string, callerDir: string, baseDir: string) => FileContent;
|
|
71
|
+
/**
|
|
72
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
73
|
+
*
|
|
74
|
+
* Allow identify the usage of an external resource.
|
|
75
|
+
*
|
|
76
|
+
* Usage:
|
|
77
|
+
*
|
|
78
|
+
* ```ts
|
|
79
|
+
* file('/path/to/file.md') // absolute path
|
|
80
|
+
*
|
|
81
|
+
* // or
|
|
82
|
+
*
|
|
83
|
+
* file('path/to/file.md') // relative path
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
declare const file: (path: string) => FileContent;
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/transpiler/gender/gender.d.ts
|
|
89
|
+
type Gender = 'male' | 'female' | 'fallback';
|
|
90
|
+
type GenderContentStates<Content> = Record<`${Gender}`, Content> & {
|
|
91
|
+
fallback?: Content;
|
|
92
|
+
};
|
|
93
|
+
type GenderContent<Content = unknown> = TypedNodeModel<NodeType.Gender, GenderContentStates<Content>>;
|
|
94
|
+
/**
|
|
95
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
96
|
+
*
|
|
97
|
+
* Allow to pick a content based on a gender.
|
|
98
|
+
*
|
|
99
|
+
* Usage:
|
|
100
|
+
*
|
|
101
|
+
* ```ts
|
|
102
|
+
* gender({
|
|
103
|
+
* 'true': 'The gender is validated',
|
|
104
|
+
* 'false': 'The gender is not validated',
|
|
105
|
+
* });
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* The last key provided will be used as the fallback value.
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
declare const gender: <Content>(content?: GenderContentStates<Content>) => TypedNodeModel<NodeType.Gender, GenderContentStates<Content> | undefined, {}>;
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region src/transpiler/insertion/getInsertionValues.d.ts
|
|
114
|
+
declare const getInsertionValues: (content: string) => string[];
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/transpiler/insertion/insertion.d.ts
|
|
117
|
+
type InsertionContentConstructor<Content = unknown, T extends Record<string, any> = {}> = TypedNodeModel<NodeType.Insertion, Content, T>;
|
|
118
|
+
type InsertionContent<Content = unknown> = InsertionContentConstructor<Content, {
|
|
119
|
+
fields: string[];
|
|
120
|
+
}>;
|
|
121
|
+
/**
|
|
122
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
123
|
+
*
|
|
124
|
+
* Allow to identify insertions inside a content.
|
|
125
|
+
*
|
|
126
|
+
* Usage:
|
|
127
|
+
*
|
|
128
|
+
* ```ts
|
|
129
|
+
* insertion('Hi, my name is {{name}} and I am {{age}} years old.')
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
*/
|
|
133
|
+
declare const insertion: <Content = unknown>(content: Content) => InsertionContent<Content>;
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/transpiler/markdown/getMarkdownMetadata.d.ts
|
|
136
|
+
declare const getMarkdownMetadata: <T extends Record<string, any>>(markdown: string) => T;
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/transpiler/markdown/markdown.d.ts
|
|
139
|
+
type MarkdownContentConstructor<T extends Record<string, any> = {}, Content = unknown> = TypedNodeModel<NodeType.Markdown, Content, T>;
|
|
140
|
+
type MarkdownContent<_Content = unknown> = MarkdownContentConstructor<{
|
|
141
|
+
metadata?: Record<string, any>;
|
|
142
|
+
}>;
|
|
143
|
+
/**
|
|
144
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
145
|
+
*
|
|
146
|
+
* Allow to pick a content based on a quantity.
|
|
147
|
+
*
|
|
148
|
+
* Usage:
|
|
149
|
+
*
|
|
150
|
+
* ```ts
|
|
151
|
+
* markdown('## Hello world!');
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
*/
|
|
155
|
+
declare const markdown: <Content = unknown>(content: Content) => MarkdownContent;
|
|
156
|
+
//#endregion
|
|
157
|
+
//#region src/transpiler/nesting/nesting.d.ts
|
|
158
|
+
/**
|
|
159
|
+
* Recursively builds dot-notation strings for all valid paths in T.
|
|
160
|
+
* Example:
|
|
161
|
+
* type X = { a: { b: { c: string }}, d: number };
|
|
162
|
+
* DotPath<X> = "a" | "a.b" | "a.b.c" | "d"
|
|
163
|
+
*/
|
|
164
|
+
type DotPath<T> = T extends object ? { [K in keyof T & (string | number)]: T[K] extends object ?
|
|
165
|
+
// Either just K, or K + '.' + deeper path
|
|
166
|
+
`${K}` | `${K}.${DotPath<T[K]>}` : `${K}` }[keyof T & (string | number)] : never;
|
|
167
|
+
type DeepReplace<T, From, To> = T extends From ? To : T extends object ? { [K in keyof T]: DeepReplace<T[K], From, To> } : T;
|
|
168
|
+
/** Build all valid dot-notation strings for a dictionary entry. */
|
|
169
|
+
type ValidDotPathsFor<K$1 extends DictionaryKeys> = DotPath<DeepReplace<DeepTransformContent<DictionaryRegistryContent<K$1>>, {
|
|
170
|
+
type: any;
|
|
171
|
+
props: any;
|
|
172
|
+
key: any;
|
|
173
|
+
}, string>>;
|
|
174
|
+
type NestedContentState<K$1 extends DictionaryKeys> = {
|
|
175
|
+
dictionaryKey: K$1;
|
|
176
|
+
/**
|
|
177
|
+
* Path must match existing keys in DictionaryRegistryContent<K>.
|
|
178
|
+
* Can be either:
|
|
179
|
+
* - "dot.dot.dot" format
|
|
180
|
+
*/
|
|
181
|
+
path?: ValidDotPathsFor<K$1>;
|
|
182
|
+
};
|
|
183
|
+
type NestedContent<K$1 extends DictionaryKeys = never> = TypedNodeModel<NodeType.Nested, NestedContentState<K$1>>;
|
|
184
|
+
/**
|
|
185
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
186
|
+
*
|
|
187
|
+
* Allow to extract the content of another dictionary and nest it in the current dictionary.
|
|
188
|
+
*
|
|
189
|
+
* Usage:
|
|
190
|
+
*
|
|
191
|
+
* ```ts
|
|
192
|
+
* nest("dictionaryKey");
|
|
193
|
+
* nest("dictionaryKey", "path.to.content");
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* The order of the keys will define the priority of the content.
|
|
197
|
+
*
|
|
198
|
+
*/
|
|
199
|
+
declare const nesting: <K$1 extends DictionaryKeys>(dictionaryKey: K$1, path?: ValidDotPathsFor<K$1>) => NestedContent<K$1>;
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/transpiler/translation/translation.d.ts
|
|
202
|
+
type TranslationContent<Content = unknown, RecordContent extends StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>> = TypedNodeModel<NodeType.Translation, RecordContent>;
|
|
203
|
+
/**
|
|
204
|
+
*
|
|
205
|
+
* Function intended to be used to build intlayer dictionaries.
|
|
206
|
+
*
|
|
207
|
+
* Get the content of a translation based on the locale.
|
|
208
|
+
*
|
|
209
|
+
* Usage:
|
|
210
|
+
*
|
|
211
|
+
* ```ts
|
|
212
|
+
* translation<string>({
|
|
213
|
+
* "en": "Hello",
|
|
214
|
+
* "fr": "Bonjour",
|
|
215
|
+
* // ... any other available locale
|
|
216
|
+
* })
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* Using TypeScript:
|
|
220
|
+
* - this function require each locale to be defined if defined in the project configuration.
|
|
221
|
+
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
222
|
+
*/
|
|
223
|
+
declare const translation: <Content = unknown, ContentRecord extends StrictModeLocaleMap<Content> = StrictModeLocaleMap<Content>>(content: ContentRecord) => TypedNodeModel<NodeType.Translation, ContentRecord, {
|
|
224
|
+
nodeType: NodeType.Translation | "translation";
|
|
225
|
+
} & {
|
|
226
|
+
translation: ContentRecord;
|
|
227
|
+
}>;
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/interpreter/getCondition.d.ts
|
|
230
|
+
/**
|
|
231
|
+
* Allow to pick a content based on a condition.
|
|
232
|
+
*
|
|
233
|
+
* Usage:
|
|
234
|
+
*
|
|
235
|
+
* ```ts
|
|
236
|
+
* const content = getCondition({
|
|
237
|
+
* 'true': 'The condition is validated',
|
|
238
|
+
* 'false': 'The condition is not validated',
|
|
239
|
+
* }, true);
|
|
240
|
+
* // 'The condition is validated'
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* The last key provided will be used as the fallback value.
|
|
244
|
+
*
|
|
245
|
+
* ```ts
|
|
246
|
+
* const content = getCondition({
|
|
247
|
+
* 'false': 'The condition is not validated',
|
|
248
|
+
* 'true': 'The condition is validated',
|
|
249
|
+
* }, undefined);
|
|
250
|
+
* // 'The condition is validated'
|
|
251
|
+
*/
|
|
252
|
+
declare const getCondition: <Content>(conditionContent: ConditionContentStates<Content>, state?: boolean) => Content;
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/interpreter/getNesting.d.ts
|
|
255
|
+
type GetNestingResult<K$1 extends DictionaryKeys, P$1 = undefined, S = IInterpreterPluginState> = GetSubPath<DeepTransformContent<DictionaryRegistryContent<K$1>, S>, P$1>;
|
|
256
|
+
/**
|
|
257
|
+
* Allow to extract the content of another dictionary.
|
|
258
|
+
*
|
|
259
|
+
* Usage:
|
|
260
|
+
* ```ts
|
|
261
|
+
* const content = getNesting("dictionaryKey", "path.to.content");
|
|
262
|
+
* // 'Example content'
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
declare const getNesting: <K$1 extends DictionaryKeys, P$1>(dictionaryKey: K$1, path?: P$1 extends ValidDotPathsFor<K$1> ? P$1 : never, props?: NodeProps) => GetNestingResult<K$1, P$1>;
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/interpreter/getContent/plugins.d.ts
|
|
268
|
+
/** ---------------------------------------------
|
|
269
|
+
* PLUGIN DEFINITION
|
|
270
|
+
* --------------------------------------------- */
|
|
271
|
+
/**
|
|
272
|
+
* A plugin/transformer that can optionally transform a node during a single DFS pass.
|
|
273
|
+
* - `canHandle` decides if the node is transformable by this plugin.
|
|
274
|
+
* - `transform` returns the transformed node (and does not recurse further).
|
|
275
|
+
*
|
|
276
|
+
* > `transformFn` is a function that can be used to deeply transform inside the plugin.
|
|
277
|
+
*/
|
|
278
|
+
type Plugins = {
|
|
279
|
+
id: string;
|
|
280
|
+
canHandle: (node: any) => boolean;
|
|
281
|
+
transform: (node: any, props: NodeProps, transformFn: (node: any, props: NodeProps) => any) => any;
|
|
282
|
+
};
|
|
283
|
+
/** ---------------------------------------------
|
|
284
|
+
* TRANSLATION PLUGIN
|
|
285
|
+
* --------------------------------------------- */
|
|
286
|
+
type TranslationCond<T, S, L extends LocalesValues> = T extends {
|
|
287
|
+
nodeType: NodeType | string;
|
|
288
|
+
[NodeType.Translation]: infer U;
|
|
289
|
+
} ? U extends Record<PropertyKey, unknown> ? L extends keyof U ? DeepTransformContent<U[L], S> : DeepTransformContent<U[keyof U], S> : never : never;
|
|
290
|
+
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
291
|
+
declare const translationPlugin: (locale: LocalesValues, fallback?: LocalesValues) => Plugins;
|
|
292
|
+
/** ---------------------------------------------
|
|
293
|
+
* ENUMERATION PLUGIN
|
|
294
|
+
* --------------------------------------------- */
|
|
295
|
+
type EnumerationCond<T, S, L> = T extends {
|
|
296
|
+
nodeType: NodeType | string;
|
|
297
|
+
[NodeType.Enumeration]: object;
|
|
298
|
+
} ? (quantity: number) => DeepTransformContent<T[NodeType.Enumeration][keyof T[NodeType.Enumeration]], S> : never;
|
|
299
|
+
/** Enumeration plugin. Replaces node with a function that takes quantity => string. */
|
|
300
|
+
declare const enumerationPlugin: Plugins;
|
|
301
|
+
/** ---------------------------------------------
|
|
302
|
+
* CONDITION PLUGIN
|
|
303
|
+
* --------------------------------------------- */
|
|
304
|
+
type ConditionCond<T, S, L> = T extends {
|
|
305
|
+
nodeType: NodeType | string;
|
|
306
|
+
[NodeType.Condition]: object;
|
|
307
|
+
} ? (value: boolean) => DeepTransformContent<T[NodeType.Condition][keyof T[NodeType.Condition]], S> : never;
|
|
308
|
+
/** Condition plugin. Replaces node with a function that takes boolean => string. */
|
|
309
|
+
declare const conditionPlugin: Plugins;
|
|
310
|
+
/** ---------------------------------------------
|
|
311
|
+
* GENDER PLUGIN
|
|
312
|
+
* --------------------------------------------- */
|
|
313
|
+
type GenderCond<T, S, L> = T extends {
|
|
314
|
+
nodeType: NodeType | string;
|
|
315
|
+
[NodeType.Gender]: object;
|
|
316
|
+
} ? (value: Gender) => DeepTransformContent<T[NodeType.Gender][keyof T[NodeType.Gender]], S> : never;
|
|
317
|
+
/** Gender plugin. Replaces node with a function that takes gender => string. */
|
|
318
|
+
declare const genderPlugin: Plugins;
|
|
319
|
+
/** ---------------------------------------------
|
|
320
|
+
* INSERTION PLUGIN
|
|
321
|
+
* --------------------------------------------- */
|
|
322
|
+
type InsertionCond<T, S, L> = T extends {
|
|
323
|
+
nodeType: NodeType | string;
|
|
324
|
+
[NodeType.Insertion]: infer I;
|
|
325
|
+
fields?: infer U;
|
|
326
|
+
} ? U extends readonly string[] ? (data: Record<U[number], string | number>) => DeepTransformContent<I, S> : (data: Record<string, string | number>) => DeepTransformContent<I, S> : never;
|
|
327
|
+
declare const insertionPlugin: Plugins;
|
|
328
|
+
/** ---------------------------------------------
|
|
329
|
+
* NESTED PLUGIN
|
|
330
|
+
* --------------------------------------------- */
|
|
331
|
+
type NestedCond<T, S, L> = T extends {
|
|
332
|
+
nodeType: NodeType | string;
|
|
333
|
+
[NodeType.Nested]: infer U;
|
|
334
|
+
} ? U extends {
|
|
335
|
+
dictionaryKey: infer K extends DictionaryKeys;
|
|
336
|
+
path?: infer P;
|
|
337
|
+
} ? GetNestingResult<K, P, S> : never : never;
|
|
338
|
+
/** Nested plugin. Replaces node with the result of `getNesting`. */
|
|
339
|
+
declare const nestedPlugin: Plugins;
|
|
340
|
+
type FileCond<T> = T extends {
|
|
341
|
+
nodeType: NodeType | string;
|
|
342
|
+
[NodeType.File]: string;
|
|
343
|
+
content?: string;
|
|
344
|
+
} ? string : never;
|
|
345
|
+
/** File plugin. Replaces node with the result of `getNesting`. */
|
|
346
|
+
declare const filePlugin: Plugins;
|
|
347
|
+
/**
|
|
348
|
+
* PLUGIN RESULT
|
|
349
|
+
*/
|
|
350
|
+
/**
|
|
351
|
+
* Interface that defines the properties of a node.
|
|
352
|
+
* This interface can be augmented in other packages, such as `react-intlayer`.
|
|
353
|
+
*/
|
|
354
|
+
interface NodeProps {
|
|
355
|
+
dictionaryKey: string;
|
|
356
|
+
keyPath: KeyPath[];
|
|
357
|
+
plugins?: Plugins[];
|
|
358
|
+
locale?: Locale;
|
|
359
|
+
dictionaryPath?: string;
|
|
360
|
+
children?: any;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Interface that defines the plugins that can be used to transform a node.
|
|
364
|
+
* This interface can be augmented in other packages, such as `react-intlayer`.
|
|
365
|
+
*/
|
|
366
|
+
interface IInterpreterPlugin<T, S, L extends LocalesValues> {
|
|
367
|
+
translation: TranslationCond<T, S, L>;
|
|
368
|
+
insertion: InsertionCond<T, S, L>;
|
|
369
|
+
enumeration: EnumerationCond<T, S, L>;
|
|
370
|
+
condition: ConditionCond<T, S, L>;
|
|
371
|
+
nested: NestedCond<T, S, L>;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Allow to avoid overwriting import from `intlayer` package when `IInterpreterPlugin<T>` interface is augmented in another package, such as `react-intlayer`.
|
|
375
|
+
*/
|
|
376
|
+
type IInterpreterPluginState = {
|
|
377
|
+
translation: true;
|
|
378
|
+
enumeration: true;
|
|
379
|
+
condition: true;
|
|
380
|
+
insertion: true;
|
|
381
|
+
nested: true;
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Utility type to check if a plugin can be applied to a node.
|
|
385
|
+
*/
|
|
386
|
+
type CheckApplyPlugin<T, K$1 extends keyof IInterpreterPlugin<T, S, L>, S, L extends LocalesValues = DeclaredLocales> = K$1 extends keyof S ? S[K$1] extends true ? IInterpreterPlugin<T, S, L>[K$1] extends never ? never : IInterpreterPlugin<T, S, L>[K$1] : never : never;
|
|
387
|
+
/**
|
|
388
|
+
* Traverse recursively through an object or array, applying each plugin as needed.
|
|
389
|
+
*/
|
|
390
|
+
type Traverse<T, S, L extends LocalesValues = DeclaredLocales> = T extends ReadonlyArray<infer U> ? Array<DeepTransformContent<U, S, L>> : T extends object ? { [K in keyof T]: DeepTransformContent<T[K], S, L> } : T;
|
|
391
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
392
|
+
/**
|
|
393
|
+
* Traverse recursively through an object or array, applying each plugin as needed.
|
|
394
|
+
*/
|
|
395
|
+
type DeepTransformContent<T, S = IInterpreterPluginState, L extends LocalesValues = DeclaredLocales> = IsAny<T> extends true ? T : CheckApplyPlugin<T, keyof IInterpreterPlugin<T, S, L>, S> extends never ? Traverse<T, S, L> : IInterpreterPlugin<T, S, L>[keyof IInterpreterPlugin<T, S, L>];
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region src/interpreter/getContent/deepTransform.d.ts
|
|
398
|
+
/**
|
|
399
|
+
* Recursively traverses a node (object/array/primitive).
|
|
400
|
+
* Applies the *first* plugin that can transform a node, then stops descending further.
|
|
401
|
+
* If no plugin transforms it, it recurses into its children.
|
|
402
|
+
*/
|
|
403
|
+
declare const deepTransformNode: (node: any, props: NodeProps) => any;
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/interpreter/getContent/getContent.d.ts
|
|
406
|
+
/**
|
|
407
|
+
* Transforms a node in a single pass, applying each plugin as needed.
|
|
408
|
+
*
|
|
409
|
+
* @param node The node to transform.
|
|
410
|
+
* @param locale The locale to use if your transformers need it (e.g. for translations).
|
|
411
|
+
*/
|
|
412
|
+
declare const getContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, nodeProps: NodeProps, locale?: L) => DeepTransformContent<T, IInterpreterPluginState, L>;
|
|
413
|
+
//#endregion
|
|
414
|
+
//#region src/interpreter/getDictionary.d.ts
|
|
415
|
+
/**
|
|
416
|
+
* Transforms a dictionary in a single pass, applying each plugin as needed.
|
|
417
|
+
*
|
|
418
|
+
* @param dictionary The dictionary to transform.
|
|
419
|
+
* @param locale The locale to use if your transformers need it (e.g. for translations).
|
|
420
|
+
* @param additionalPlugins An array of NodeTransformer that define how to transform recognized nodes.
|
|
421
|
+
* If omitted, we’ll use a default set of plugins.
|
|
422
|
+
*/
|
|
423
|
+
declare const getDictionary: <T extends Dictionary, L extends LocalesValues = DeclaredLocales>(dictionary: T, locale?: L, plugins?: Plugins[]) => DeepTransformContent<T["content"], IInterpreterPluginState, L>;
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/interpreter/getEnumeration.d.ts
|
|
426
|
+
/**
|
|
427
|
+
* Find the matching condition for a quantity.
|
|
428
|
+
*
|
|
429
|
+
* Usage:
|
|
430
|
+
*
|
|
431
|
+
* ```ts
|
|
432
|
+
* const key = findMatchingCondition({
|
|
433
|
+
* '<=-2.3': 'You have less than -2.3',
|
|
434
|
+
* '<1': 'You have less than one',
|
|
435
|
+
* '2': 'You have two',
|
|
436
|
+
* '>=3': 'You have three or more',
|
|
437
|
+
* }, 2);
|
|
438
|
+
* // '2'
|
|
439
|
+
* ```
|
|
440
|
+
*
|
|
441
|
+
* The order of the keys will define the priority of the content.
|
|
442
|
+
*
|
|
443
|
+
* ```ts
|
|
444
|
+
* const key = findMatchingCondition({
|
|
445
|
+
* '<4': 'You have less than four',
|
|
446
|
+
* '2': 'You have two',
|
|
447
|
+
* }, 2);
|
|
448
|
+
* // '<4'
|
|
449
|
+
* ```
|
|
450
|
+
*
|
|
451
|
+
* If no keys match, the default key is '1'.
|
|
452
|
+
*/
|
|
453
|
+
declare const findMatchingCondition: <Content>(enumerationContent: EnumerationContentState<Content>, quantity: number) => EnterFormat;
|
|
454
|
+
/**
|
|
455
|
+
* Allow to pick a content based on a quantity.
|
|
456
|
+
*
|
|
457
|
+
* Usage:
|
|
458
|
+
*
|
|
459
|
+
* ```ts
|
|
460
|
+
* const content = getEnumeration({
|
|
461
|
+
* '<=-2.3': 'You have less than -2.3',
|
|
462
|
+
* '<1': 'You have less than one',
|
|
463
|
+
* '2': 'You have two',
|
|
464
|
+
* '>=3': 'You have three or more',
|
|
465
|
+
* }, 2);
|
|
466
|
+
* // 'You have two'
|
|
467
|
+
* ```
|
|
468
|
+
*
|
|
469
|
+
* The order of the keys will define the priority of the content.
|
|
470
|
+
*
|
|
471
|
+
* ```ts
|
|
472
|
+
* const content = getEnumeration({
|
|
473
|
+
* '<4': 'You have less than four',
|
|
474
|
+
* '2': 'You have two',
|
|
475
|
+
* }, 2);
|
|
476
|
+
* // 'You have less than four'
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
*/
|
|
480
|
+
declare const getEnumeration: <Content>(enumerationContent: EnumerationContentState<Content>, quantity: number) => Content;
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region src/interpreter/getIntlayer.d.ts
|
|
483
|
+
declare const getIntlayer: <T extends DictionaryKeys, L extends LocalesValues = DeclaredLocales>(key: T, locale?: L, plugins?: Plugins[]) => DeepTransformContent<DictionaryRegistryContent<T>, IInterpreterPluginState, L>;
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region src/interpreter/getTranslation.d.ts
|
|
486
|
+
/**
|
|
487
|
+
*
|
|
488
|
+
* Allow to pick a content based on a locale.
|
|
489
|
+
* If not locale found, it will return the content related to the default locale.
|
|
490
|
+
*
|
|
491
|
+
* Return either the content editor, or the content itself depending on the configuration.
|
|
492
|
+
*
|
|
493
|
+
* Usage:
|
|
494
|
+
*
|
|
495
|
+
* ```ts
|
|
496
|
+
* const content = getTranslation<string>({
|
|
497
|
+
* en: 'Hello',
|
|
498
|
+
* fr: 'Bonjour',
|
|
499
|
+
* }, 'fr');
|
|
500
|
+
* // 'Bonjour'
|
|
501
|
+
* ```
|
|
502
|
+
*
|
|
503
|
+
* Using TypeScript:
|
|
504
|
+
* - this function will require each locale to be defined if defined in the project configuration.
|
|
505
|
+
* - If a locale is missing, it will make each existing locale optional and raise an error if the locale is not found.
|
|
506
|
+
*/
|
|
507
|
+
declare const getTranslation: <Content = string>(languageContent: StrictModeLocaleMap<Content>, locale: LocalesValues, fallback?: LocalesValues) => Content;
|
|
508
|
+
//#endregion
|
|
509
|
+
//#region src/deepTransformPlugins/getFilteredLocalesContent.d.ts
|
|
510
|
+
declare const getFilteredLocalesContent: (node: ContentNode, locales: LocalesValues | LocalesValues[], nodeProps: NodeProps) => any;
|
|
511
|
+
declare const getFilteredLocalesDictionary: (dictionary: Dictionary, locale: LocalesValues | LocalesValues[]) => {
|
|
512
|
+
content: any;
|
|
513
|
+
$schema?: string;
|
|
514
|
+
id?: _intlayer_types0.DictionaryId;
|
|
515
|
+
projectIds?: string[];
|
|
516
|
+
localId?: _intlayer_types0.LocalDictionaryId;
|
|
517
|
+
localIds?: _intlayer_types0.LocalDictionaryId[];
|
|
518
|
+
key: _intlayer_types0.DictionaryKey;
|
|
519
|
+
title?: string;
|
|
520
|
+
description?: string;
|
|
521
|
+
versions?: string[];
|
|
522
|
+
version?: string;
|
|
523
|
+
filePath?: string;
|
|
524
|
+
tags?: string[];
|
|
525
|
+
locale?: LocalesValues;
|
|
526
|
+
fill?: _intlayer_types0.Fill;
|
|
527
|
+
filled?: true;
|
|
528
|
+
priority?: number;
|
|
529
|
+
live?: boolean;
|
|
530
|
+
location?: _intlayer_types0.DictionaryLocation;
|
|
531
|
+
};
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region src/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts
|
|
534
|
+
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
535
|
+
declare const filterMissingTranslationsOnlyPlugin: (localeToCheck: LocalesValues) => Plugins;
|
|
536
|
+
/**
|
|
537
|
+
* For each translation node, it compare is both localeToCheck and baseLocale are present.
|
|
538
|
+
*
|
|
539
|
+
* If yes, it should remove the node from the content.
|
|
540
|
+
* If no, it should keep the node
|
|
541
|
+
*
|
|
542
|
+
* In complete mode, for large dictionaries, we want to filter all content that is already translated
|
|
543
|
+
*
|
|
544
|
+
* locale: fr
|
|
545
|
+
*
|
|
546
|
+
* { test1: t({ ar: 'Hello', en: 'Hello', fr: 'Bonjour' } }) -> {}
|
|
547
|
+
* { test2: t({ ar: 'Hello', en: 'Hello' }) } -> { test2: t({ ar: 'Hello', en: 'Hello' }) }
|
|
548
|
+
*
|
|
549
|
+
*/
|
|
550
|
+
declare const getFilterMissingTranslationsContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, localeToCheck: L, nodeProps: NodeProps) => any;
|
|
551
|
+
declare const getFilterMissingTranslationsDictionary: (dictionary: Dictionary, localeToCheck: LocalesValues) => {
|
|
552
|
+
content: any;
|
|
553
|
+
$schema?: string;
|
|
554
|
+
id?: _intlayer_types0.DictionaryId;
|
|
555
|
+
projectIds?: string[];
|
|
556
|
+
localId?: _intlayer_types0.LocalDictionaryId;
|
|
557
|
+
localIds?: _intlayer_types0.LocalDictionaryId[];
|
|
558
|
+
key: _intlayer_types0.DictionaryKey;
|
|
559
|
+
title?: string;
|
|
560
|
+
description?: string;
|
|
561
|
+
versions?: string[];
|
|
562
|
+
version?: string;
|
|
563
|
+
filePath?: string;
|
|
564
|
+
tags?: string[];
|
|
565
|
+
locale?: LocalesValues;
|
|
566
|
+
fill?: _intlayer_types0.Fill;
|
|
567
|
+
filled?: true;
|
|
568
|
+
priority?: number;
|
|
569
|
+
live?: boolean;
|
|
570
|
+
location?: _intlayer_types0.DictionaryLocation;
|
|
571
|
+
};
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region src/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts
|
|
574
|
+
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
575
|
+
declare const filterTranslationsOnlyPlugin: (locale: LocalesValues, fallback?: LocalesValues) => Plugins;
|
|
576
|
+
/**
|
|
577
|
+
* Return the content of a node with only the translation plugin.
|
|
578
|
+
*
|
|
579
|
+
* @param node The node to transform.
|
|
580
|
+
* @param locale The locale to use if your transformers need it (e.g. for translations).
|
|
581
|
+
*/
|
|
582
|
+
declare const getFilterTranslationsOnlyContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, locale: L | undefined, nodeProps: NodeProps, fallback?: LocalesValues) => DeepTransformContent<T>;
|
|
583
|
+
declare const getFilterTranslationsOnlyDictionary: (dictionary: Dictionary, locale?: LocalesValues, fallback?: LocalesValues) => {
|
|
584
|
+
content: any;
|
|
585
|
+
$schema?: string;
|
|
586
|
+
id?: _intlayer_types0.DictionaryId;
|
|
587
|
+
projectIds?: string[];
|
|
588
|
+
localId?: _intlayer_types0.LocalDictionaryId;
|
|
589
|
+
localIds?: _intlayer_types0.LocalDictionaryId[];
|
|
590
|
+
key: _intlayer_types0.DictionaryKey;
|
|
591
|
+
title?: string;
|
|
592
|
+
description?: string;
|
|
593
|
+
versions?: string[];
|
|
594
|
+
version?: string;
|
|
595
|
+
filePath?: string;
|
|
596
|
+
tags?: string[];
|
|
597
|
+
locale?: LocalesValues;
|
|
598
|
+
fill?: _intlayer_types0.Fill;
|
|
599
|
+
filled?: true;
|
|
600
|
+
priority?: number;
|
|
601
|
+
live?: boolean;
|
|
602
|
+
location?: _intlayer_types0.DictionaryLocation;
|
|
603
|
+
};
|
|
604
|
+
//#endregion
|
|
605
|
+
//#region src/deepTransformPlugins/getLocalizedContent.d.ts
|
|
606
|
+
/**
|
|
607
|
+
* Transforms a node in a single pass, applying each plugin as needed.
|
|
608
|
+
* In comparison to `getContent`, this function will only apply the translation plugin.
|
|
609
|
+
* It will not transform enumerations, insertions, or other content types.
|
|
610
|
+
*
|
|
611
|
+
* @param node The node to transform.
|
|
612
|
+
* @param locale The locale to use if your transformers need it (e.g. for translations).
|
|
613
|
+
*/
|
|
614
|
+
declare const getLocalizedContent: <T extends ContentNode, L extends LocalesValues = DeclaredLocales>(node: T, locale: L, nodeProps: NodeProps, fallback?: LocalesValues) => DeepTransformContent<T>;
|
|
615
|
+
declare const getPerLocaleDictionary: <T extends Dictionary, L extends LocalesValues>(dictionary: T, locale: L, fallback?: LocalesValues) => Dictionary;
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/deepTransformPlugins/getMaskContent.d.ts
|
|
618
|
+
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
619
|
+
declare const buildMaskPlugin: Plugins;
|
|
620
|
+
declare const getMaskContent: (source: Dictionary) => any;
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region src/deepTransformPlugins/getMissingLocalesContent.d.ts
|
|
623
|
+
/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
|
|
624
|
+
declare const checkMissingLocalesPlugin: (locales: Locale[], onMissingLocale: (locale: Locale) => void) => Plugins;
|
|
625
|
+
/**
|
|
626
|
+
* Return the content of a node with only the translation plugin.
|
|
627
|
+
*
|
|
628
|
+
* @param node The node to transform.
|
|
629
|
+
* @param locales The locales to check for missing translations.
|
|
630
|
+
*/
|
|
631
|
+
declare const getMissingLocalesContent: <T extends ContentNode>(node: T, locales: LocalesValues[] | undefined, nodeProps: NodeProps) => Locale[];
|
|
632
|
+
declare const getMissingLocalesContentFromDictionary: (dictionary: Dictionary, locales?: LocalesValues[]) => Locale[];
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/deepTransformPlugins/getMultilingualDictionary.d.ts
|
|
635
|
+
/**
|
|
636
|
+
* Transform a per-locale dictionary into a multilingual dictionary.
|
|
637
|
+
*
|
|
638
|
+
* Example:
|
|
639
|
+
* ```json
|
|
640
|
+
* {
|
|
641
|
+
* "key": "about-page",
|
|
642
|
+
* "locale": "en",
|
|
643
|
+
* "content": {
|
|
644
|
+
* "myContent": "English content"
|
|
645
|
+
* }
|
|
646
|
+
* }
|
|
647
|
+
* ```
|
|
648
|
+
*
|
|
649
|
+
* ```json
|
|
650
|
+
* {
|
|
651
|
+
* "key": "about-page",
|
|
652
|
+
* "content": {
|
|
653
|
+
* "myContent": t({
|
|
654
|
+
* "en": "English content",
|
|
655
|
+
* })
|
|
656
|
+
* }
|
|
657
|
+
* }
|
|
658
|
+
* ```
|
|
659
|
+
*/
|
|
660
|
+
declare const getMultilingualDictionary: (dictionary: Dictionary) => Dictionary;
|
|
661
|
+
//#endregion
|
|
662
|
+
//#region src/deepTransformPlugins/getReplacedValuesContent.d.ts
|
|
663
|
+
declare const getReplacedValuesContent: (node: ContentNode, value: string | number | boolean, nodeProps: NodeProps) => any;
|
|
664
|
+
//#endregion
|
|
665
|
+
//#region src/deepTransformPlugins/getSplittedContent.d.ts
|
|
666
|
+
type SplittedContentOutput<T = ContentNode> = Record<DeclaredLocales, T> & {
|
|
667
|
+
common: T;
|
|
668
|
+
};
|
|
669
|
+
declare const getSplittedContent: (content: ContentNode) => SplittedContentOutput;
|
|
670
|
+
/**
|
|
671
|
+
* Splits the `content` field of a Dictionary into "common" and per-locale buckets.
|
|
672
|
+
*
|
|
673
|
+
* Given a dictionary like:
|
|
674
|
+
* ```js
|
|
675
|
+
* {
|
|
676
|
+
* key: "my-key",
|
|
677
|
+
* content: {
|
|
678
|
+
* commonContent: "common content",
|
|
679
|
+
* multilingualContent: t({
|
|
680
|
+
* en: "english content",
|
|
681
|
+
* fr: "french content",
|
|
682
|
+
* de: "german content",
|
|
683
|
+
* }),
|
|
684
|
+
* },
|
|
685
|
+
* }
|
|
686
|
+
* ```
|
|
687
|
+
*
|
|
688
|
+
* It produces:
|
|
689
|
+
* ```js
|
|
690
|
+
* {
|
|
691
|
+
* common: { commonContent: "common content" },
|
|
692
|
+
* en: { multilingualContent: "english content" },
|
|
693
|
+
* fr: { multilingualContent: "french content" },
|
|
694
|
+
* de: { multilingualContent: "german content" },
|
|
695
|
+
* }
|
|
696
|
+
* ```
|
|
697
|
+
*
|
|
698
|
+
* @param dictionary - The input dictionary object with possible multilingual or common content.
|
|
699
|
+
* @returns An object mapping "common" and each locale to their corresponding content subtrees.
|
|
700
|
+
*/
|
|
701
|
+
declare const getSplittedDictionaryContent: (dictionary: Dictionary) => SplittedContentOutput<Dictionary["content"]>;
|
|
702
|
+
//#endregion
|
|
703
|
+
//#region src/deepTransformPlugins/insertContentInDictionary.d.ts
|
|
704
|
+
/**
|
|
705
|
+
* Insert content into a dictionary with deep merge support
|
|
706
|
+
* Handles translation blocks and nested structures
|
|
707
|
+
*
|
|
708
|
+
* @param dictionary - The dictionary to insert content into
|
|
709
|
+
* @param content - The content to insert
|
|
710
|
+
* @param locale - Optional locale to target specific translation
|
|
711
|
+
* @returns Updated dictionary
|
|
712
|
+
*
|
|
713
|
+
* @example
|
|
714
|
+
* // Without locale - deep merge all content
|
|
715
|
+
* insertContentInDictionary(dictionary, { title: 'New Title' })
|
|
716
|
+
*
|
|
717
|
+
* @example
|
|
718
|
+
* // With locale - insert content for specific locale
|
|
719
|
+
* insertContentInDictionary(dictionary, { title: 'このページ' }, 'ja')
|
|
720
|
+
*/
|
|
721
|
+
declare const insertContentInDictionary: (dictionary: Dictionary, content: Dictionary["content"], locale?: LocalesValues) => Dictionary;
|
|
722
|
+
//#endregion
|
|
723
|
+
//#region src/dictionaryManipulator/editDictionaryByKeyPath.d.ts
|
|
724
|
+
declare const editDictionaryByKeyPath: (dictionaryContent: ContentNode, keyPath: KeyPath[], newValue: ContentNode) => ContentNode;
|
|
725
|
+
//#endregion
|
|
726
|
+
//#region src/dictionaryManipulator/getContentNodeByKeyPath.d.ts
|
|
727
|
+
declare const getContentNodeByKeyPath: (dictionaryContent: ContentNode, keyPath: KeyPath[], fallbackLocale?: Locale) => ContentNode;
|
|
728
|
+
//#endregion
|
|
729
|
+
//#region src/dictionaryManipulator/getDefaultNode.d.ts
|
|
730
|
+
declare const getDefaultNode: (nodeType: NodeType, locales: LocalesValues[], content?: ContentNode) => ContentNode;
|
|
731
|
+
//#endregion
|
|
732
|
+
//#region src/dictionaryManipulator/getEmptyNode.d.ts
|
|
733
|
+
declare const getEmptyNode: (section: ContentNode) => ContentNode;
|
|
734
|
+
//#endregion
|
|
735
|
+
//#region src/dictionaryManipulator/getNodeChildren.d.ts
|
|
736
|
+
declare const getNodeChildren: (section: ContentNode) => ContentNode;
|
|
737
|
+
//#endregion
|
|
738
|
+
//#region src/dictionaryManipulator/getNodeType.d.ts
|
|
739
|
+
declare const getNodeType: (content: ContentNode) => NodeType;
|
|
740
|
+
//#endregion
|
|
741
|
+
//#region src/dictionaryManipulator/mergeDictionaries.d.ts
|
|
742
|
+
declare const mergeDictionaries: (dictionaries: Dictionary[]) => Dictionary;
|
|
743
|
+
//#endregion
|
|
744
|
+
//#region src/dictionaryManipulator/normalizeDictionary.d.ts
|
|
745
|
+
declare const normalizeDictionary: (dictionary: Dictionary, configuration: IntlayerConfig) => Dictionary;
|
|
746
|
+
declare const normalizeDictionaries: (dictionaries: Dictionary[], configuration: IntlayerConfig) => Dictionary[];
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/dictionaryManipulator/orderDictionaries.d.ts
|
|
749
|
+
/**
|
|
750
|
+
* Orders dictionaries based on the dictionary priority strategy.
|
|
751
|
+
*
|
|
752
|
+
* @param dictionaries - Array of dictionaries to order
|
|
753
|
+
* @param priorityStrategy - The priority strategy ('local_first' or 'distant_first')
|
|
754
|
+
* @returns Ordered array of dictionaries
|
|
755
|
+
*/
|
|
756
|
+
declare const orderDictionaries: (dictionaries: Dictionary[], configuration?: _intlayer_types0.IntlayerConfig) => Dictionary[];
|
|
757
|
+
//#endregion
|
|
758
|
+
//#region src/dictionaryManipulator/removeContentNodeByKeyPath.d.ts
|
|
759
|
+
declare const removeContentNodeByKeyPath: (dictionaryContent: ContentNode, keyPath: KeyPath[]) => ContentNode;
|
|
760
|
+
//#endregion
|
|
761
|
+
//#region src/dictionaryManipulator/renameContentNodeByKeyPath.d.ts
|
|
762
|
+
declare const renameContentNodeByKeyPath: (dictionaryContent: ContentNode, newKey: KeyPath["key"], keyPath: KeyPath[]) => ContentNode;
|
|
763
|
+
//#endregion
|
|
764
|
+
//#region src/dictionaryManipulator/updateNodeChildren.d.ts
|
|
765
|
+
declare const updateNodeChildren: <T extends ContentNode, U$1 extends ContentNode>(section: T, newChildren: U$1) => ContentNode;
|
|
766
|
+
//#endregion
|
|
767
|
+
//#region src/formatters/compact.d.ts
|
|
768
|
+
/**
|
|
769
|
+
* Formats a numeric value using compact notation (e.g., 1K, 1M, 1B)
|
|
770
|
+
* based on locale and formatting options.
|
|
771
|
+
*
|
|
772
|
+
* @example
|
|
773
|
+
* compact({ value: 1200 }); // "1.2K"
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* compact({ value: "1000000", locale: Locales.FRENCH, compactDisplay: "long" });
|
|
777
|
+
* // "1 million"
|
|
778
|
+
*/
|
|
779
|
+
declare const compact: (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
780
|
+
locale?: LocalesValues;
|
|
781
|
+
}) => string;
|
|
782
|
+
//#endregion
|
|
783
|
+
//#region src/formatters/currency.d.ts
|
|
784
|
+
/**
|
|
785
|
+
* Formats a numeric or string value into a localized currency string using the Intl API.
|
|
786
|
+
*
|
|
787
|
+
* @example
|
|
788
|
+
* currency({ value: 1234.5, currency: 'EUR' });
|
|
789
|
+
* // "€1,234.50"
|
|
790
|
+
*
|
|
791
|
+
* @example
|
|
792
|
+
* currency({ value: "5000", locale: Locales.FRENCH, currency: "CAD", currencyDisplay: "code" });
|
|
793
|
+
* // "5 000,00 CAD"
|
|
794
|
+
*/
|
|
795
|
+
declare const currency: (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
796
|
+
locale?: LocalesValues;
|
|
797
|
+
}) => string;
|
|
798
|
+
//#endregion
|
|
799
|
+
//#region src/formatters/date.d.ts
|
|
800
|
+
/**
|
|
801
|
+
* Formats a date/time value into a localized string using Intl.DateTimeFormat.
|
|
802
|
+
*
|
|
803
|
+
* @example
|
|
804
|
+
* date({ date: new Date(), options: "short" });
|
|
805
|
+
* // "08/02/25, 14:30"
|
|
806
|
+
*
|
|
807
|
+
* @example
|
|
808
|
+
* date({ date: "2025-08-02T14:30:00Z", locale: Locales.FRENCH, options: { month: "long", day: "numeric" } });
|
|
809
|
+
* // "2 août"
|
|
810
|
+
*/
|
|
811
|
+
declare const date: (date: Date | string | number, options?: Intl.DateTimeFormatOptions & {
|
|
812
|
+
locale?: LocalesValues;
|
|
813
|
+
}) => string;
|
|
814
|
+
//#endregion
|
|
815
|
+
//#region src/formatters/list.d.ts
|
|
816
|
+
/**
|
|
817
|
+
* Formats an array of values into a localized list string using the Intl API.
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* list(['apple', 'banana', 'orange']);
|
|
821
|
+
* // "apple, banana, and orange"
|
|
822
|
+
*
|
|
823
|
+
* @example
|
|
824
|
+
* list(['red', 'green', 'blue'], { locale: Locales.FRENCH, type: 'disjunction' });
|
|
825
|
+
* // "rouge, vert ou bleu"
|
|
826
|
+
*
|
|
827
|
+
* @example
|
|
828
|
+
* list([1, 2, 3], { type: 'unit' });
|
|
829
|
+
* // "1, 2, 3"
|
|
830
|
+
*/
|
|
831
|
+
declare const list: (values: (string | number)[], options?: Intl.ListFormatOptions & {
|
|
832
|
+
locale?: LocalesValues;
|
|
833
|
+
}) => string;
|
|
834
|
+
//#endregion
|
|
835
|
+
//#region src/formatters/number.d.ts
|
|
836
|
+
/**
|
|
837
|
+
* Formats a numeric value using locale-aware formatting.
|
|
838
|
+
*
|
|
839
|
+
* @example
|
|
840
|
+
* number({ value: 123456.789 }); // "123,456.789"
|
|
841
|
+
* number({ value: "1000000", locale: Locales.FRENCH }); // "1 000 000"
|
|
842
|
+
*/
|
|
843
|
+
declare const number: (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
844
|
+
locale?: LocalesValues;
|
|
845
|
+
}) => string;
|
|
846
|
+
//#endregion
|
|
847
|
+
//#region src/formatters/percentage.d.ts
|
|
848
|
+
/**
|
|
849
|
+
* Formats a number as a percentage string (e.g., 0.25 → "25%").
|
|
850
|
+
*
|
|
851
|
+
* @example
|
|
852
|
+
* percentage({ value: 0.25 }) // "25%"
|
|
853
|
+
* percentage({ value: 0.25, minimumFractionDigits: 2 }) // "25.00%"
|
|
854
|
+
*/
|
|
855
|
+
declare const percentage: (value: string | number, options?: Intl.NumberFormatOptions & {
|
|
856
|
+
locale?: LocalesValues;
|
|
857
|
+
}) => string;
|
|
858
|
+
//#endregion
|
|
859
|
+
//#region src/formatters/relativeTime.d.ts
|
|
860
|
+
type RelativeTimeUnit = Intl.RelativeTimeFormatUnit;
|
|
861
|
+
declare const relativeTime: (from: Date | string | number, to?: Date | string | number, options?: Intl.RelativeTimeFormatOptions & {
|
|
862
|
+
locale?: LocalesValues;
|
|
863
|
+
unit?: RelativeTimeUnit;
|
|
864
|
+
}) => string;
|
|
865
|
+
//#endregion
|
|
866
|
+
//#region src/formatters/units.d.ts
|
|
867
|
+
/**
|
|
868
|
+
* Formats a numeric value as a localized unit string.
|
|
869
|
+
*
|
|
870
|
+
* @example
|
|
871
|
+
* units({ value: 5, unit: "kilometer", unitDisplay: "long", locale: "en-GB" })
|
|
872
|
+
* // "5 kilometers"
|
|
873
|
+
*/
|
|
874
|
+
declare const units: (value: number | string, options?: Intl.NumberFormatOptions & {
|
|
875
|
+
locale?: LocalesValues;
|
|
876
|
+
}) => string;
|
|
877
|
+
//#endregion
|
|
878
|
+
//#region src/getStorageAttributes.d.ts
|
|
879
|
+
type CookieEntry = {
|
|
880
|
+
name: string;
|
|
881
|
+
attributes: Omit<CookiesAttributes, 'type' | 'name'>;
|
|
882
|
+
};
|
|
883
|
+
type WebStorageEntry = {
|
|
884
|
+
name: string;
|
|
885
|
+
};
|
|
886
|
+
type HeaderEntry = {
|
|
887
|
+
name: string;
|
|
888
|
+
};
|
|
889
|
+
type ProcessedStorageAttributes = {
|
|
890
|
+
cookies: CookieEntry[];
|
|
891
|
+
localStorage: WebStorageEntry[];
|
|
892
|
+
sessionStorage: WebStorageEntry[];
|
|
893
|
+
headers: HeaderEntry[];
|
|
894
|
+
};
|
|
895
|
+
/**
|
|
896
|
+
* Extracts and normalizes storage configuration into separate arrays for each storage type
|
|
897
|
+
*
|
|
898
|
+
* @param options - The storage configuration from IntlayerConfig
|
|
899
|
+
* @returns An object containing arrays for cookies, localStorage, and sessionStorage
|
|
900
|
+
*/
|
|
901
|
+
declare const getStorageAttributes: (options: IntlayerConfig["routing"]["storage"]) => ProcessedStorageAttributes;
|
|
902
|
+
//#endregion
|
|
903
|
+
//#region src/utils/localeStorage.d.ts
|
|
904
|
+
type CookieBuildAttributes = {
|
|
905
|
+
/**
|
|
906
|
+
* Cookie domain to store the locale information
|
|
907
|
+
*
|
|
908
|
+
* Default: undefined
|
|
909
|
+
*
|
|
910
|
+
* Define the domain where the cookie is available. Defaults to
|
|
911
|
+
* the domain of the page where the cookie was created.
|
|
912
|
+
*/
|
|
913
|
+
domain?: string;
|
|
914
|
+
/**
|
|
915
|
+
* Cookie path to store the locale information
|
|
916
|
+
*
|
|
917
|
+
* Default: undefined
|
|
918
|
+
*
|
|
919
|
+
* Define the path where the cookie is available. Defaults to '/'
|
|
920
|
+
*/
|
|
921
|
+
path?: string;
|
|
922
|
+
/**
|
|
923
|
+
* Cookie secure to store the locale information
|
|
924
|
+
*
|
|
925
|
+
* Default: undefined
|
|
926
|
+
*
|
|
927
|
+
* A Boolean indicating if the cookie transmission requires a
|
|
928
|
+
* secure protocol (https). Defaults to false.
|
|
929
|
+
*/
|
|
930
|
+
secure?: boolean;
|
|
931
|
+
/**
|
|
932
|
+
* Cookie httpOnly to store the locale information
|
|
933
|
+
*
|
|
934
|
+
* Default: undefined
|
|
935
|
+
*
|
|
936
|
+
* The cookie httpOnly where the locale information is stored.
|
|
937
|
+
*/
|
|
938
|
+
httpOnly?: boolean;
|
|
939
|
+
/**
|
|
940
|
+
* Cookie sameSite to store the locale information
|
|
941
|
+
*
|
|
942
|
+
* Default: undefined
|
|
943
|
+
*
|
|
944
|
+
* Asserts that a cookie must not be sent with cross-origin requests,
|
|
945
|
+
* providing some protection against cross-site request forgery
|
|
946
|
+
* attacks (CSRF)
|
|
947
|
+
*/
|
|
948
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
949
|
+
/**
|
|
950
|
+
* Cookie expires to store the locale information
|
|
951
|
+
*
|
|
952
|
+
* Default: undefined
|
|
953
|
+
*
|
|
954
|
+
* Define when the cookie will be removed. Value can be a Number
|
|
955
|
+
* which will be interpreted as days from time of creation or a
|
|
956
|
+
* Date instance. If omitted, the cookie becomes a session cookie.
|
|
957
|
+
*/
|
|
958
|
+
expires?: number | undefined;
|
|
959
|
+
};
|
|
960
|
+
type LocaleStorageOptions = {
|
|
961
|
+
overwrite?: boolean;
|
|
962
|
+
isCookieEnabled?: boolean;
|
|
963
|
+
setCookieStore?: (name: string, value: string, cookie: CookieBuildAttributes) => void;
|
|
964
|
+
setCookieString?: (name: string, cookie: string) => void;
|
|
965
|
+
getCookie?: (name: string) => string | undefined | null;
|
|
966
|
+
setSessionStorage?: (name: string, value: string) => void;
|
|
967
|
+
getSessionStorage?: (name: string) => string | undefined | null;
|
|
968
|
+
setLocaleStorage?: (name: string, value: string) => void;
|
|
969
|
+
getLocaleStorage?: (name: string) => string | undefined | null;
|
|
970
|
+
getHeader?: (name: string) => string | undefined | null;
|
|
971
|
+
setHeader?: (name: string, value: string) => void;
|
|
972
|
+
};
|
|
973
|
+
/**
|
|
974
|
+
* Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).
|
|
975
|
+
* The function checks storage locations in order of priority as defined in the configuration.
|
|
976
|
+
*
|
|
977
|
+
* @returns The locale if found in any storage, or undefined if not found
|
|
978
|
+
*/
|
|
979
|
+
declare const getLocaleFromStorage: (options: Pick<LocaleStorageOptions, "getCookie" | "getSessionStorage" | "getLocaleStorage" | "getHeader" | "isCookieEnabled">) => Locale | undefined;
|
|
980
|
+
/**
|
|
981
|
+
* Stores the locale in various storage mechanisms (cookies, localStorage, sessionStorage, headers).
|
|
982
|
+
* The function writes to all configured storage locations according to their attributes.
|
|
983
|
+
* Respects overwrite flags for localStorage and sessionStorage.
|
|
984
|
+
*
|
|
985
|
+
* @param locale - The locale to store
|
|
986
|
+
*/
|
|
987
|
+
declare const setLocaleInStorage: (locale: LocalesValues, options?: LocaleStorageOptions) => void;
|
|
988
|
+
/**
|
|
989
|
+
* Utility object to get and set the locale in the storage by considering the configuration
|
|
990
|
+
*
|
|
991
|
+
* @property getLocale - Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).
|
|
992
|
+
* Retrieves the locale from various storage mechanisms (cookies, localStorage, sessionStorage, headers).
|
|
993
|
+
* The function checks storage locations in order of priority as defined in the configuration.
|
|
994
|
+
*
|
|
995
|
+
* @property setLocale - Stores the locale in various storage mechanisms (cookies, localStorage, sessionStorage, headers).
|
|
996
|
+
* The function writes to all configured storage locations according to their attributes.
|
|
997
|
+
* Respects overwrite flags for localStorage and sessionStorage.
|
|
998
|
+
*
|
|
999
|
+
* @returns The locale if found in any storage, or undefined if not found
|
|
1000
|
+
*/
|
|
1001
|
+
declare const LocaleStorage: (options: LocaleStorageOptions) => {
|
|
1002
|
+
getLocale: () => Locale | undefined;
|
|
1003
|
+
setLocale: (locale: LocalesValues) => void;
|
|
1004
|
+
};
|
|
1005
|
+
//#endregion
|
|
1006
|
+
//#region src/localization/getBrowserLocale.d.ts
|
|
1007
|
+
declare enum LanguageDetector {
|
|
1008
|
+
Querystring = "querystring",
|
|
1009
|
+
Storage = "storage",
|
|
1010
|
+
Navigator = "navigator",
|
|
1011
|
+
HtmlTag = "htmlTag",
|
|
1012
|
+
}
|
|
1013
|
+
declare const localeStorageOptions: LocaleStorageOptions;
|
|
1014
|
+
type LanguageDetectorOptions = {
|
|
1015
|
+
order?: LanguageDetector[];
|
|
1016
|
+
lookupQuerystring?: string;
|
|
1017
|
+
htmlTag?: HTMLElement | null;
|
|
1018
|
+
};
|
|
1019
|
+
/**
|
|
1020
|
+
* Core language detector function for browser environments.
|
|
1021
|
+
*
|
|
1022
|
+
* Detects the user's preferred locale by checking multiple sources in order:
|
|
1023
|
+
* 1. Query string parameter
|
|
1024
|
+
* 2. Storage (cookies, localStorage, sessionStorage) - uses getLocaleFromStorage
|
|
1025
|
+
* 3. Navigator languages - uses localeDetector
|
|
1026
|
+
* 4. HTML lang attribute - uses localeDetector
|
|
1027
|
+
*
|
|
1028
|
+
* @param userOptions - Optional configuration for detection order and lookup keys
|
|
1029
|
+
* @returns The detected locale or the default locale
|
|
1030
|
+
*
|
|
1031
|
+
* @example
|
|
1032
|
+
* const locale = getBrowserLocale({ order: [LanguageDetector.Storage, LanguageDetector.Navigator] });
|
|
1033
|
+
*/
|
|
1034
|
+
declare const getBrowserLocale: (userOptions?: LanguageDetectorOptions | undefined) => Locale;
|
|
1035
|
+
//#endregion
|
|
1036
|
+
//#region src/localization/getHTMLTextDir.d.ts
|
|
1037
|
+
type Dir = 'ltr' | 'rtl' | 'auto';
|
|
1038
|
+
/**
|
|
1039
|
+
* Returns the text direction of the given locale.
|
|
1040
|
+
*
|
|
1041
|
+
* Example:
|
|
1042
|
+
*
|
|
1043
|
+
* getHTMLTextDir('en-US') // 'ltr'
|
|
1044
|
+
* getHTMLTextDir('en') // 'ltr'
|
|
1045
|
+
* getHTMLTextDir('fr-CA') // 'ltr'
|
|
1046
|
+
* getHTMLTextDir('fr') // 'ltr'
|
|
1047
|
+
*
|
|
1048
|
+
* @param locale The locale to get the text direction for.
|
|
1049
|
+
* @returns The text direction of the given locale.
|
|
1050
|
+
*/
|
|
1051
|
+
declare const getHTMLTextDir: (locale?: LocalesValues) => Dir;
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region src/localization/getLocaleFromPath.d.ts
|
|
1054
|
+
/**
|
|
1055
|
+
* Extracts the locale segment from the given URL or pathname if present.
|
|
1056
|
+
* If no locale is present, returns the default locale (en).
|
|
1057
|
+
*
|
|
1058
|
+
* Example:
|
|
1059
|
+
*
|
|
1060
|
+
* ```ts
|
|
1061
|
+
* getLocaleFromPath('/en/dashboard') // Returns 'en'
|
|
1062
|
+
* getLocaleFromPath('/fr/dashboard') // Returns 'fr'
|
|
1063
|
+
* getLocaleFromPath('/dashboard') // Returns 'en'
|
|
1064
|
+
* getLocaleFromPath('dashboard') // Returns 'en'
|
|
1065
|
+
* getLocaleFromPath('https://example.com/es/dashboard') // Returns 'es'
|
|
1066
|
+
* getLocaleFromPath('https://example.com/fr/dashboard') // Returns 'fr'
|
|
1067
|
+
* getLocaleFromPath('https://example.com/dashboard') // Returns 'en'
|
|
1068
|
+
* ```
|
|
1069
|
+
*
|
|
1070
|
+
* @param inputUrl - The complete URL string or pathname to process.
|
|
1071
|
+
* @returns The detected locale or default (en) if no locale is found
|
|
1072
|
+
*/
|
|
1073
|
+
declare const getLocaleFromPath: (inputUrl: string) => Locale;
|
|
1074
|
+
//#endregion
|
|
1075
|
+
//#region src/localization/getLocaleLang.d.ts
|
|
1076
|
+
/**
|
|
1077
|
+
* Returns the language code of the given locale for locales including the country code.
|
|
1078
|
+
*
|
|
1079
|
+
* Example:
|
|
1080
|
+
*
|
|
1081
|
+
* getLocaleLang('en-US') // 'en'
|
|
1082
|
+
* getLocaleLang('en') // 'en'
|
|
1083
|
+
* getLocaleLang('fr-CA') // 'fr'
|
|
1084
|
+
* getLocaleLang('fr') // 'fr'
|
|
1085
|
+
*
|
|
1086
|
+
* @param locale The locale to get the language code for.
|
|
1087
|
+
* @returns The language code of the given locale.
|
|
1088
|
+
*/
|
|
1089
|
+
declare const getLocaleLang: (locale?: LocalesValues) => string;
|
|
1090
|
+
//#endregion
|
|
1091
|
+
//#region src/localization/getLocaleName.d.ts
|
|
1092
|
+
declare const getLocaleName: (displayLocale: LocalesValues, targetLocale?: LocalesValues) => string;
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region src/localization/getLocalizedUrl.d.ts
|
|
1095
|
+
/**
|
|
1096
|
+
* Generate URL by prefixing the given URL with the referenced locale or adding search parameters
|
|
1097
|
+
* based on the routing mode. Handles both absolute and relative URLs appropriately.
|
|
1098
|
+
*
|
|
1099
|
+
* This function gets the locales, default locale, and routing mode from the configuration if not provided.
|
|
1100
|
+
*
|
|
1101
|
+
* Example:
|
|
1102
|
+
*
|
|
1103
|
+
* ```ts
|
|
1104
|
+
* // prefix-no-default mode
|
|
1105
|
+
* getLocalizedUrl('/about', 'fr', ['en', 'fr'], 'en', 'prefix-no-default');
|
|
1106
|
+
* // Returns '/fr/about' for the French locale
|
|
1107
|
+
* // Returns '/about' for the English locale (default)
|
|
1108
|
+
*
|
|
1109
|
+
* // prefix-all mode
|
|
1110
|
+
* getLocalizedUrl('/about', 'en', ['en', 'fr'], 'en', 'prefix-all');
|
|
1111
|
+
* // Returns '/en/about' for the English locale
|
|
1112
|
+
* // Returns '/fr/about' for the French locale
|
|
1113
|
+
*
|
|
1114
|
+
* // search-params mode
|
|
1115
|
+
* getLocalizedUrl('/about', 'fr', ['en', 'fr'], 'en', 'search-params');
|
|
1116
|
+
* // Returns '/about?locale=fr' for the French locale
|
|
1117
|
+
*
|
|
1118
|
+
* // no-prefix mode
|
|
1119
|
+
* getLocalizedUrl('/about', 'fr', ['en', 'fr'], 'en', 'no-prefix');
|
|
1120
|
+
* // Returns '/about' for any locale
|
|
1121
|
+
* ```
|
|
1122
|
+
*
|
|
1123
|
+
* @param url - The original URL string to be processed.
|
|
1124
|
+
* @param currentLocale - The current locale.
|
|
1125
|
+
* @param locales - Optional array of supported locales. Defaults to configured locales.
|
|
1126
|
+
* @param defaultLocale - The default locale. Defaults to configured default locale.
|
|
1127
|
+
* @param mode - URL routing mode for locale handling. Defaults to configured mode.
|
|
1128
|
+
* @returns The localized URL for the current locale.
|
|
1129
|
+
*/
|
|
1130
|
+
declare const getLocalizedUrl: (url: string, currentLocale: LocalesValues, locales?: LocalesValues[] | undefined, defaultLocale?: LocalesValues | undefined, mode?: "prefix-no-default" | "prefix-all" | "no-prefix" | "search-params" | undefined) => string;
|
|
1131
|
+
//#endregion
|
|
1132
|
+
//#region src/localization/getMultilingualUrls.d.ts
|
|
1133
|
+
/**
|
|
1134
|
+
* Generates multilingual URLs by prefixing the given URL with each supported locale
|
|
1135
|
+
* or adding search parameters based on the routing mode.
|
|
1136
|
+
* Handles both absolute and relative URLs appropriately.
|
|
1137
|
+
*
|
|
1138
|
+
* This function gets the locales, default locale, and routing mode from the configuration if not provided.
|
|
1139
|
+
*
|
|
1140
|
+
* Example:
|
|
1141
|
+
*
|
|
1142
|
+
* ```ts
|
|
1143
|
+
* // prefix-no-default mode
|
|
1144
|
+
* getMultilingualUrls('/dashboard', ['en', 'fr'], 'en', 'prefix-no-default')
|
|
1145
|
+
* // Returns { en: '/dashboard', fr: '/fr/dashboard' }
|
|
1146
|
+
*
|
|
1147
|
+
* // prefix-all mode
|
|
1148
|
+
* getMultilingualUrls('/dashboard', ['en', 'fr'], 'en', 'prefix-all')
|
|
1149
|
+
* // Returns { en: '/en/dashboard', fr: '/fr/dashboard' }
|
|
1150
|
+
*
|
|
1151
|
+
* // search-params mode
|
|
1152
|
+
* getMultilingualUrls('/dashboard', ['en', 'fr'], 'en', 'search-params')
|
|
1153
|
+
* // Returns { en: '/dashboard?locale=en', fr: '/dashboard?locale=fr' }
|
|
1154
|
+
*
|
|
1155
|
+
* // no-prefix mode
|
|
1156
|
+
* getMultilingualUrls('/dashboard', ['en', 'fr'], 'en', 'no-prefix')
|
|
1157
|
+
* // Returns { en: '/dashboard', fr: '/dashboard' }
|
|
1158
|
+
* ```
|
|
1159
|
+
*
|
|
1160
|
+
* @param url - The original URL string to be processed.
|
|
1161
|
+
* @param locales - Optional array of supported locales. Defaults to configured locales.
|
|
1162
|
+
* @param defaultLocale - The default locale. Defaults to configured default locale.
|
|
1163
|
+
* @param mode - URL routing mode for locale handling. Defaults to configured mode.
|
|
1164
|
+
* @returns An object mapping each locale to its corresponding multilingual URL.
|
|
1165
|
+
*/
|
|
1166
|
+
declare const getMultilingualUrls: (url: string, locales?: LocalesValues[] | undefined, defaultLocale?: LocalesValues | undefined, mode?: "prefix-no-default" | "prefix-all" | "no-prefix" | "search-params" | undefined) => StrictModeLocaleMap<string>;
|
|
1167
|
+
//#endregion
|
|
1168
|
+
//#region src/localization/getPathWithoutLocale.d.ts
|
|
1169
|
+
/**
|
|
1170
|
+
* Removes the locale segment from the given URL or pathname if present.
|
|
1171
|
+
* Also removes locale from search parameters if present.
|
|
1172
|
+
*
|
|
1173
|
+
* This function get the locales from the configuration if not provided.
|
|
1174
|
+
*
|
|
1175
|
+
* Example:
|
|
1176
|
+
*
|
|
1177
|
+
* ```ts
|
|
1178
|
+
* getPathWithoutLocale('/en/dashboard') // Returns '/dashboard'
|
|
1179
|
+
* getPathWithoutLocale('/fr/dashboard') // Returns '/dashboard'
|
|
1180
|
+
* getPathWithoutLocale('/dashboard') // Returns '/dashboard'
|
|
1181
|
+
* getPathWithoutLocale('dashboard') // Returns 'dashboard'
|
|
1182
|
+
* getPathWithoutLocale('/dashboard?locale=fr') // Returns '/dashboard'
|
|
1183
|
+
* getPathWithoutLocale('https://example.com/en/dashboard') // Returns 'https://example.com/dashboard'
|
|
1184
|
+
* getPathWithoutLocale('https://example.com/fr/dashboard') // Returns 'https://example.com/dashboard'
|
|
1185
|
+
* getPathWithoutLocale('https://example.com/dashboard') // Returns 'https://example.com/dashboard'
|
|
1186
|
+
* getPathWithoutLocale('https://example.com/dashboard?locale=fr') // Returns 'https://example.com/dashboard'
|
|
1187
|
+
* ```
|
|
1188
|
+
*
|
|
1189
|
+
* @param inputUrl - The complete URL string or pathname to process.
|
|
1190
|
+
* @param locales - Optional array of supported locales. Defaults to `localesDefault`.
|
|
1191
|
+
* @returns The URL string or pathname without the locale segment or locale search parameter.
|
|
1192
|
+
*/
|
|
1193
|
+
declare const getPathWithoutLocale: (inputUrl: string, locales?: LocalesValues[]) => string;
|
|
1194
|
+
//#endregion
|
|
1195
|
+
//#region src/localization/localeDetector.d.ts
|
|
1196
|
+
/**
|
|
1197
|
+
* Detects the locale from the request headers
|
|
1198
|
+
*
|
|
1199
|
+
* Headers are provided by the browser and can be used to determine the user's preferred language
|
|
1200
|
+
*/
|
|
1201
|
+
declare const localeDetector: (headers: Record<string, string | undefined>, locales?: Locale[], defaultLocale?: Locale) => Locale;
|
|
1202
|
+
//#endregion
|
|
1203
|
+
//#region src/localization/localeMapper.d.ts
|
|
1204
|
+
type LocaleData = {
|
|
1205
|
+
locale: Locale;
|
|
1206
|
+
defaultLocale: Locale;
|
|
1207
|
+
isDefault: boolean;
|
|
1208
|
+
locales: Locale[];
|
|
1209
|
+
urlPrefix: string;
|
|
1210
|
+
};
|
|
1211
|
+
/**
|
|
1212
|
+
* Map the locale data to an array of objects
|
|
1213
|
+
*
|
|
1214
|
+
* @example
|
|
1215
|
+
* ```ts
|
|
1216
|
+
* const routes = localeMap((localizedData) =>
|
|
1217
|
+
* ({
|
|
1218
|
+
* path: localizedData.urlPrefix,
|
|
1219
|
+
* name: localizedData.locale,
|
|
1220
|
+
* isDefault: localizedData.isDefault,
|
|
1221
|
+
* locales: localizedData.locales,
|
|
1222
|
+
* defaultLocale: localizedData.defaultLocale,
|
|
1223
|
+
* }),
|
|
1224
|
+
* );
|
|
1225
|
+
*
|
|
1226
|
+
* // Result
|
|
1227
|
+
* [
|
|
1228
|
+
* { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },
|
|
1229
|
+
* { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },
|
|
1230
|
+
* { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },
|
|
1231
|
+
* ]
|
|
1232
|
+
* ```
|
|
1233
|
+
*
|
|
1234
|
+
* @param mapper - The mapper function that returns an object
|
|
1235
|
+
* @returns An array of objects
|
|
1236
|
+
*/
|
|
1237
|
+
declare const localeMap: <T>(mapper: (locale: LocaleData) => T, locales?: LocalesValues[], defaultLocale?: LocalesValues, mode?: "prefix-no-default" | "prefix-all" | "no-prefix" | "search-params") => T[];
|
|
1238
|
+
/**
|
|
1239
|
+
* Flatten the locale map into a single array of objects
|
|
1240
|
+
*
|
|
1241
|
+
* @example
|
|
1242
|
+
* ```ts
|
|
1243
|
+
* const routes = localeMap((localizedData) =>
|
|
1244
|
+
* [{
|
|
1245
|
+
* path: localizedData.urlPrefix,
|
|
1246
|
+
* name: localizedData.locale,
|
|
1247
|
+
* isDefault: localizedData.isDefault,
|
|
1248
|
+
* locales: localizedData.locales,
|
|
1249
|
+
* defaultLocale: localizedData.defaultLocale,
|
|
1250
|
+
* }],
|
|
1251
|
+
* );
|
|
1252
|
+
*
|
|
1253
|
+
* // Result
|
|
1254
|
+
* [
|
|
1255
|
+
* path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' ,
|
|
1256
|
+
* path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' ,
|
|
1257
|
+
* path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' ,
|
|
1258
|
+
* ]
|
|
1259
|
+
* ```
|
|
1260
|
+
*
|
|
1261
|
+
* @param mapper - The mapper function that returns an array of objects
|
|
1262
|
+
* @returns An array of objects
|
|
1263
|
+
*/
|
|
1264
|
+
declare const localeFlatMap: <T>(mapper: (locale: LocaleData) => T[], locales?: LocalesValues[], defaultLocale?: LocalesValues, mode?: "prefix-no-default" | "prefix-all" | "no-prefix" | "search-params") => T[];
|
|
1265
|
+
/**
|
|
1266
|
+
* Creates a record object mapping locales to values transformed by the mapper function
|
|
1267
|
+
*
|
|
1268
|
+
* @example
|
|
1269
|
+
* ```ts
|
|
1270
|
+
* const translations = localeRecord(({ locale }) =>
|
|
1271
|
+
* require(`./translations/${locale}.json`)
|
|
1272
|
+
* );
|
|
1273
|
+
*
|
|
1274
|
+
* // Result
|
|
1275
|
+
*
|
|
1276
|
+
* en: ... , // Content of translations/en.json
|
|
1277
|
+
* fr: ... , // Content of translations/fr.json
|
|
1278
|
+
* es: ...
|
|
1279
|
+
*
|
|
1280
|
+
* ```
|
|
1281
|
+
*
|
|
1282
|
+
* @param mapper - Function that takes locale data and returns a value for that locale
|
|
1283
|
+
* @param locales - Array of locale codes to map over (defaults to configured locales)
|
|
1284
|
+
* @param defaultLocale - The default locale (defaults to configured default)
|
|
1285
|
+
* @param mode - URL routing mode for locale handling (defaults to configured value)
|
|
1286
|
+
* @returns Record mapping locale codes to mapped values
|
|
1287
|
+
*/
|
|
1288
|
+
declare const localeRecord: <T>(mapper: (locale: LocaleData) => T, locales?: LocalesValues[], defaultLocale?: LocalesValues, mode?: "prefix-no-default" | "prefix-all" | "no-prefix" | "search-params") => Record<LocalesValues, T>;
|
|
1289
|
+
//#endregion
|
|
1290
|
+
//#region src/localization/localeResolver.d.ts
|
|
1291
|
+
/**
|
|
1292
|
+
* Resolves the most specific locale from a user-provided list,
|
|
1293
|
+
* or falls back to the default locale if no match is found.
|
|
1294
|
+
*/
|
|
1295
|
+
declare const localeResolver: (selectedLocale: LocalesValues | LocalesValues[], locales?: LocalesValues[], defaultLocale?: LocalesValues) => Locale;
|
|
1296
|
+
//#endregion
|
|
1297
|
+
//#region src/utils/checkIsURLAbsolute.d.ts
|
|
1298
|
+
declare const checkIsURLAbsolute: (url: string) => boolean;
|
|
1299
|
+
//#endregion
|
|
1300
|
+
//#region src/utils/intl.d.ts
|
|
1301
|
+
type IntlConstructors = { [K in keyof typeof Intl as (typeof Intl)[K] extends (new (...args: any) => any) ? K : never]: (typeof Intl)[K] };
|
|
1302
|
+
type ReplaceLocaleWithLocalesValues<T> = T extends (new (locales: any, options?: infer Options) => infer Instance) ? new (locales?: LocalesValues, options?: Options) => Instance : T extends (new (locales: any) => infer Instance) ? new (locales?: LocalesValues) => Instance : T;
|
|
1303
|
+
type WrappedIntl = { [K in keyof typeof Intl]: K extends keyof IntlConstructors ? ReplaceLocaleWithLocalesValues<(typeof Intl)[K]> : (typeof Intl)[K] };
|
|
1304
|
+
declare const createCachedIntl: () => WrappedIntl;
|
|
1305
|
+
declare const CachedIntl: WrappedIntl;
|
|
1306
|
+
//#endregion
|
|
1307
|
+
//#region src/utils/isSameKeyPath.d.ts
|
|
1308
|
+
declare const isSameKeyPath: (keyPath1: KeyPath[], keyPath2: KeyPath[]) => boolean;
|
|
1309
|
+
//#endregion
|
|
1310
|
+
//#region src/utils/isValidReactElement.d.ts
|
|
1311
|
+
/**
|
|
1312
|
+
* Verifies the object is a ReactElement.
|
|
1313
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1314
|
+
* @param object
|
|
1315
|
+
* @return True if `object` is a ReactElement.
|
|
1316
|
+
* @final
|
|
1317
|
+
*/
|
|
1318
|
+
declare const isValidElement: (object: any) => boolean;
|
|
1319
|
+
//#endregion
|
|
1320
|
+
//#region src/utils/parseYaml.d.ts
|
|
1321
|
+
declare const parseYaml: <T = any>(input: string) => T | null;
|
|
1322
|
+
//#endregion
|
|
1323
|
+
export { CachedIntl, CachedIntl as Intl, ConditionCond, ConditionContent, ConditionContentStates, DeepTransformContent, DotPath, EnterFormat, EnumerationCond, EnumerationContent, EnumerationContentState, FileCond, FileContent, FileContentConstructor, Gender, GenderCond, GenderContent, GenderContentStates, GetNestingResult, IInterpreterPlugin, IInterpreterPluginState, InsertionCond, InsertionContent, InsertionContentConstructor, IsAny, LocaleStorage, LocaleStorageOptions, MarkdownContent, MarkdownContentConstructor, NestedCond, NestedContent, NestedContentState, NodeProps, Plugins, ProcessedStorageAttributes, TranslationCond, TranslationContent, ValidDotPathsFor, buildMaskPlugin, checkIsURLAbsolute, checkMissingLocalesPlugin, compact, condition as cond, conditionPlugin, createCachedIntl, currency, date, deepTransformNode, editDictionaryByKeyPath, enumeration as enu, enumerationPlugin, file, fileContent, filePlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, findMatchingCondition, gender, genderPlugin, getBrowserLocale, getCondition, getContent, getContentNodeByKeyPath, getDefaultNode, getDictionary, getEmptyNode, getEnumeration, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getHTMLTextDir, getInsertionValues, getIntlayer, getLocaleFromPath, getLocaleFromStorage, getLocaleLang, getLocaleName, getLocalizedContent, getLocalizedUrl, getMarkdownMetadata, getMaskContent, getMissingLocalesContent, getMissingLocalesContentFromDictionary, getMultilingualDictionary, getMultilingualUrls, getNesting, getNodeChildren, getNodeType, getPathWithoutLocale, getPerLocaleDictionary, getReplacedValuesContent, getSplittedContent, getSplittedDictionaryContent, getStorageAttributes, getTranslation, insertion as insert, insertContentInDictionary, insertionPlugin, isSameKeyPath, isValidElement, list, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions, markdown as md, mergeDictionaries, nesting as nest, nestedPlugin, normalizeDictionaries, normalizeDictionary, number, orderDictionaries, parseYaml, percentage, relativeTime, removeContentNodeByKeyPath, renameContentNodeByKeyPath, setLocaleInStorage, translation as t, translationPlugin, units, updateNodeChildren };
|