@intlayer/core 7.0.9-canary.0 → 7.0.9-canary.3
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 +2 -1
- 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/index.cjs +3 -1
- package/dist/cjs/localization/getLocalizedUrl.cjs +33 -10
- package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
- package/dist/cjs/localization/getMultilingualUrls.cjs +16 -33
- package/dist/cjs/localization/getMultilingualUrls.cjs.map +1 -1
- package/dist/cjs/localization/getPrefix.cjs +47 -0
- package/dist/cjs/localization/getPrefix.cjs.map +1 -0
- package/dist/cjs/localization/index.cjs +3 -1
- 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/index.mjs +3 -2
- package/dist/esm/localization/getLocalizedUrl.mjs +33 -10
- package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -1
- package/dist/esm/localization/getMultilingualUrls.mjs +16 -33
- package/dist/esm/localization/getMultilingualUrls.mjs.map +1 -1
- package/dist/esm/localization/getPrefix.mjs +45 -0
- package/dist/esm/localization/getPrefix.mjs.map +1 -0
- package/dist/esm/localization/index.mjs +3 -2
- 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/dictionaryManipulator/orderDictionaries.d.ts +2 -2
- package/dist/types/dictionaryManipulator/orderDictionaries.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/localization/getLocalizedUrl.d.ts +13 -8
- package/dist/types/localization/getLocalizedUrl.d.ts.map +1 -1
- package/dist/types/localization/getMultilingualUrls.d.ts +13 -8
- package/dist/types/localization/getMultilingualUrls.d.ts.map +1 -1
- package/dist/types/localization/getPrefix.d.ts +46 -0
- package/dist/types/localization/getPrefix.d.ts.map +1 -0
- package/dist/types/localization/index.d.ts +2 -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
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { checkIsURLAbsolute } from "../utils/checkIsURLAbsolute.mjs";
|
|
2
|
+
import { getPathWithoutLocale } from "./getPathWithoutLocale.mjs";
|
|
3
|
+
import { DefaultValues } from "@intlayer/config/client";
|
|
2
4
|
import configuration from "@intlayer/config/built";
|
|
3
5
|
|
|
4
6
|
//#region src/localization/getLocalizedUrl.ts
|
|
@@ -12,33 +14,54 @@ import configuration from "@intlayer/config/built";
|
|
|
12
14
|
*
|
|
13
15
|
* ```ts
|
|
14
16
|
* // prefix-no-default mode
|
|
15
|
-
* getLocalizedUrl('/about', 'fr', ['en', 'fr'], 'en', 'prefix-no-default');
|
|
17
|
+
* getLocalizedUrl('/about', 'fr', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'prefix-no-default' });
|
|
16
18
|
* // Returns '/fr/about' for the French locale
|
|
17
19
|
* // Returns '/about' for the English locale (default)
|
|
18
20
|
*
|
|
19
21
|
* // prefix-all mode
|
|
20
|
-
* getLocalizedUrl('/about', 'en', ['en', 'fr'], 'en', 'prefix-all');
|
|
22
|
+
* getLocalizedUrl('/about', 'en', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'prefix-all' });
|
|
21
23
|
* // Returns '/en/about' for the English locale
|
|
22
24
|
* // Returns '/fr/about' for the French locale
|
|
23
25
|
*
|
|
24
26
|
* // search-params mode
|
|
25
|
-
* getLocalizedUrl('/about', 'fr', ['en', 'fr'], 'en', 'search-params');
|
|
27
|
+
* getLocalizedUrl('/about', 'fr', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'search-params' });
|
|
26
28
|
* // Returns '/about?locale=fr' for the French locale
|
|
27
29
|
*
|
|
28
30
|
* // no-prefix mode
|
|
29
|
-
* getLocalizedUrl('/about', 'fr', ['en', 'fr'], 'en', 'no-prefix');
|
|
31
|
+
* getLocalizedUrl('/about', 'fr', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'no-prefix' });
|
|
30
32
|
* // Returns '/about' for any locale
|
|
31
33
|
* ```
|
|
32
34
|
*
|
|
33
35
|
* @param url - The original URL string to be processed.
|
|
34
36
|
* @param currentLocale - The current locale.
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
37
|
+
* @param options - Configuration options
|
|
38
|
+
* @param options.locales - Optional array of supported locales. Defaults to configured locales.
|
|
39
|
+
* @param options.defaultLocale - The default locale. Defaults to configured default locale.
|
|
40
|
+
* @param options.mode - URL routing mode for locale handling. Defaults to configured mode.
|
|
38
41
|
* @returns The localized URL for the current locale.
|
|
39
42
|
*/
|
|
40
|
-
const getLocalizedUrl = (url, currentLocale,
|
|
41
|
-
|
|
43
|
+
const getLocalizedUrl = (url, currentLocale, options = {}) => {
|
|
44
|
+
const { locales = configuration?.internationalization?.locales ?? DefaultValues.Internationalization.LOCALES, defaultLocale = configuration?.internationalization?.defaultLocale ?? DefaultValues.Internationalization.DEFAULT_LOCALE, mode = configuration?.routing?.mode ?? DefaultValues.Routing.ROUTING_MODE } = options;
|
|
45
|
+
const urlWithoutLocale = getPathWithoutLocale(url, locales);
|
|
46
|
+
if (mode === "no-prefix") return urlWithoutLocale;
|
|
47
|
+
const isAbsoluteUrl = checkIsURLAbsolute(urlWithoutLocale);
|
|
48
|
+
const parsedUrl = isAbsoluteUrl ? new URL(urlWithoutLocale) : new URL(urlWithoutLocale, "http://example.com");
|
|
49
|
+
let pathname = parsedUrl.pathname;
|
|
50
|
+
if (!pathname.startsWith("/")) pathname = `/${pathname}`;
|
|
51
|
+
const baseUrl = isAbsoluteUrl ? `${parsedUrl.protocol}//${parsedUrl.host}` : "";
|
|
52
|
+
if (mode === "search-params") {
|
|
53
|
+
const searchParams = new URLSearchParams(parsedUrl.search);
|
|
54
|
+
searchParams.set("locale", currentLocale.toString());
|
|
55
|
+
const queryString = searchParams.toString();
|
|
56
|
+
const pathWithQuery = queryString ? `${pathname}?${queryString}` : pathname;
|
|
57
|
+
if (isAbsoluteUrl) return `${baseUrl}${pathWithQuery}${parsedUrl.hash}`;
|
|
58
|
+
return `${pathWithQuery}${parsedUrl.hash}`;
|
|
59
|
+
}
|
|
60
|
+
const isDefaultLocale = currentLocale?.toString() === defaultLocale?.toString();
|
|
61
|
+
let localizedPath = mode === "prefix-all" || mode === "prefix-no-default" && !isDefaultLocale ? `/${currentLocale}${pathname}` : pathname;
|
|
62
|
+
if (localizedPath.length > 1 && localizedPath.endsWith("/")) localizedPath = localizedPath.slice(0, -1);
|
|
63
|
+
if (isAbsoluteUrl) return `${baseUrl}${localizedPath}${parsedUrl.search}${parsedUrl.hash}`;
|
|
64
|
+
return `${localizedPath}${parsedUrl.search}${parsedUrl.hash}`;
|
|
42
65
|
};
|
|
43
66
|
|
|
44
67
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocalizedUrl.mjs","names":[],"sources":["../../../src/localization/getLocalizedUrl.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\nimport {
|
|
1
|
+
{"version":3,"file":"getLocalizedUrl.mjs","names":[],"sources":["../../../src/localization/getLocalizedUrl.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { DefaultValues } from '@intlayer/config/client';\nimport type { LocalesValues } from '@intlayer/types';\nimport { checkIsURLAbsolute } from '../utils/checkIsURLAbsolute';\nimport { getPathWithoutLocale } from './getPathWithoutLocale';\n\n/**\n * Generate URL by prefixing the given URL with the referenced locale or adding search parameters\n * based on the routing mode. Handles both absolute and relative URLs appropriately.\n *\n * This function gets the locales, default locale, and routing mode from the configuration if not provided.\n *\n * Example:\n *\n * ```ts\n * // prefix-no-default mode\n * getLocalizedUrl('/about', 'fr', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'prefix-no-default' });\n * // Returns '/fr/about' for the French locale\n * // Returns '/about' for the English locale (default)\n *\n * // prefix-all mode\n * getLocalizedUrl('/about', 'en', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'prefix-all' });\n * // Returns '/en/about' for the English locale\n * // Returns '/fr/about' for the French locale\n *\n * // search-params mode\n * getLocalizedUrl('/about', 'fr', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'search-params' });\n * // Returns '/about?locale=fr' for the French locale\n *\n * // no-prefix mode\n * getLocalizedUrl('/about', 'fr', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'no-prefix' });\n * // Returns '/about' for any locale\n * ```\n *\n * @param url - The original URL string to be processed.\n * @param currentLocale - The current locale.\n * @param options - Configuration options\n * @param options.locales - Optional array of supported locales. Defaults to configured locales.\n * @param options.defaultLocale - The default locale. Defaults to configured default locale.\n * @param options.mode - URL routing mode for locale handling. Defaults to configured mode.\n * @returns The localized URL for the current locale.\n */\nexport const getLocalizedUrl = (\n url: string,\n currentLocale: LocalesValues,\n options: {\n locales?: LocalesValues[];\n defaultLocale?: LocalesValues;\n mode?: 'prefix-no-default' | 'prefix-all' | 'no-prefix' | 'search-params';\n } = {}\n): string => {\n const {\n locales = configuration?.internationalization?.locales ??\n DefaultValues.Internationalization.LOCALES,\n defaultLocale = configuration?.internationalization?.defaultLocale ??\n DefaultValues.Internationalization.DEFAULT_LOCALE,\n mode = configuration?.routing?.mode ?? DefaultValues.Routing.ROUTING_MODE,\n } = options;\n // Remove any existing locale segment from the URL\n const urlWithoutLocale = getPathWithoutLocale(url, locales);\n\n if (mode === 'no-prefix') {\n // No locale prefixing\n return urlWithoutLocale;\n }\n\n // Determine if the original URL is absolute (includes protocol)\n const isAbsoluteUrl = checkIsURLAbsolute(urlWithoutLocale);\n\n // Initialize a URL object if the URL is absolute\n // For relative URLs, use a dummy base to leverage the URL API\n const parsedUrl = isAbsoluteUrl\n ? new URL(urlWithoutLocale)\n : new URL(urlWithoutLocale, 'http://example.com');\n\n // Extract the pathname from the parsed URL\n let pathname = parsedUrl.pathname;\n\n // Ensure the pathname starts with a '/'\n if (!pathname.startsWith('/')) {\n pathname = `/${pathname}`;\n }\n\n // Prepare the base URL (protocol + host) if it's absolute\n const baseUrl = isAbsoluteUrl\n ? `${parsedUrl.protocol}//${parsedUrl.host}`\n : '';\n\n if (mode === 'search-params') {\n // Use search parameters for locale handling\n const searchParams = new URLSearchParams(parsedUrl.search);\n searchParams.set('locale', currentLocale.toString());\n\n const queryString = searchParams.toString();\n const pathWithQuery = queryString ? `${pathname}?${queryString}` : pathname;\n\n if (isAbsoluteUrl) {\n return `${baseUrl}${pathWithQuery}${parsedUrl.hash}`;\n }\n\n return `${pathWithQuery}${parsedUrl.hash}`;\n }\n\n // Prefix-based routing (prefix-all or prefix-no-default)\n const isDefaultLocale =\n currentLocale?.toString() === defaultLocale?.toString();\n\n const shouldPrefix =\n mode === 'prefix-all' || (mode === 'prefix-no-default' && !isDefaultLocale);\n\n // Construct the new pathname with or without the locale prefix\n let localizedPath = shouldPrefix ? `/${currentLocale}${pathname}` : pathname;\n\n // Remove trailing slash for non-root paths\n if (localizedPath.length > 1 && localizedPath.endsWith('/')) {\n localizedPath = localizedPath.slice(0, -1);\n }\n\n // Combine with the base URL if the original URL was absolute\n if (isAbsoluteUrl) {\n return `${baseUrl}${localizedPath}${parsedUrl.search}${parsedUrl.hash}`;\n }\n\n return `${localizedPath}${parsedUrl.search}${parsedUrl.hash}`;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,mBACX,KACA,eACA,UAII,EAAE,KACK;CACX,MAAM,EACJ,UAAU,eAAe,sBAAsB,WAC7C,cAAc,qBAAqB,SACrC,gBAAgB,eAAe,sBAAsB,iBACnD,cAAc,qBAAqB,gBACrC,OAAO,eAAe,SAAS,QAAQ,cAAc,QAAQ,iBAC3D;CAEJ,MAAM,mBAAmB,qBAAqB,KAAK,QAAQ;AAE3D,KAAI,SAAS,YAEX,QAAO;CAIT,MAAM,gBAAgB,mBAAmB,iBAAiB;CAI1D,MAAM,YAAY,gBACd,IAAI,IAAI,iBAAiB,GACzB,IAAI,IAAI,kBAAkB,qBAAqB;CAGnD,IAAI,WAAW,UAAU;AAGzB,KAAI,CAAC,SAAS,WAAW,IAAI,CAC3B,YAAW,IAAI;CAIjB,MAAM,UAAU,gBACZ,GAAG,UAAU,SAAS,IAAI,UAAU,SACpC;AAEJ,KAAI,SAAS,iBAAiB;EAE5B,MAAM,eAAe,IAAI,gBAAgB,UAAU,OAAO;AAC1D,eAAa,IAAI,UAAU,cAAc,UAAU,CAAC;EAEpD,MAAM,cAAc,aAAa,UAAU;EAC3C,MAAM,gBAAgB,cAAc,GAAG,SAAS,GAAG,gBAAgB;AAEnE,MAAI,cACF,QAAO,GAAG,UAAU,gBAAgB,UAAU;AAGhD,SAAO,GAAG,gBAAgB,UAAU;;CAItC,MAAM,kBACJ,eAAe,UAAU,KAAK,eAAe,UAAU;CAMzD,IAAI,gBAHF,SAAS,gBAAiB,SAAS,uBAAuB,CAAC,kBAG1B,IAAI,gBAAgB,aAAa;AAGpE,KAAI,cAAc,SAAS,KAAK,cAAc,SAAS,IAAI,CACzD,iBAAgB,cAAc,MAAM,GAAG,GAAG;AAI5C,KAAI,cACF,QAAO,GAAG,UAAU,gBAAgB,UAAU,SAAS,UAAU;AAGnE,QAAO,GAAG,gBAAgB,UAAU,SAAS,UAAU"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getPathWithoutLocale } from "./getPathWithoutLocale.mjs";
|
|
3
|
-
import { DefaultValues } from "@intlayer/config/client";
|
|
1
|
+
import { getLocalizedUrl } from "./getLocalizedUrl.mjs";
|
|
4
2
|
import configuration from "@intlayer/config/built";
|
|
5
3
|
|
|
6
4
|
//#region src/localization/getMultilingualUrls.ts
|
|
@@ -15,52 +13,37 @@ import configuration from "@intlayer/config/built";
|
|
|
15
13
|
*
|
|
16
14
|
* ```ts
|
|
17
15
|
* // prefix-no-default mode
|
|
18
|
-
* getMultilingualUrls('/dashboard', ['en', 'fr'], 'en', 'prefix-no-default')
|
|
16
|
+
* getMultilingualUrls('/dashboard', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'prefix-no-default' })
|
|
19
17
|
* // Returns { en: '/dashboard', fr: '/fr/dashboard' }
|
|
20
18
|
*
|
|
21
19
|
* // prefix-all mode
|
|
22
|
-
* getMultilingualUrls('/dashboard', ['en', 'fr'], 'en', 'prefix-all')
|
|
20
|
+
* getMultilingualUrls('/dashboard', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'prefix-all' })
|
|
23
21
|
* // Returns { en: '/en/dashboard', fr: '/fr/dashboard' }
|
|
24
22
|
*
|
|
25
23
|
* // search-params mode
|
|
26
|
-
* getMultilingualUrls('/dashboard', ['en', 'fr'], 'en', 'search-params')
|
|
24
|
+
* getMultilingualUrls('/dashboard', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'search-params' })
|
|
27
25
|
* // Returns { en: '/dashboard?locale=en', fr: '/dashboard?locale=fr' }
|
|
28
26
|
*
|
|
29
27
|
* // no-prefix mode
|
|
30
|
-
* getMultilingualUrls('/dashboard', ['en', 'fr'], 'en', 'no-prefix')
|
|
28
|
+
* getMultilingualUrls('/dashboard', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'no-prefix' })
|
|
31
29
|
* // Returns { en: '/dashboard', fr: '/dashboard' }
|
|
32
30
|
* ```
|
|
33
31
|
*
|
|
34
32
|
* @param url - The original URL string to be processed.
|
|
35
|
-
* @param
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
33
|
+
* @param options - Configuration options
|
|
34
|
+
* @param options.locales - Optional array of supported locales. Defaults to configured locales.
|
|
35
|
+
* @param options.defaultLocale - The default locale. Defaults to configured default locale.
|
|
36
|
+
* @param options.mode - URL routing mode for locale handling. Defaults to configured mode.
|
|
38
37
|
* @returns An object mapping each locale to its corresponding multilingual URL.
|
|
39
38
|
*/
|
|
40
|
-
const getMultilingualUrls = (url,
|
|
41
|
-
const
|
|
42
|
-
const isAbsoluteUrl = checkIsURLAbsolute(urlWithoutLocale);
|
|
43
|
-
const parsedUrl = isAbsoluteUrl ? new URL(urlWithoutLocale) : new URL(urlWithoutLocale, "http://example.com");
|
|
44
|
-
let pathname = parsedUrl.pathname;
|
|
45
|
-
if (!pathname.startsWith("/")) pathname = `/${pathname}`;
|
|
46
|
-
const baseUrl = isAbsoluteUrl ? `${parsedUrl.protocol}//${parsedUrl.host}` : "";
|
|
47
|
-
const routingMode = mode ?? DefaultValues.Routing.ROUTING_MODE;
|
|
39
|
+
const getMultilingualUrls = (url, options = {}) => {
|
|
40
|
+
const { locales = configuration?.internationalization?.locales, defaultLocale = configuration?.internationalization?.defaultLocale, mode = configuration?.routing?.mode } = options;
|
|
48
41
|
return (locales ?? []).reduce((acc, locale) => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const queryString = searchParams.toString();
|
|
55
|
-
const pathWithQuery = queryString ? `${pathname}?${queryString}` : pathname;
|
|
56
|
-
localizedUrl = isAbsoluteUrl ? `${baseUrl}${pathWithQuery}${parsedUrl.hash}` : `${pathWithQuery}${parsedUrl.hash}`;
|
|
57
|
-
} else if (routingMode === "no-prefix") localizedUrl = isAbsoluteUrl ? `${baseUrl}${pathname}${parsedUrl.search}${parsedUrl.hash}` : `${pathname}${parsedUrl.search}${parsedUrl.hash}`;
|
|
58
|
-
else {
|
|
59
|
-
let localizedPath = routingMode === "prefix-all" || routingMode === "prefix-no-default" && !isDefaultLocale ? `/${locale}${pathname}` : pathname;
|
|
60
|
-
if (localizedPath.length > 1 && localizedPath.endsWith("/")) localizedPath = localizedPath.slice(0, -1);
|
|
61
|
-
localizedUrl = isAbsoluteUrl ? `${baseUrl}${localizedPath}${parsedUrl.search}${parsedUrl.hash}` : `${localizedPath}${parsedUrl.search}${parsedUrl.hash}`;
|
|
62
|
-
}
|
|
63
|
-
acc[locale] = localizedUrl;
|
|
42
|
+
acc[locale] = getLocalizedUrl(url, locale, {
|
|
43
|
+
locales,
|
|
44
|
+
defaultLocale,
|
|
45
|
+
mode
|
|
46
|
+
});
|
|
64
47
|
return acc;
|
|
65
48
|
}, {});
|
|
66
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMultilingualUrls.mjs","names":[
|
|
1
|
+
{"version":3,"file":"getMultilingualUrls.mjs","names":[],"sources":["../../../src/localization/getMultilingualUrls.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues, StrictModeLocaleMap } from '@intlayer/types';\nimport { getLocalizedUrl } from './getLocalizedUrl';\n\n/**\n * Generates multilingual URLs by prefixing the given URL with each supported locale\n * or adding search parameters based on the routing mode.\n * Handles both absolute and relative URLs appropriately.\n *\n * This function gets the locales, default locale, and routing mode from the configuration if not provided.\n *\n * Example:\n *\n * ```ts\n * // prefix-no-default mode\n * getMultilingualUrls('/dashboard', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'prefix-no-default' })\n * // Returns { en: '/dashboard', fr: '/fr/dashboard' }\n *\n * // prefix-all mode\n * getMultilingualUrls('/dashboard', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'prefix-all' })\n * // Returns { en: '/en/dashboard', fr: '/fr/dashboard' }\n *\n * // search-params mode\n * getMultilingualUrls('/dashboard', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'search-params' })\n * // Returns { en: '/dashboard?locale=en', fr: '/dashboard?locale=fr' }\n *\n * // no-prefix mode\n * getMultilingualUrls('/dashboard', { locales: ['en', 'fr'], defaultLocale: 'en', mode: 'no-prefix' })\n * // Returns { en: '/dashboard', fr: '/dashboard' }\n * ```\n *\n * @param url - The original URL string to be processed.\n * @param options - Configuration options\n * @param options.locales - Optional array of supported locales. Defaults to configured locales.\n * @param options.defaultLocale - The default locale. Defaults to configured default locale.\n * @param options.mode - URL routing mode for locale handling. Defaults to configured mode.\n * @returns An object mapping each locale to its corresponding multilingual URL.\n */\nexport const getMultilingualUrls = (\n url: string,\n options: {\n locales?: LocalesValues[];\n defaultLocale?: LocalesValues;\n mode?: 'prefix-no-default' | 'prefix-all' | 'no-prefix' | 'search-params';\n } = {}\n): StrictModeLocaleMap<string> => {\n const {\n locales = configuration?.internationalization?.locales,\n defaultLocale = configuration?.internationalization?.defaultLocale,\n mode = configuration?.routing?.mode,\n } = options;\n\n // Generate multilingual URLs by iterating over each locale and calling getLocalizedUrl\n const multilingualUrls = (locales ?? []).reduce<StrictModeLocaleMap<string>>(\n (acc, locale) => {\n // Get the localized URL for this locale\n const localizedUrl = getLocalizedUrl(url, locale, {\n locales,\n defaultLocale,\n mode,\n });\n\n // Assign the constructed URL to the corresponding locale key\n acc[locale as unknown as keyof typeof acc] = localizedUrl;\n\n return acc;\n },\n {} as StrictModeLocaleMap<string>\n );\n\n return multilingualUrls;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,uBACX,KACA,UAII,EAAE,KAC0B;CAChC,MAAM,EACJ,UAAU,eAAe,sBAAsB,SAC/C,gBAAgB,eAAe,sBAAsB,eACrD,OAAO,eAAe,SAAS,SAC7B;AAoBJ,SAjB0B,WAAW,EAAE,EAAE,QACtC,KAAK,WAAW;AASf,MAAI,UAPiB,gBAAgB,KAAK,QAAQ;GAChD;GACA;GACA;GACD,CAAC;AAKF,SAAO;IAET,EAAE,CACH"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import configuration from "@intlayer/config/built";
|
|
2
|
+
|
|
3
|
+
//#region src/localization/getPrefix.ts
|
|
4
|
+
/**
|
|
5
|
+
* Determines the URL prefix for a given locale based on the routing mode configuration.
|
|
6
|
+
*
|
|
7
|
+
* Example:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* // prefix-no-default mode with default locale
|
|
11
|
+
* getPrefix('en', { defaultLocale: 'en', mode: 'prefix-no-default' })
|
|
12
|
+
* // Returns ''
|
|
13
|
+
*
|
|
14
|
+
* // prefix-no-default mode with non-default locale
|
|
15
|
+
* getPrefix('fr', { defaultLocale: 'en', mode: 'prefix-no-default' })
|
|
16
|
+
* // Returns 'en/'
|
|
17
|
+
*
|
|
18
|
+
* // prefix-all mode
|
|
19
|
+
* getPrefix('en', { defaultLocale: 'en', mode: 'prefix-all' })
|
|
20
|
+
* // Returns 'en/'
|
|
21
|
+
*
|
|
22
|
+
* // search-params mode
|
|
23
|
+
* getPrefix('en', { defaultLocale: 'en', mode: 'search-params' })
|
|
24
|
+
* // Returns ''
|
|
25
|
+
*
|
|
26
|
+
* // no-prefix mode
|
|
27
|
+
* getPrefix('en', { defaultLocale: 'en', mode: 'no-prefix' })
|
|
28
|
+
* // Returns ''
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param locale - The locale to check for prefix. If not provided, uses configured default locale.
|
|
32
|
+
* @param options - Configuration options
|
|
33
|
+
* @param options.defaultLocale - The default locale. Defaults to configured default locale.
|
|
34
|
+
* @param options.mode - URL routing mode for locale handling. Defaults to configured mode.
|
|
35
|
+
* @param options.addSlash - Whether to add a trailing slash to the prefix. Defaults to true.
|
|
36
|
+
* @returns The prefix string for the given locale (e.g., 'en/', 'fr/') or an empty string.
|
|
37
|
+
*/
|
|
38
|
+
const getPrefix = (locale, options = {}) => {
|
|
39
|
+
const { defaultLocale = configuration?.internationalization?.defaultLocale, mode = configuration?.routing?.mode, addSlash = true } = options;
|
|
40
|
+
return mode === "prefix-all" || mode === "prefix-no-default" && defaultLocale !== locale ? `${defaultLocale}${addSlash ? "/" : ""}` : "";
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { getPrefix };
|
|
45
|
+
//# sourceMappingURL=getPrefix.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPrefix.mjs","names":[],"sources":["../../../src/localization/getPrefix.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/types';\n\n/**\n * Determines the URL prefix for a given locale based on the routing mode configuration.\n *\n * Example:\n *\n * ```ts\n * // prefix-no-default mode with default locale\n * getPrefix('en', { defaultLocale: 'en', mode: 'prefix-no-default' })\n * // Returns ''\n *\n * // prefix-no-default mode with non-default locale\n * getPrefix('fr', { defaultLocale: 'en', mode: 'prefix-no-default' })\n * // Returns 'en/'\n *\n * // prefix-all mode\n * getPrefix('en', { defaultLocale: 'en', mode: 'prefix-all' })\n * // Returns 'en/'\n *\n * // search-params mode\n * getPrefix('en', { defaultLocale: 'en', mode: 'search-params' })\n * // Returns ''\n *\n * // no-prefix mode\n * getPrefix('en', { defaultLocale: 'en', mode: 'no-prefix' })\n * // Returns ''\n * ```\n *\n * @param locale - The locale to check for prefix. If not provided, uses configured default locale.\n * @param options - Configuration options\n * @param options.defaultLocale - The default locale. Defaults to configured default locale.\n * @param options.mode - URL routing mode for locale handling. Defaults to configured mode.\n * @param options.addSlash - Whether to add a trailing slash to the prefix. Defaults to true.\n * @returns The prefix string for the given locale (e.g., 'en/', 'fr/') or an empty string.\n */\nexport const getPrefix = (\n locale?: LocalesValues,\n options: {\n defaultLocale?: LocalesValues;\n mode?: 'prefix-no-default' | 'prefix-all' | 'no-prefix' | 'search-params';\n addSlash?: boolean;\n } = {}\n): string => {\n const {\n defaultLocale = configuration?.internationalization?.defaultLocale,\n mode = configuration?.routing?.mode,\n addSlash = true,\n } = options;\n\n // Handle prefix-based modes (prefix-all or prefix-no-default)\n const shouldPrefix =\n mode === 'prefix-all' ||\n (mode === 'prefix-no-default' && defaultLocale !== locale);\n\n return shouldPrefix ? `${defaultLocale}${addSlash ? '/' : ''}` : '';\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,aACX,QACA,UAII,EAAE,KACK;CACX,MAAM,EACJ,gBAAgB,eAAe,sBAAsB,eACrD,OAAO,eAAe,SAAS,MAC/B,WAAW,SACT;AAOJ,QAHE,SAAS,gBACR,SAAS,uBAAuB,kBAAkB,SAE/B,GAAG,gBAAgB,WAAW,MAAM,OAAO"}
|
|
@@ -6,8 +6,9 @@ import { getLocaleFromPath } from "./getLocaleFromPath.mjs";
|
|
|
6
6
|
import { getLocaleLang } from "./getLocaleLang.mjs";
|
|
7
7
|
import { getLocaleName } from "./getLocaleName.mjs";
|
|
8
8
|
import { getPathWithoutLocale } from "./getPathWithoutLocale.mjs";
|
|
9
|
-
import { getMultilingualUrls } from "./getMultilingualUrls.mjs";
|
|
10
9
|
import { getLocalizedUrl } from "./getLocalizedUrl.mjs";
|
|
10
|
+
import { getMultilingualUrls } from "./getMultilingualUrls.mjs";
|
|
11
|
+
import { getPrefix } from "./getPrefix.mjs";
|
|
11
12
|
import { localeFlatMap, localeMap, localeRecord } from "./localeMapper.mjs";
|
|
12
13
|
|
|
13
|
-
export { getBrowserLocale, getHTMLTextDir, getLocaleFromPath, getLocaleLang, getLocaleName, getLocalizedUrl, getMultilingualUrls, getPathWithoutLocale, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions };
|
|
14
|
+
export { getBrowserLocale, getHTMLTextDir, getLocaleFromPath, getLocaleLang, getLocaleName, getLocalizedUrl, getMultilingualUrls, getPathWithoutLocale, getPrefix, localeDetector, localeFlatMap, localeMap, localeRecord, localeResolver, localeStorageOptions };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../types/dist/esm/_virtual/rolldown_runtime.mjs
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (all) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
return target;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __export };
|
|
14
|
+
//# sourceMappingURL=rolldown_runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown_runtime.mjs","names":[],"sources":["../../../../../../../types/dist/esm/_virtual/rolldown_runtime.mjs"],"sourcesContent":["//#region rolldown:runtime\nvar __defProp = Object.defineProperty;\nvar __export = (all) => {\n\tlet target = {};\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n\treturn target;\n};\n\n//#endregion\nexport { __export };"],"mappings":";AACA,IAAI,YAAY,OAAO;AACvB,IAAI,YAAY,QAAQ;CACvB,IAAI,SAAS,EAAE;AACf,MAAK,IAAI,QAAQ,IAAK,WAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;EACZ,CAAC;AACF,QAAO"}
|