next-translate-plugin 2.4.2 → 2.4.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.
|
@@ -44,7 +44,7 @@ exports.default = templateAppDir;
|
|
|
44
44
|
function templateRSCPage(_a) {
|
|
45
45
|
var pagePkg = _a.pagePkg, hash = _a.hash, pageVariableName = _a.pageVariableName, pathname = _a.pathname, routeType = _a.routeType, existLocalesFolder = _a.existLocalesFolder;
|
|
46
46
|
var code = pagePkg.getCode();
|
|
47
|
-
return "\n import ".concat(utils_1.INTERNAL_CONFIG_KEY, " from '@next-translate-root/i18n'\n import AppDirI18nProvider from 'next-translate/AppDirI18nProvider'\n import __loadNamespaces from 'next-translate/loadNamespaces'\n\n ").concat(code, "\n\n export default async function __Next_Translate_new__").concat(hash, "__(props) {\n const config = { \n ...").concat(utils_1.INTERNAL_CONFIG_KEY, ",\n locale: props.params?.lang ?? props.searchParams?.lang ?? ").concat(utils_1.INTERNAL_CONFIG_KEY, ".defaultLocale,\n loaderName: 'server ").concat(routeType, "',\n pathname: '").concat(pathname, "'\n }\n\n const { __lang, __namespaces } = await __loadNamespaces({ ...config, ").concat((0, utils_1.addLoadLocalesFrom)(existLocalesFolder), " });\n globalThis.__NEXT_TRANSLATE__ = { lang: __lang, namespaces: __namespaces, config }\n\n return <AppDirI18nProvider lang={__lang} namespaces={__namespaces} config={config}><").concat(pageVariableName, " {...props} /></AppDirI18nProvider>\n }\n");
|
|
47
|
+
return "\n import ".concat(utils_1.INTERNAL_CONFIG_KEY, " from '@next-translate-root/i18n'\n import AppDirI18nProvider from 'next-translate/AppDirI18nProvider'\n import __loadNamespaces from 'next-translate/loadNamespaces'\n\n ").concat(code, "\n\n export default async function __Next_Translate_new__").concat(hash, "__(props) {\n const config = { \n ...JSON.parse(JSON.stringify(").concat(utils_1.INTERNAL_CONFIG_KEY, ")),\n locale: props.params?.lang ?? props.searchParams?.lang ?? ").concat(utils_1.INTERNAL_CONFIG_KEY, ".defaultLocale,\n loaderName: 'server ").concat(routeType, "',\n pathname: '").concat(pathname, "'\n }\n\n const { __lang, __namespaces } = await __loadNamespaces({ ...config, ").concat((0, utils_1.addLoadLocalesFrom)(existLocalesFolder), " });\n globalThis.__NEXT_TRANSLATE__ = { lang: __lang, namespaces: __namespaces, config }\n\n return <AppDirI18nProvider lang={__lang} namespaces={__namespaces} config={config}><").concat(pageVariableName, " {...props} /></AppDirI18nProvider>\n }\n");
|
|
48
48
|
}
|
|
49
49
|
function templateRCCPage(_a) {
|
|
50
50
|
var pagePkg = _a.pagePkg, hash = _a.hash, pageVariableName = _a.pageVariableName, pathname = _a.pathname, routeType = _a.routeType, existLocalesFolder = _a.existLocalesFolder;
|
|
@@ -53,5 +53,5 @@ function templateRCCPage(_a) {
|
|
|
53
53
|
utils_1.clientLine.forEach(function (line) {
|
|
54
54
|
clientCode = clientCode.replace(line, '');
|
|
55
55
|
});
|
|
56
|
-
return "".concat(topLine, "\n import ").concat(utils_1.INTERNAL_CONFIG_KEY, " from '@next-translate-root/i18n'\n import AppDirI18nProvider from 'next-translate/AppDirI18nProvider'\n import { useSearchParams as __useSearchParams, useParams as __useParams } from 'next/navigation'\n import { use as __use } from 'react'\n import __loadNamespaces from 'next-translate/loadNamespaces'\n\n ").concat(clientCode, "\n\n export default function __Next_Translate_new__").concat(hash, "__(props) {\n const searchParams = __useSearchParams()\n const params = __useParams()\n const lang = params.lang ?? searchParams.get('lang') ?? ").concat(utils_1.INTERNAL_CONFIG_KEY, ".defaultLocale\n const config = {\n ...").concat(utils_1.INTERNAL_CONFIG_KEY, ",\n locale: lang,\n loaderName: 'client ").concat(routeType, "',\n pathname: '").concat(pathname, "',\n }\n\n const { __lang, __namespaces } = __use(__loadNamespaces({ ...config, ").concat((0, utils_1.addLoadLocalesFrom)(existLocalesFolder), " }));\n globalThis.__NEXT_TRANSLATE__ = { lang: __lang, namespaces: __namespaces, config }\n\n return <").concat(pageVariableName, " {...props} />\n }\n");
|
|
56
|
+
return "".concat(topLine, "\n import ").concat(utils_1.INTERNAL_CONFIG_KEY, " from '@next-translate-root/i18n'\n import AppDirI18nProvider from 'next-translate/AppDirI18nProvider'\n import { useSearchParams as __useSearchParams, useParams as __useParams } from 'next/navigation'\n import { use as __use } from 'react'\n import __loadNamespaces from 'next-translate/loadNamespaces'\n\n ").concat(clientCode, "\n\n export default function __Next_Translate_new__").concat(hash, "__(props) {\n const searchParams = __useSearchParams()\n const params = __useParams()\n const lang = params.lang ?? searchParams.get('lang') ?? ").concat(utils_1.INTERNAL_CONFIG_KEY, ".defaultLocale\n const config = {\n ...JSON.parse(JSON.stringify(").concat(utils_1.INTERNAL_CONFIG_KEY, ")),\n locale: lang,\n loaderName: 'client ").concat(routeType, "',\n pathname: '").concat(pathname, "',\n }\n\n const { __lang, __namespaces } = __use(__loadNamespaces({ ...config, ").concat((0, utils_1.addLoadLocalesFrom)(existLocalesFolder), " }));\n globalThis.__NEXT_TRANSLATE__ = { lang: __lang, namespaces: __namespaces, config }\n\n return <").concat(pageVariableName, " {...props} />\n }\n");
|
|
57
57
|
}
|
|
@@ -41,7 +41,7 @@ export default function templateAppDir(pagePkg, _a) {
|
|
|
41
41
|
function templateRSCPage(_a) {
|
|
42
42
|
var pagePkg = _a.pagePkg, hash = _a.hash, pageVariableName = _a.pageVariableName, pathname = _a.pathname, routeType = _a.routeType, existLocalesFolder = _a.existLocalesFolder;
|
|
43
43
|
var code = pagePkg.getCode();
|
|
44
|
-
return "\n import ".concat(INTERNAL_CONFIG_KEY, " from '@next-translate-root/i18n'\n import AppDirI18nProvider from 'next-translate/AppDirI18nProvider'\n import __loadNamespaces from 'next-translate/loadNamespaces'\n\n ").concat(code, "\n\n export default async function __Next_Translate_new__").concat(hash, "__(props) {\n const config = { \n ...").concat(INTERNAL_CONFIG_KEY, ",\n locale: props.params?.lang ?? props.searchParams?.lang ?? ").concat(INTERNAL_CONFIG_KEY, ".defaultLocale,\n loaderName: 'server ").concat(routeType, "',\n pathname: '").concat(pathname, "'\n }\n\n const { __lang, __namespaces } = await __loadNamespaces({ ...config, ").concat(addLoadLocalesFrom(existLocalesFolder), " });\n globalThis.__NEXT_TRANSLATE__ = { lang: __lang, namespaces: __namespaces, config }\n\n return <AppDirI18nProvider lang={__lang} namespaces={__namespaces} config={config}><").concat(pageVariableName, " {...props} /></AppDirI18nProvider>\n }\n");
|
|
44
|
+
return "\n import ".concat(INTERNAL_CONFIG_KEY, " from '@next-translate-root/i18n'\n import AppDirI18nProvider from 'next-translate/AppDirI18nProvider'\n import __loadNamespaces from 'next-translate/loadNamespaces'\n\n ").concat(code, "\n\n export default async function __Next_Translate_new__").concat(hash, "__(props) {\n const config = { \n ...JSON.parse(JSON.stringify(").concat(INTERNAL_CONFIG_KEY, ")),\n locale: props.params?.lang ?? props.searchParams?.lang ?? ").concat(INTERNAL_CONFIG_KEY, ".defaultLocale,\n loaderName: 'server ").concat(routeType, "',\n pathname: '").concat(pathname, "'\n }\n\n const { __lang, __namespaces } = await __loadNamespaces({ ...config, ").concat(addLoadLocalesFrom(existLocalesFolder), " });\n globalThis.__NEXT_TRANSLATE__ = { lang: __lang, namespaces: __namespaces, config }\n\n return <AppDirI18nProvider lang={__lang} namespaces={__namespaces} config={config}><").concat(pageVariableName, " {...props} /></AppDirI18nProvider>\n }\n");
|
|
45
45
|
}
|
|
46
46
|
function templateRCCPage(_a) {
|
|
47
47
|
var pagePkg = _a.pagePkg, hash = _a.hash, pageVariableName = _a.pageVariableName, pathname = _a.pathname, routeType = _a.routeType, existLocalesFolder = _a.existLocalesFolder;
|
|
@@ -50,5 +50,5 @@ function templateRCCPage(_a) {
|
|
|
50
50
|
clientLine.forEach(function (line) {
|
|
51
51
|
clientCode = clientCode.replace(line, '');
|
|
52
52
|
});
|
|
53
|
-
return "".concat(topLine, "\n import ").concat(INTERNAL_CONFIG_KEY, " from '@next-translate-root/i18n'\n import AppDirI18nProvider from 'next-translate/AppDirI18nProvider'\n import { useSearchParams as __useSearchParams, useParams as __useParams } from 'next/navigation'\n import { use as __use } from 'react'\n import __loadNamespaces from 'next-translate/loadNamespaces'\n\n ").concat(clientCode, "\n\n export default function __Next_Translate_new__").concat(hash, "__(props) {\n const searchParams = __useSearchParams()\n const params = __useParams()\n const lang = params.lang ?? searchParams.get('lang') ?? ").concat(INTERNAL_CONFIG_KEY, ".defaultLocale\n const config = {\n ...").concat(INTERNAL_CONFIG_KEY, ",\n locale: lang,\n loaderName: 'client ").concat(routeType, "',\n pathname: '").concat(pathname, "',\n }\n\n const { __lang, __namespaces } = __use(__loadNamespaces({ ...config, ").concat(addLoadLocalesFrom(existLocalesFolder), " }));\n globalThis.__NEXT_TRANSLATE__ = { lang: __lang, namespaces: __namespaces, config }\n\n return <").concat(pageVariableName, " {...props} />\n }\n");
|
|
53
|
+
return "".concat(topLine, "\n import ").concat(INTERNAL_CONFIG_KEY, " from '@next-translate-root/i18n'\n import AppDirI18nProvider from 'next-translate/AppDirI18nProvider'\n import { useSearchParams as __useSearchParams, useParams as __useParams } from 'next/navigation'\n import { use as __use } from 'react'\n import __loadNamespaces from 'next-translate/loadNamespaces'\n\n ").concat(clientCode, "\n\n export default function __Next_Translate_new__").concat(hash, "__(props) {\n const searchParams = __useSearchParams()\n const params = __useParams()\n const lang = params.lang ?? searchParams.get('lang') ?? ").concat(INTERNAL_CONFIG_KEY, ".defaultLocale\n const config = {\n ...JSON.parse(JSON.stringify(").concat(INTERNAL_CONFIG_KEY, ")),\n locale: lang,\n loaderName: 'client ").concat(routeType, "',\n pathname: '").concat(pathname, "',\n }\n\n const { __lang, __namespaces } = __use(__loadNamespaces({ ...config, ").concat(addLoadLocalesFrom(existLocalesFolder), " }));\n globalThis.__NEXT_TRANSLATE__ = { lang: __lang, namespaces: __namespaces, config }\n\n return <").concat(pageVariableName, " {...props} />\n }\n");
|
|
54
54
|
}
|