gt-next 6.16.35 → 6.16.36
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/CHANGELOG.md +8 -0
- package/dist/errors/createErrors.d.ts +1 -0
- package/dist/errors/createErrors.d.ts.map +1 -1
- package/dist/errors/createErrors.js +7 -0
- package/dist/errors/createErrors.js.map +1 -1
- package/dist/request/getLocale.d.ts.map +1 -1
- package/dist/request/getLocale.js +2 -2
- package/dist/request/getLocale.js.map +1 -1
- package/dist/request/localeValidation.d.ts +14 -0
- package/dist/request/localeValidation.d.ts.map +1 -0
- package/dist/request/localeValidation.js +36 -0
- package/dist/request/localeValidation.js.map +1 -0
- package/dist/request/registerLocale.d.ts +1 -1
- package/dist/request/registerLocale.d.ts.map +1 -1
- package/dist/request/registerLocale.js +5 -3
- package/dist/request/registerLocale.js.map +1 -1
- package/dist/request/utils/legacyGetLocaleFunction.d.ts.map +1 -1
- package/dist/request/utils/legacyGetLocaleFunction.js +2 -2
- package/dist/request/utils/legacyGetLocaleFunction.js.map +1 -1
- package/dist/server.d.ts +2 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -0
- package/dist/server.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# gt-next
|
|
2
2
|
|
|
3
|
+
## 6.16.36
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1768](https://github.com/generaltranslation/gt/pull/1768) [`da5385f`](https://github.com/generaltranslation/gt/commit/da5385f6ce6497c542a68d4c9207ce2bd0aa2a25) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Retry main releases that were blocked by recent release workflow failures.
|
|
8
|
+
|
|
9
|
+
- [#1729](https://github.com/generaltranslation/gt/pull/1729) [`3b389dc`](https://github.com/generaltranslation/gt/commit/3b389dc08f3d86e2cea91a25e22840c188328d94) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - Fallback to the default locale when request locale resolution returns an invalid or unsupported locale. This prevents request-derived locale values from causing runtime errors, and adds `isLocaleSupported()` to `gt-next/server` for apps that want to explicitly reject invalid locale route params.
|
|
10
|
+
|
|
3
11
|
## 6.16.35
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -22,6 +22,7 @@ export declare const missingVariablesError: (variables: string[], message: strin
|
|
|
22
22
|
export declare const createStringRenderError: (message: string, id: string | undefined, error?: unknown) => string;
|
|
23
23
|
export declare const invalidLocalesError: (locales: string[]) => string;
|
|
24
24
|
export declare const invalidCanonicalLocalesError: (locales: string[]) => string;
|
|
25
|
+
export declare const createInvalidRequestLocaleWarning: (locale: string, defaultLocale: string) => string;
|
|
25
26
|
export declare const createInvalidIcuDictionaryEntryError: (id: string) => string;
|
|
26
27
|
export declare const createInvalidIcuDictionaryEntryWarning: (id: string) => string;
|
|
27
28
|
export declare const createBadFilepathWarning: (filename: string, dir: string[]) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createErrors.d.ts","sourceRoot":"","sources":["../../src/errors/createErrors.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,uBAAuB,QAKlC,CAAC;AAEH,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAW,WAK3D,CAAC;AAEL,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAW,WAK3D,CAAC;AAEL,eAAO,MAAM,gCAAgC,GAAI,OAAO,KAAK,WAMzD,CAAC;AAEL,eAAO,MAAM,iCAAiC,GAAI,OAAO,KAAK,WAM1D,CAAC;AAEL,eAAO,MAAM,4BAA4B,GACvC,QAAQ,MAAM,EACd,KAAK,MAAM,EACX,qBAAmB,WAOjB,CAAC;AAEL,eAAO,MAAM,gCAAgC,GAAI,IAAI,MAAM,WAKvD,CAAC;AAEL,eAAO,MAAM,yBAAyB,GAAI,IAAI,MAAM,EAAE,gBAAgB,MAAM,WAKxE,CAAC;AAEL,eAAO,MAAM,kCA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AO,MAAM,8BAA8B,kIAAgI,CAAC;AAE5K,eAAO,MAAM,iCAAiC,GAAI,MAAM,OAAO,GAAG,KAAK,WAC8B,CAAC;AAEtG,eAAO,MAAM,kCAAkC,GAAI,MAAM,OAAO,GAAG,KAAK,4NAGyD,CAAC;AAElI,eAAO,MAAM,wCAAwC,QAE8C,CAAC;AAEpG,eAAO,MAAM,+BAA+B,0FAA0F,CAAC;AAEvI,eAAO,MAAM,yBAAyB,GACpC,SAAS,MAAM,EACf,IAAI,MAAM,GAAG,SAAS,EACtB,QAAQ,OAAO,WAOb,CAAC;AAEL,eAAO,MAAM,mCAAmC,0JAAyK,CAAC"}
|
|
@@ -121,6 +121,12 @@ const invalidCanonicalLocalesError = (locales) => require_errors_diagnostics.cre
|
|
|
121
121
|
fix: "Use valid BCP 47 locale codes before starting translation",
|
|
122
122
|
details: locales
|
|
123
123
|
});
|
|
124
|
+
const createInvalidRequestLocaleWarning = (locale, defaultLocale) => require_errors_diagnostics.createGtNextDiagnostic({
|
|
125
|
+
severity: "Warning",
|
|
126
|
+
whatHappened: `Locale "${locale}" is not valid or is not supported by this app`,
|
|
127
|
+
wayOut: `The default locale "${defaultLocale}" will be used for this request`,
|
|
128
|
+
fix: "Use a valid BCP 47 locale code, add a custom mapping, or configure the locale in gt-next"
|
|
129
|
+
});
|
|
124
130
|
const createInvalidIcuDictionaryEntryError = (id) => require_errors_diagnostics.createGtNextDiagnostic({
|
|
125
131
|
severity: "Error",
|
|
126
132
|
whatHappened: `Dictionary entry "${id}" contains invalid ICU syntax`,
|
|
@@ -204,6 +210,7 @@ exports.createInvalidDictionaryEntryWarning = createInvalidDictionaryEntryWarnin
|
|
|
204
210
|
exports.createInvalidDictionaryTranslationEntryWarning = createInvalidDictionaryTranslationEntryWarning;
|
|
205
211
|
exports.createInvalidIcuDictionaryEntryError = createInvalidIcuDictionaryEntryError;
|
|
206
212
|
exports.createInvalidIcuDictionaryEntryWarning = createInvalidIcuDictionaryEntryWarning;
|
|
213
|
+
exports.createInvalidRequestLocaleWarning = createInvalidRequestLocaleWarning;
|
|
207
214
|
exports.createMismatchingHashWarning = createMismatchingHashWarning;
|
|
208
215
|
exports.createNoEntryFoundWarning = createNoEntryFoundWarning;
|
|
209
216
|
exports.createRequiredPrefixError = createRequiredPrefixError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createErrors.js","names":["createGtNextDiagnostic","createGtNextPluginDiagnostic","SWC_PLUGIN_SUPPORT","BABEL_PLUGIN_SUPPORT"],"sources":["../../src/errors/createErrors.ts"],"sourcesContent":["// ---- ERRORS ---- //\n\nimport { getLocaleProperties } from '@generaltranslation/format';\nimport {\n createGtNextDiagnostic,\n createGtNextPluginDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\nimport { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from '../plugin/constants';\n\nexport const remoteTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Remote translations could not be loaded',\n fix: 'Check your project ID, API key, and network connection, then try again',\n wayOut: 'Source content will render as a fallback',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const createUnresolvedNextVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed Next.js version could not be resolved',\n fix: 'Check that next is installed in this project',\n details: error.message,\n });\n\nexport const createUnresolvedReactVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed React version could not be resolved',\n fix: 'Check that react is installed in this project',\n details: error.message,\n });\n\nexport const createStringTranslationError = (\n string: string,\n id?: string,\n functionName = 'tx'\n) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName}(\"${string}\")${id ? ` with id \"${id}\"` : ''} could not find a translation`,\n wayOut: 'Source content will render as a fallback',\n fix: 'Push translations again or check your dictionary/runtime translation configuration',\n });\n\nexport const createDictionaryTranslationError = (id: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Dictionary translation entry \"${id}\" could not be found`,\n fix: 'Check that the id exists in your dictionary or push translations again',\n });\n\nexport const createRequiredPrefixError = (id: string, requiredPrefix: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `<GTProvider> is scoped to prefix \"${requiredPrefix}\", but a child uses id \"${id}\"`,\n fix: 'Change the <GTProvider> id prop or move the child under the matching dictionary subtree',\n });\n\nexport const devApiKeyIncludedInProductionError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Production builds cannot use a development API key',\n fix: 'Replace it with a production API key',\n});\n\nexport const createDictionarySubsetError = (id: string, functionName: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName} with id \"${id}\" could not read a valid dictionary subtree`,\n fix: 'Make sure the id maps to the correct subroute of the dictionary',\n });\n\nexport const dictionaryDisabledError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Dictionaries are not enabled',\n fix: 'Add the withGTConfig() plugin to your Next.js config before using dictionary translations',\n docsUrl: 'https://generaltranslation.com/docs',\n});\n\nexport const unresolvedCustomLoadDictionaryError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadDictionary() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadDictionary() function from the configured file',\n});\n\nexport const unresolvedCustomLoadTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadTranslations() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadTranslations() function from the configured file',\n});\n\nexport const unresolvedLoadDictionaryBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedLoadTranslationsBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadTranslations() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedGetLocaleBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining custom getLocale() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const conflictingConfigurationBuildError = (conflicts: string[]) =>\n `gt-next Error: Conflicting configuration${\n conflicts.length > 1 ? 's' : ''\n } detected. Resolve the following conflicts before building your app:\\n${conflicts.join(\n '\\n'\n )}`;\n\nexport const typesFileError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'A types-only entry point was executed at runtime',\n fix: 'Import from the appropriate gt-next runtime entry point instead',\n});\n\nexport const gtProviderUseClientError =\n `The Next.js <GTProvider> was imported in a client component. This prevents gt-next from fetching translations on the server. ` +\n `Move <GTProvider> to a file without 'use client'. ` +\n `If you really need to put <GTProvider> on the client, import <GTClientProvider> from 'gt-next/client' instead (discouraged when using the Next.js App Router).`;\n\nexport const txUseClientError =\n `The <Tx> runtime translation component was rendered in a client component, which is not supported. ` +\n `Use <T> with variables, or render <Tx> from a server component.`;\n\nexport const missingVariablesError = (variables: string[], message: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The message \"${message}\" is missing variables: \"${variables.join('\", \"')}\"`,\n fix: 'Provide values for these variables before rendering the translation',\n });\n\nexport const createStringRenderError = (\n message: string,\n id: string | undefined,\n error?: unknown\n) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The string ${id ? `for id \"${id}\" ` : ''}could not be rendered`,\n fix: `Check the message syntax and variables for: \"${message}\"`,\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const invalidLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\nexport const createInvalidIcuDictionaryEntryError = (id: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Dictionary entry \"${id}\" contains invalid ICU syntax`,\n fix: 'Fix the ICU message before rendering this translation',\n });\n\n// ---- WARNINGS ---- //\n\nexport const createInvalidIcuDictionaryEntryWarning = (id: string) =>\n createGtNextDiagnostic({\n whatHappened: `Dictionary entry \"${id}\" contains invalid ICU syntax`,\n wayOut: 'Source content will render as a fallback until the entry is fixed',\n });\n\nexport const createBadFilepathWarning = (filename: string, dir: string[]) =>\n createGtNextDiagnostic({\n whatHappened: `${filename} was found in ${dir.join(' or ')}, which is not supported`,\n fix: 'Move it to your project root so gt-next can load it',\n });\n\nexport const usingDefaultsWarning = createGtNextDiagnostic({\n whatHappened: 'The gt-next configuration could not be loaded',\n wayOut: 'Defaults will be used',\n fix: 'Check your config path if this was unexpected',\n});\n\nexport const createNoEntryFoundWarning = (id: string) =>\n createGtNextDiagnostic({\n whatHappened: `No valid dictionary entry was found for id \"${id}\"`,\n wayOut: 'Source content will render as a fallback',\n });\n\nexport const createInvalidDictionaryEntryWarning = (id: string) =>\n createGtNextDiagnostic({\n whatHappened: `Dictionary entry \"${id}\" is invalid`,\n wayOut: 'Source content will render as a fallback until the entry is fixed',\n });\n\nexport const createInvalidDictionaryTranslationEntryWarning = (id: string) =>\n createGtNextDiagnostic({\n whatHappened: `Dictionary translation entry \"${id}\" is invalid`,\n wayOut: 'Source content will render as a fallback until the entry is fixed',\n });\n\nexport const createUnsupportedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales are currently unsupported by our service: ${locales\n .map((locale) => {\n const { name } = getLocaleProperties(locale);\n return `${locale} (${name})`;\n })\n .join(', ')}`;\n\nexport const createMismatchingHashWarning = (\n expectedHash: string,\n receivedHash: string\n) =>\n createGtNextDiagnostic({\n whatHappened: 'Translation hashes do not match',\n reassurance: 'The translation will still render',\n fix: 'Update your translations to the newest version to avoid stale content',\n details: [`expected ${expectedHash}`, `received ${receivedHash}`],\n });\n\nexport const projectIdMissingWarn = createGtNextDiagnostic({\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const noInitGTWarn =\n `gt-next: You are running General Translation without the withGTConfig() plugin. ` +\n `This means that you are not translating your app. To activate translation, add the withGTConfig() plugin to your app, ` +\n `and set the projectId and apiKey in your environment. ` +\n `For more information, visit https://generaltranslation.com/docs/next/tutorials/quickstart`;\n\nexport const APIKeyMissingWarn = createGtNextPluginDiagnostic({\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const createTranslationLoadingWarning = ({\n source,\n translation,\n id,\n}: {\n source: string;\n translation: string;\n id?: string;\n}) =>\n `[DEV ONLY] Warning: gt-next created translation \"${source}\" -> \"${translation}\"` +\n (id ? ` for id \"${id}\"` : '') +\n `. ` +\n `In development, hot-reloaded translations may not be be displayed until the page is refreshed. ` +\n `In production, translations will be preloaded and there won't be a warning.`;\n\nexport const runtimeTranslationTimeoutWarning = createGtNextDiagnostic({\n whatHappened: 'Runtime translation timed out',\n});\n\nexport const dictionaryNotFoundWarning = createGtNextDiagnostic({\n whatHappened: 'No dictionary was found',\n fix: 'Add dictionary.js or [defaultLocale].json to your project, and make sure withGTConfig() is enabled',\n});\n\nexport const standardizedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const standardizedCanonicalLocalesWarning = (locales: string[]) =>\n `gt-next: The following canonical locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const deprecatedLocaleMappingWarning = `gt-next: You are using the deprecated localeMapping configuration. Please move \"customMapping\" to your gt.config.json file.`;\n\nexport const createGTCompilerUnresolvedWarning = (type: 'babel' | 'swc') =>\n `gt-next (plugin): The GT ${type} compiler could not be resolved. Skipping compiler optimizations.`;\n\nexport const createGTCompilerUnavailableWarning = (type: 'babel' | 'swc') =>\n type === 'swc'\n ? `gt-next (plugin): The GT swc compiler is compatible with < next@${SWC_PLUGIN_SUPPORT}. Skipping compiler optimizations.`\n : `gt-next (plugin): The GT babel compiler requires react@${BABEL_PLUGIN_SUPPORT} or newer. Skipping compiler optimizations.`;\n\nexport const babelCompilerTurbopackUnavailableWarning =\n `gt-next (plugin): The GT babel compiler is not compatible with Turbopack. ` +\n `To use compiler optimizations with Turbopack, set experimentalCompilerOptions: { type: 'swc' }.`;\n\nexport const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;\n\nexport const createStringRenderWarning = (\n message: string,\n id: string | undefined,\n error?: unknown\n) =>\n createGtNextDiagnostic({\n whatHappened: `The string ${id ? `for id \"${id}\" ` : ''}could not be rendered`,\n wayOut: 'Source content will render as a fallback',\n fix: `Check the message syntax and variables for: \"${message}\"`,\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;\n"],"mappings":";;;;;;;AAUA,MAAa,0BAA0BA,2BAAAA,uBAAuB;CAC5D,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ;CACT,CAAC;AAEF,MAAa,+BAA+B,SAAiB,OAC3DA,2BAAAA,u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AAAA,uBAAuB,EACrE,cAAc,iCACf,CAAC;AAEF,MAAa,4BAA4BA,2BAAAA,uBAAuB;CAC9D,cAAc;CACd,KAAK;CACN,CAAC;AAEF,MAAa,8BAA8B,YACzC,qDAAqD,QAAQ,KAAK,KAAK,CAAC;AAE1E,MAAa,uCAAuC,YAClD,+DAA+D,QAAQ,KAAK,KAAK,CAAC;AAEpF,MAAa,iCAAiC;AAE9C,MAAa,qCAAqC,SAChD,4BAA4B,KAAK;AAEnC,MAAa,sCAAsC,SACjD,SAAS,QACL,mEAAmEE,yBAAAA,mBAAmB,sCACtF,0DAA0DC,yBAAAA,qBAAqB;AAErF,MAAa,2CACX;AAGF,MAAa,kCAAkC;AAE/C,MAAa,6BACX,SACA,IACA,UAEAH,2BAAAA,uBAAuB;CACrB,cAAc,cAAc,KAAK,WAAW,GAAG,MAAM,GAAG;CACxD,QAAQ;CACR,KAAK,gDAAgD,QAAQ;CAC7D,UAAA,GAAA,4BAAA,8BAAsC,MAAM;CAC7C,CAAC;AAEJ,MAAa,sCAAsC,wGAAwGE,yBAAAA,mBAAmB"}
|
|
1
|
+
{"version":3,"file":"createErrors.js","names":["createGtNextDiagnostic","createGtNextPluginDiagnostic","SWC_PLUGIN_SUPPORT","BABEL_PLUGIN_SUPPORT"],"sources":["../../src/errors/createErrors.ts"],"sourcesContent":["// ---- ERRORS ---- //\n\nimport { getLocaleProperties } from '@generaltranslation/format';\nimport {\n createGtNextDiagnostic,\n createGtNextPluginDiagnostic,\n formatDiagnosticErrorDetails,\n} from './diagnostics';\nimport { BABEL_PLUGIN_SUPPORT, SWC_PLUGIN_SUPPORT } from '../plugin/constants';\n\nexport const remoteTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Remote translations could not be loaded',\n fix: 'Check your project ID, API key, and network connection, then try again',\n wayOut: 'Source content will render as a fallback',\n});\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Locally stored translations could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadTranslations(), make sure it returns translations for the requested locale',\n });\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `The local dictionary could not be loaded${locale ? ` for \"${locale}\"` : ''}`,\n fix: 'If you use loadDictionary(), make sure it returns a dictionary for the requested locale',\n });\n\nexport const createUnresolvedNextVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed Next.js version could not be resolved',\n fix: 'Check that next is installed in this project',\n details: error.message,\n });\n\nexport const createUnresolvedReactVersionError = (error: Error) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'The installed React version could not be resolved',\n fix: 'Check that react is installed in this project',\n details: error.message,\n });\n\nexport const createStringTranslationError = (\n string: string,\n id?: string,\n functionName = 'tx'\n) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName}(\"${string}\")${id ? ` with id \"${id}\"` : ''} could not find a translation`,\n wayOut: 'Source content will render as a fallback',\n fix: 'Push translations again or check your dictionary/runtime translation configuration',\n });\n\nexport const createDictionaryTranslationError = (id: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Dictionary translation entry \"${id}\" could not be found`,\n fix: 'Check that the id exists in your dictionary or push translations again',\n });\n\nexport const createRequiredPrefixError = (id: string, requiredPrefix: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `<GTProvider> is scoped to prefix \"${requiredPrefix}\", but a child uses id \"${id}\"`,\n fix: 'Change the <GTProvider> id prop or move the child under the matching dictionary subtree',\n });\n\nexport const devApiKeyIncludedInProductionError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Production builds cannot use a development API key',\n fix: 'Replace it with a production API key',\n});\n\nexport const createDictionarySubsetError = (id: string, functionName: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `${functionName} with id \"${id}\" could not read a valid dictionary subtree`,\n fix: 'Make sure the id maps to the correct subroute of the dictionary',\n });\n\nexport const dictionaryDisabledError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Dictionaries are not enabled',\n fix: 'Add the withGTConfig() plugin to your Next.js config before using dictionary translations',\n docsUrl: 'https://generaltranslation.com/docs',\n});\n\nexport const unresolvedCustomLoadDictionaryError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadDictionary() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadDictionary() function from the configured file',\n});\n\nexport const unresolvedCustomLoadTranslationsError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened:\n 'loadTranslations() was found during the build but could not be resolved at runtime',\n fix: 'Export a loadTranslations() function from the configured file',\n});\n\nexport const unresolvedLoadDictionaryBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadDictionary() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedLoadTranslationsBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining loadTranslations() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const unresolvedGetLocaleBuildError = (path: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The file defining custom getLocale() could not be resolved at ${path}`,\n fix: 'Check the configured path and try again',\n });\n\nexport const conflictingConfigurationBuildError = (conflicts: string[]) =>\n `gt-next Error: Conflicting configuration${\n conflicts.length > 1 ? 's' : ''\n } detected. Resolve the following conflicts before building your app:\\n${conflicts.join(\n '\\n'\n )}`;\n\nexport const typesFileError = createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'A types-only entry point was executed at runtime',\n fix: 'Import from the appropriate gt-next runtime entry point instead',\n});\n\nexport const gtProviderUseClientError =\n `The Next.js <GTProvider> was imported in a client component. This prevents gt-next from fetching translations on the server. ` +\n `Move <GTProvider> to a file without 'use client'. ` +\n `If you really need to put <GTProvider> on the client, import <GTClientProvider> from 'gt-next/client' instead (discouraged when using the Next.js App Router).`;\n\nexport const txUseClientError =\n `The <Tx> runtime translation component was rendered in a client component, which is not supported. ` +\n `Use <T> with variables, or render <Tx> from a server component.`;\n\nexport const missingVariablesError = (variables: string[], message: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The message \"${message}\" is missing variables: \"${variables.join('\", \"')}\"`,\n fix: 'Provide values for these variables before rendering the translation',\n });\n\nexport const createStringRenderError = (\n message: string,\n id: string | undefined,\n error?: unknown\n) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `The string ${id ? `for id \"${id}\" ` : ''}could not be rendered`,\n fix: `Check the message syntax and variables for: \"${message}\"`,\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const invalidLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid locale codes in your configuration',\n fix: 'Specify a list of valid locales or use \"customMapping\" to define aliases for the invalid locales',\n details: locales,\n });\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: 'Invalid canonical locale codes in your configuration',\n fix: 'Use valid BCP 47 locale codes before starting translation',\n details: locales,\n });\n\nexport const createInvalidRequestLocaleWarning = (\n locale: string,\n defaultLocale: string\n) =>\n createGtNextDiagnostic({\n severity: 'Warning',\n whatHappened: `Locale \"${locale}\" is not valid or is not supported by this app`,\n wayOut: `The default locale \"${defaultLocale}\" will be used for this request`,\n fix: 'Use a valid BCP 47 locale code, add a custom mapping, or configure the locale in gt-next',\n });\n\nexport const createInvalidIcuDictionaryEntryError = (id: string) =>\n createGtNextDiagnostic({\n severity: 'Error',\n whatHappened: `Dictionary entry \"${id}\" contains invalid ICU syntax`,\n fix: 'Fix the ICU message before rendering this translation',\n });\n\n// ---- WARNINGS ---- //\n\nexport const createInvalidIcuDictionaryEntryWarning = (id: string) =>\n createGtNextDiagnostic({\n whatHappened: `Dictionary entry \"${id}\" contains invalid ICU syntax`,\n wayOut: 'Source content will render as a fallback until the entry is fixed',\n });\n\nexport const createBadFilepathWarning = (filename: string, dir: string[]) =>\n createGtNextDiagnostic({\n whatHappened: `${filename} was found in ${dir.join(' or ')}, which is not supported`,\n fix: 'Move it to your project root so gt-next can load it',\n });\n\nexport const usingDefaultsWarning = createGtNextDiagnostic({\n whatHappened: 'The gt-next configuration could not be loaded',\n wayOut: 'Defaults will be used',\n fix: 'Check your config path if this was unexpected',\n});\n\nexport const createNoEntryFoundWarning = (id: string) =>\n createGtNextDiagnostic({\n whatHappened: `No valid dictionary entry was found for id \"${id}\"`,\n wayOut: 'Source content will render as a fallback',\n });\n\nexport const createInvalidDictionaryEntryWarning = (id: string) =>\n createGtNextDiagnostic({\n whatHappened: `Dictionary entry \"${id}\" is invalid`,\n wayOut: 'Source content will render as a fallback until the entry is fixed',\n });\n\nexport const createInvalidDictionaryTranslationEntryWarning = (id: string) =>\n createGtNextDiagnostic({\n whatHappened: `Dictionary translation entry \"${id}\" is invalid`,\n wayOut: 'Source content will render as a fallback until the entry is fixed',\n });\n\nexport const createUnsupportedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales are currently unsupported by our service: ${locales\n .map((locale) => {\n const { name } = getLocaleProperties(locale);\n return `${locale} (${name})`;\n })\n .join(', ')}`;\n\nexport const createMismatchingHashWarning = (\n expectedHash: string,\n receivedHash: string\n) =>\n createGtNextDiagnostic({\n whatHappened: 'Translation hashes do not match',\n reassurance: 'The translation will still render',\n fix: 'Update your translations to the newest version to avoid stale content',\n details: [`expected ${expectedHash}`, `received ${receivedHash}`],\n });\n\nexport const projectIdMissingWarn = createGtNextDiagnostic({\n whatHappened: 'Runtime translation needs a project ID',\n fix: 'Set GT_PROJECT_ID in your environment or pass projectId to withGTConfig()',\n docsUrl: 'https://generaltranslation.com/dashboard',\n});\n\nexport const noInitGTWarn =\n `gt-next: You are running General Translation without the withGTConfig() plugin. ` +\n `This means that you are not translating your app. To activate translation, add the withGTConfig() plugin to your app, ` +\n `and set the projectId and apiKey in your environment. ` +\n `For more information, visit https://generaltranslation.com/docs/next/tutorials/quickstart`;\n\nexport const APIKeyMissingWarn = createGtNextPluginDiagnostic({\n whatHappened: 'Runtime translation needs a development API key',\n fix: 'Find your development API key at generaltranslation.com/dashboard, or set runtimeUrl to an empty string to disable runtime translation',\n});\n\nexport const createTranslationLoadingWarning = ({\n source,\n translation,\n id,\n}: {\n source: string;\n translation: string;\n id?: string;\n}) =>\n `[DEV ONLY] Warning: gt-next created translation \"${source}\" -> \"${translation}\"` +\n (id ? ` for id \"${id}\"` : '') +\n `. ` +\n `In development, hot-reloaded translations may not be be displayed until the page is refreshed. ` +\n `In production, translations will be preloaded and there won't be a warning.`;\n\nexport const runtimeTranslationTimeoutWarning = createGtNextDiagnostic({\n whatHappened: 'Runtime translation timed out',\n});\n\nexport const dictionaryNotFoundWarning = createGtNextDiagnostic({\n whatHappened: 'No dictionary was found',\n fix: 'Add dictionary.js or [defaultLocale].json to your project, and make sure withGTConfig() is enabled',\n});\n\nexport const standardizedLocalesWarning = (locales: string[]) =>\n `gt-next: The following locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const standardizedCanonicalLocalesWarning = (locales: string[]) =>\n `gt-next: The following canonical locales were standardized: ${locales.join(', ')}. Use the standardized codes in your config to avoid this warning.`;\n\nexport const deprecatedLocaleMappingWarning = `gt-next: You are using the deprecated localeMapping configuration. Please move \"customMapping\" to your gt.config.json file.`;\n\nexport const createGTCompilerUnresolvedWarning = (type: 'babel' | 'swc') =>\n `gt-next (plugin): The GT ${type} compiler could not be resolved. Skipping compiler optimizations.`;\n\nexport const createGTCompilerUnavailableWarning = (type: 'babel' | 'swc') =>\n type === 'swc'\n ? `gt-next (plugin): The GT swc compiler is compatible with < next@${SWC_PLUGIN_SUPPORT}. Skipping compiler optimizations.`\n : `gt-next (plugin): The GT babel compiler requires react@${BABEL_PLUGIN_SUPPORT} or newer. Skipping compiler optimizations.`;\n\nexport const babelCompilerTurbopackUnavailableWarning =\n `gt-next (plugin): The GT babel compiler is not compatible with Turbopack. ` +\n `To use compiler optimizations with Turbopack, set experimentalCompilerOptions: { type: 'swc' }.`;\n\nexport const disablingCompileTimeHashWarning = `gt-next (plugin): Compile-time hash is disabled. Compiler optimizations are inactive.`;\n\nexport const createStringRenderWarning = (\n message: string,\n id: string | undefined,\n error?: unknown\n) =>\n createGtNextDiagnostic({\n whatHappened: `The string ${id ? `for id \"${id}\" ` : ''}could not be rendered`,\n wayOut: 'Source content will render as a fallback',\n fix: `Check the message syntax and variables for: \"${message}\"`,\n details: formatDiagnosticErrorDetails(error),\n });\n\nexport const swcPluginCompatibilityChangeWarning = `gt-next (plugin): As of gt-next@6.12.4, SWC plugin support is disabled for Next.js versions prior to ${SWC_PLUGIN_SUPPORT}. Update to the latest version of Next.js.`;\n"],"mappings":";;;;;;;AAUA,MAAa,0BAA0BA,2BAAAA,uBAAuB;CAC5D,UAAU;CACV,cAAc;CACd,KAAK;CACL,QAAQ;CACT,CAAC;AAEF,MAAa,+BAA+B,SAAiB,OAC3DA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,kDAAkD,SAAS,SAAS,OAAO,KAAK;CAC9F,KAAK;CACN,CAAC;AAEJ,MAAa,+BAA+B,SAAiB,OAC3DA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,2CAA2C,SAAS,SAAS,OAAO,KAAK;CACvF,KAAK;CACN,CAAC;AAEJ,MAAa,oCAAoC,UAC/CA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc;CACd,KAAK;CACL,SAAS,MAAM;CAChB,CAAC;AAEJ,MAAa,qCAAqC,UAChDA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc;CACd,KAAK;CACL,SAAS,MAAM;CAChB,CAAC;AAEJ,MAAa,gCACX,QACA,IACA,eAAe,SAEfA,2BAAAA,uBAAuB;CACrB,UAAU;CACV,cAAc,GAAG,aAAa,IAAI,OAA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Aa,2CACX;AAGF,MAAa,kCAAkC;AAE/C,MAAa,6BACX,SACA,IACA,UAEAH,2BAAAA,uBAAuB;CACrB,cAAc,cAAc,KAAK,WAAW,GAAG,MAAM,GAAG;CACxD,QAAQ;CACR,KAAK,gDAAgD,QAAQ;CAC7D,UAAA,GAAA,4BAAA,8BAAsC,MAAM;CAC7C,CAAC;AAEJ,MAAa,sCAAsC,wGAAwGE,yBAAAA,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocale.d.ts","sourceRoot":"","sources":["../../src/request/getLocale.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getLocale.d.ts","sourceRoot":"","sources":["../../src/request/getLocale.ts"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAuBjD;AAED,wBAAgB,SAAS,WAExB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_config_dir_getI18NConfig = require("../config-dir/getI18NConfig.js");
|
|
3
3
|
const require_utils_use = require("../utils/use.js");
|
|
4
|
+
const require_request_localeValidation = require("./localeValidation.js");
|
|
4
5
|
const require_request_utils_legacyGetLocaleFunction = require("./utils/legacyGetLocaleFunction.js");
|
|
5
6
|
const require_request_utils_getRequestFunction = require("./utils/getRequestFunction.js");
|
|
6
7
|
const require_request_localeStore = require("./localeStore.js");
|
|
@@ -24,8 +25,7 @@ async function getLocale() {
|
|
|
24
25
|
if (process.env._GENERALTRANSLATION_ENABLE_SSG === "false") {
|
|
25
26
|
const requestFunction = require_request_utils_getRequestFunction.getRequestFunction("getLocale");
|
|
26
27
|
getLocaleFunction = async () => {
|
|
27
|
-
|
|
28
|
-
return gt.resolveAliasLocale(requestLocale || I18NConfig.getDefaultLocale());
|
|
28
|
+
return require_request_localeValidation.resolveLocaleOrDefault(await requestFunction(), I18NConfig, gt);
|
|
29
29
|
};
|
|
30
30
|
} else getLocaleFunction = require_request_utils_legacyGetLocaleFunction.legacyGetLocaleFunction(I18NConfig, gt);
|
|
31
31
|
return getLocaleFunction();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLocale.js","names":["localeStore","getI18NConfig","getRequestFunction","legacyGetLocaleFunction","use"],"sources":["../../src/request/getLocale.ts"],"sourcesContent":["import { getI18NConfig } from '../config-dir/getI18NConfig';\nimport { use } from '../utils/use';\nimport { legacyGetLocaleFunction } from './utils/legacyGetLocaleFunction';\nimport { getRequestFunction } from './utils/getRequestFunction';\nimport { localeStore } from './localeStore';\n\nlet getLocaleFunction: () => Promise<string>;\n\n/**\n * Gets the user's current locale.\n *\n * @returns {Promise<string>} The user's locale, e.g., 'en-US'.\n *\n * @example\n * const locale = await getLocale();\n * console.log(locale); // 'en-US'\n */\nexport async function getLocale(): Promise<string> {\n // If a locale has been registered for this request, return it\n const registeredLocale = localeStore.getStore();\n if (registeredLocale) return registeredLocale;\n\n // Use the request function to get the locale\n if (getLocaleFunction) return await getLocaleFunction();\n const I18NConfig = getI18NConfig();\n const gt = I18NConfig.getGTClass();\n\n if (process.env._GENERALTRANSLATION_ENABLE_SSG === 'false') {\n const requestFunction = getRequestFunction('getLocale');\n // Support new behavior\n getLocaleFunction = async () => {\n const requestLocale = await requestFunction();\n return
|
|
1
|
+
{"version":3,"file":"getLocale.js","names":["localeStore","getI18NConfig","getRequestFunction","resolveLocaleOrDefault","legacyGetLocaleFunction","use"],"sources":["../../src/request/getLocale.ts"],"sourcesContent":["import { getI18NConfig } from '../config-dir/getI18NConfig';\nimport { use } from '../utils/use';\nimport { legacyGetLocaleFunction } from './utils/legacyGetLocaleFunction';\nimport { getRequestFunction } from './utils/getRequestFunction';\nimport { localeStore } from './localeStore';\nimport { resolveLocaleOrDefault } from './localeValidation';\n\nlet getLocaleFunction: () => Promise<string>;\n\n/**\n * Gets the user's current locale.\n *\n * @returns {Promise<string>} The user's locale, e.g., 'en-US'.\n *\n * @example\n * const locale = await getLocale();\n * console.log(locale); // 'en-US'\n */\nexport async function getLocale(): Promise<string> {\n // If a locale has been registered for this request, return it\n const registeredLocale = localeStore.getStore();\n if (registeredLocale) return registeredLocale;\n\n // Use the request function to get the locale\n if (getLocaleFunction) return await getLocaleFunction();\n const I18NConfig = getI18NConfig();\n const gt = I18NConfig.getGTClass();\n\n if (process.env._GENERALTRANSLATION_ENABLE_SSG === 'false') {\n const requestFunction = getRequestFunction('getLocale');\n // Support new behavior\n getLocaleFunction = async () => {\n const requestLocale = await requestFunction();\n return resolveLocaleOrDefault(requestLocale, I18NConfig, gt);\n };\n } else {\n // Support legacy behavior\n getLocaleFunction = legacyGetLocaleFunction(I18NConfig, gt);\n }\n\n return getLocaleFunction();\n}\n\nexport function useLocale() {\n return use(getLocale());\n}\n"],"mappings":";;;;;;;;AAOA,IAAI;;;;;;;;;;AAWJ,eAAsB,YAA6B;CAEjD,MAAM,mBAAmBA,4BAAAA,YAAY,UAAU;AAC/C,KAAI,iBAAkB,QAAO;AAG7B,KAAI,kBAAmB,QAAO,MAAM,mBAAmB;CACvD,MAAM,aAAaC,iCAAAA,eAAe;CAClC,MAAM,KAAK,WAAW,YAAY;AAElC,KAAI,QAAQ,IAAI,mCAAmC,SAAS;EAC1D,MAAM,kBAAkBC,yCAAAA,mBAAmB,YAAY;AAEvD,sBAAoB,YAAY;AAE9B,UAAOC,iCAAAA,uBAAuB,MADF,iBAAiB,EACA,YAAY,GAAG;;OAI9D,qBAAoBC,8CAAAA,wBAAwB,YAAY,GAAG;AAG7D,QAAO,mBAAmB;;AAG5B,SAAgB,YAAY;AAC1B,QAAOC,kBAAAA,IAAI,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GT } from 'generaltranslation';
|
|
2
|
+
import type { I18NConfiguration } from '../config-dir/I18NConfiguration';
|
|
3
|
+
export declare function resolveLocaleOrDefault(locale: unknown, I18NConfig: I18NConfiguration, gt: GT): string;
|
|
4
|
+
/**
|
|
5
|
+
* Checks whether a locale is valid and supported by the current gt-next config.
|
|
6
|
+
*
|
|
7
|
+
* Use this when route params or other request inputs should be rejected instead
|
|
8
|
+
* of falling back to the default locale.
|
|
9
|
+
*
|
|
10
|
+
* @param locale - The locale candidate to validate.
|
|
11
|
+
* @returns True when the locale resolves to one of the configured locales.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isLocaleSupported(locale: unknown): locale is string;
|
|
14
|
+
//# sourceMappingURL=localeValidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localeValidation.d.ts","sourceRoot":"","sources":["../../src/request/localeValidation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAgBzE,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,iBAAiB,EAC7B,EAAE,EAAE,EAAE,GACL,MAAM,CAWR;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAKnE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_errors_createErrors = require("../errors/createErrors.js");
|
|
3
|
+
const require_config_dir_getI18NConfig = require("../config-dir/getI18NConfig.js");
|
|
4
|
+
//#region src/request/localeValidation.ts
|
|
5
|
+
function determineSupportedLocale(locale, I18NConfig, gt) {
|
|
6
|
+
if (typeof locale !== "string" || locale.length === 0) return void 0;
|
|
7
|
+
return gt.determineLocale([locale], I18NConfig.getLocales());
|
|
8
|
+
}
|
|
9
|
+
function warnInvalidLocale(locale, defaultLocale) {
|
|
10
|
+
console.warn(require_errors_createErrors.createInvalidRequestLocaleWarning(locale, defaultLocale));
|
|
11
|
+
}
|
|
12
|
+
function resolveLocaleOrDefault(locale, I18NConfig, gt) {
|
|
13
|
+
const defaultLocale = I18NConfig.getDefaultLocale();
|
|
14
|
+
const supportedLocale = determineSupportedLocale(locale, I18NConfig, gt);
|
|
15
|
+
if (supportedLocale) return gt.resolveAliasLocale(supportedLocale);
|
|
16
|
+
if (typeof locale === "string" && locale.length > 0) warnInvalidLocale(locale, defaultLocale);
|
|
17
|
+
return gt.resolveAliasLocale(defaultLocale);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Checks whether a locale is valid and supported by the current gt-next config.
|
|
21
|
+
*
|
|
22
|
+
* Use this when route params or other request inputs should be rejected instead
|
|
23
|
+
* of falling back to the default locale.
|
|
24
|
+
*
|
|
25
|
+
* @param locale - The locale candidate to validate.
|
|
26
|
+
* @returns True when the locale resolves to one of the configured locales.
|
|
27
|
+
*/
|
|
28
|
+
function isLocaleSupported(locale) {
|
|
29
|
+
const I18NConfig = require_config_dir_getI18NConfig.getI18NConfig();
|
|
30
|
+
return determineSupportedLocale(locale, I18NConfig, I18NConfig.getGTClass()) !== void 0;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.isLocaleSupported = isLocaleSupported;
|
|
34
|
+
exports.resolveLocaleOrDefault = resolveLocaleOrDefault;
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=localeValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localeValidation.js","names":["createInvalidRequestLocaleWarning","getI18NConfig"],"sources":["../../src/request/localeValidation.ts"],"sourcesContent":["import type { GT } from 'generaltranslation';\nimport { getI18NConfig } from '../config-dir/getI18NConfig';\nimport type { I18NConfiguration } from '../config-dir/I18NConfiguration';\nimport { createInvalidRequestLocaleWarning } from '../errors/createErrors';\n\nfunction determineSupportedLocale(\n locale: unknown,\n I18NConfig: I18NConfiguration,\n gt: GT\n): string | undefined {\n if (typeof locale !== 'string' || locale.length === 0) return undefined;\n return gt.determineLocale([locale], I18NConfig.getLocales());\n}\n\nfunction warnInvalidLocale(locale: string, defaultLocale: string) {\n console.warn(createInvalidRequestLocaleWarning(locale, defaultLocale));\n}\n\nexport function resolveLocaleOrDefault(\n locale: unknown,\n I18NConfig: I18NConfiguration,\n gt: GT\n): string {\n const defaultLocale = I18NConfig.getDefaultLocale();\n const supportedLocale = determineSupportedLocale(locale, I18NConfig, gt);\n\n if (supportedLocale) return gt.resolveAliasLocale(supportedLocale);\n\n if (typeof locale === 'string' && locale.length > 0) {\n warnInvalidLocale(locale, defaultLocale);\n }\n\n return gt.resolveAliasLocale(defaultLocale);\n}\n\n/**\n * Checks whether a locale is valid and supported by the current gt-next config.\n *\n * Use this when route params or other request inputs should be rejected instead\n * of falling back to the default locale.\n *\n * @param locale - The locale candidate to validate.\n * @returns True when the locale resolves to one of the configured locales.\n */\nexport function isLocaleSupported(locale: unknown): locale is string {\n const I18NConfig = getI18NConfig();\n const gt = I18NConfig.getGTClass();\n\n return determineSupportedLocale(locale, I18NConfig, gt) !== undefined;\n}\n"],"mappings":";;;;AAKA,SAAS,yBACP,QACA,YACA,IACoB;AACpB,KAAI,OAAO,WAAW,YAAY,OAAO,WAAW,EAAG,QAAO,KAAA;AAC9D,QAAO,GAAG,gBAAgB,CAAC,OAAO,EAAE,WAAW,YAAY,CAAC;;AAG9D,SAAS,kBAAkB,QAAgB,eAAuB;AAChE,SAAQ,KAAKA,4BAAAA,kCAAkC,QAAQ,cAAc,CAAC;;AAGxE,SAAgB,uBACd,QACA,YACA,IACQ;CACR,MAAM,gBAAgB,WAAW,kBAAkB;CACnD,MAAM,kBAAkB,yBAAyB,QAAQ,YAAY,GAAG;AAExE,KAAI,gBAAiB,QAAO,GAAG,mBAAmB,gBAAgB;AAElE,KAAI,OAAO,WAAW,YAAY,OAAO,SAAS,EAChD,mBAAkB,QAAQ,cAAc;AAG1C,QAAO,GAAG,mBAAmB,cAAc;;;;;;;;;;;AAY7C,SAAgB,kBAAkB,QAAmC;CACnE,MAAM,aAAaC,iCAAAA,eAAe;AAGlC,QAAO,yBAAyB,QAAQ,YAF7B,WAAW,YAEgC,CAAC,KAAK,KAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Use this in Route Handlers and OG image handlers where next/root-params is unavailable.
|
|
4
4
|
* Must be called at the top of the request handler before any other gt-next functions.
|
|
5
5
|
*
|
|
6
|
-
* @param locale - A
|
|
6
|
+
* @param locale - A locale candidate to use for this request.
|
|
7
7
|
*/
|
|
8
8
|
export declare function registerLocale(locale: string): void;
|
|
9
9
|
//# sourceMappingURL=registerLocale.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerLocale.d.ts","sourceRoot":"","sources":["../../src/request/registerLocale.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registerLocale.d.ts","sourceRoot":"","sources":["../../src/request/registerLocale.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAInD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_config_dir_getI18NConfig = require("../config-dir/getI18NConfig.js");
|
|
3
|
+
const require_request_localeValidation = require("./localeValidation.js");
|
|
3
4
|
const require_request_localeStore = require("./localeStore.js");
|
|
4
5
|
//#region src/request/registerLocale.ts
|
|
5
6
|
/**
|
|
@@ -7,11 +8,12 @@ const require_request_localeStore = require("./localeStore.js");
|
|
|
7
8
|
* Use this in Route Handlers and OG image handlers where next/root-params is unavailable.
|
|
8
9
|
* Must be called at the top of the request handler before any other gt-next functions.
|
|
9
10
|
*
|
|
10
|
-
* @param locale - A
|
|
11
|
+
* @param locale - A locale candidate to use for this request.
|
|
11
12
|
*/
|
|
12
13
|
function registerLocale(locale) {
|
|
13
|
-
const
|
|
14
|
-
|
|
14
|
+
const I18NConfig = require_config_dir_getI18NConfig.getI18NConfig();
|
|
15
|
+
const gt = I18NConfig.getGTClass();
|
|
16
|
+
require_request_localeStore.localeStore.enterWith(require_request_localeValidation.resolveLocaleOrDefault(locale, I18NConfig, gt));
|
|
15
17
|
}
|
|
16
18
|
//#endregion
|
|
17
19
|
exports.registerLocale = registerLocale;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerLocale.js","names":["getI18NConfig"],"sources":["../../src/request/registerLocale.ts"],"sourcesContent":["import { getI18NConfig } from '../config-dir/getI18NConfig';\nimport { localeStore } from './localeStore';\n\n/**\n * Set the locale for the current request context.\n * Use this in Route Handlers and OG image handlers where next/root-params is unavailable.\n * Must be called at the top of the request handler before any other gt-next functions.\n *\n * @param locale - A
|
|
1
|
+
{"version":3,"file":"registerLocale.js","names":["getI18NConfig","resolveLocaleOrDefault"],"sources":["../../src/request/registerLocale.ts"],"sourcesContent":["import { getI18NConfig } from '../config-dir/getI18NConfig';\nimport { localeStore } from './localeStore';\nimport { resolveLocaleOrDefault } from './localeValidation';\n\n/**\n * Set the locale for the current request context.\n * Use this in Route Handlers and OG image handlers where next/root-params is unavailable.\n * Must be called at the top of the request handler before any other gt-next functions.\n *\n * @param locale - A locale candidate to use for this request.\n */\nexport function registerLocale(locale: string): void {\n const I18NConfig = getI18NConfig();\n const gt = I18NConfig.getGTClass();\n localeStore.enterWith(resolveLocaleOrDefault(locale, I18NConfig, gt));\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,eAAe,QAAsB;CACnD,MAAM,aAAaA,iCAAAA,eAAe;CAClC,MAAM,KAAK,WAAW,YAAY;AAClC,6BAAA,YAAY,UAAUC,iCAAAA,uBAAuB,QAAQ,YAAY,GAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyGetLocaleFunction.d.ts","sourceRoot":"","sources":["../../../src/request/utils/legacyGetLocaleFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAIxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"legacyGetLocaleFunction.d.ts","sourceRoot":"","sources":["../../../src/request/utils/legacyGetLocaleFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAIxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAMvE;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,iBAAiB,EAC7B,EAAE,EAAE,EAAE,GACL,MAAM,OAAO,CAAC,MAAM,CAAC,CAavB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_request_utils_legacyGetRequestFunction = require("./legacyGetRequestFunction.js");
|
|
3
3
|
const require_request_utils_isSSR = require("./isSSR.js");
|
|
4
|
+
const require_request_localeValidation = require("../localeValidation.js");
|
|
4
5
|
//#region src/request/utils/legacyGetLocaleFunction.ts
|
|
5
6
|
let getLocaleFunction;
|
|
6
7
|
let getStaticLocaleFunction;
|
|
@@ -11,8 +12,7 @@ function legacyGetLocaleFunction(I18NConfig, gt) {
|
|
|
11
12
|
getLocaleFunction = require_request_utils_legacyGetRequestFunction.legacyGetRequestFunction("getLocale", true);
|
|
12
13
|
getStaticLocaleFunction = require_request_utils_legacyGetRequestFunction.legacyGetRequestFunction("getLocale", false);
|
|
13
14
|
return async () => {
|
|
14
|
-
|
|
15
|
-
return gt.resolveAliasLocale(locale || I18NConfig.getDefaultLocale());
|
|
15
|
+
return require_request_localeValidation.resolveLocaleOrDefault(require_request_utils_isSSR.isSSR() ? await getLocaleFunction() : await getStaticLocaleFunction(), I18NConfig, gt);
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyGetLocaleFunction.js","names":["legacyGetRequestFunction","isSSR"],"sources":["../../../src/request/utils/legacyGetLocaleFunction.ts"],"sourcesContent":["import { GT } from 'generaltranslation';\nimport { RequestFunctionReturnType } from '../types';\nimport { legacyGetRequestFunction } from './legacyGetRequestFunction';\nimport { isSSR } from './isSSR';\nimport { I18NConfiguration } from '../../config-dir/I18NConfiguration';\n\nlet getLocaleFunction: () => Promise<RequestFunctionReturnType>;\nlet getStaticLocaleFunction: () => Promise<RequestFunctionReturnType>;\n\n/**\n * @deprecated\n */\nexport function legacyGetLocaleFunction(\n I18NConfig: I18NConfiguration,\n gt: GT\n): () => Promise<string> {\n // Construct getLocale function\n getLocaleFunction = legacyGetRequestFunction('getLocale', true);\n getStaticLocaleFunction = legacyGetRequestFunction('getLocale', false);\n\n // Construct locale function\n return async () => {\n // Always fallback to default locale\n const locale = isSSR()\n ? await getLocaleFunction()\n : await getStaticLocaleFunction();\n return
|
|
1
|
+
{"version":3,"file":"legacyGetLocaleFunction.js","names":["legacyGetRequestFunction","resolveLocaleOrDefault","isSSR"],"sources":["../../../src/request/utils/legacyGetLocaleFunction.ts"],"sourcesContent":["import { GT } from 'generaltranslation';\nimport { RequestFunctionReturnType } from '../types';\nimport { legacyGetRequestFunction } from './legacyGetRequestFunction';\nimport { isSSR } from './isSSR';\nimport { I18NConfiguration } from '../../config-dir/I18NConfiguration';\nimport { resolveLocaleOrDefault } from '../localeValidation';\n\nlet getLocaleFunction: () => Promise<RequestFunctionReturnType>;\nlet getStaticLocaleFunction: () => Promise<RequestFunctionReturnType>;\n\n/**\n * @deprecated\n */\nexport function legacyGetLocaleFunction(\n I18NConfig: I18NConfiguration,\n gt: GT\n): () => Promise<string> {\n // Construct getLocale function\n getLocaleFunction = legacyGetRequestFunction('getLocale', true);\n getStaticLocaleFunction = legacyGetRequestFunction('getLocale', false);\n\n // Construct locale function\n return async () => {\n // Always fallback to default locale\n const locale = isSSR()\n ? await getLocaleFunction()\n : await getStaticLocaleFunction();\n return resolveLocaleOrDefault(locale, I18NConfig, gt);\n };\n}\n"],"mappings":";;;;;AAOA,IAAI;AACJ,IAAI;;;;AAKJ,SAAgB,wBACd,YACA,IACuB;AAEvB,qBAAoBA,+CAAAA,yBAAyB,aAAa,KAAK;AAC/D,2BAA0BA,+CAAAA,yBAAyB,aAAa,MAAM;AAGtE,QAAO,YAAY;AAKjB,SAAOC,iCAAAA,uBAHQC,4BAAAA,OAAO,GAClB,MAAM,mBAAmB,GACzB,MAAM,yBAAyB,EACG,YAAY,GAAG"}
|
package/dist/server.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { tx } from './server-dir/runtime/tx';
|
|
|
4
4
|
import { getLocale } from './request/getLocale';
|
|
5
5
|
import { registerLocale } from './request/registerLocale';
|
|
6
6
|
import { getRegion } from './request/getRegion';
|
|
7
|
+
import { isLocaleSupported } from './request/localeValidation';
|
|
7
8
|
import { getTranslations } from './server-dir/buildtime/getTranslations';
|
|
8
9
|
import { GTProvider } from './provider/GTProvider';
|
|
9
10
|
import { Tx } from './server-dir/runtime/_Tx';
|
|
@@ -16,5 +17,5 @@ export declare function getLocaleProperties(locale: string): LocaleProperties;
|
|
|
16
17
|
export declare function getLocales(): string[];
|
|
17
18
|
export declare function getVersionId(): string | undefined;
|
|
18
19
|
export { msg, decodeMsg, decodeOptions, declareStatic, derive, declareVar, decodeVars, } from 'gt-i18n';
|
|
19
|
-
export { GTProvider, T, getGT, getTranslations, getMessages, tx, Tx, getLocale, registerLocale, getRegion, getLocaleDirection, };
|
|
20
|
+
export { GTProvider, T, getGT, getTranslations, getMessages, tx, Tx, getLocale, isLocaleSupported, registerLocale, getRegion, getLocaleDirection, };
|
|
20
21
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,CAAC,EAAE,MAAM,0B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Aa,EACb,MAAM,EACN,UAAU,EACV,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,UAAU,EACV,CAAC,EACD,KAAK,EACL,eAAe,EACf,WAAW,EACX,EAAE,EACF,EAAE,EACF,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,kBAAkB,GACnB,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./_virtual/_rolldown/runtime.js");
|
|
3
3
|
const require_config_dir_getI18NConfig = require("./config-dir/getI18NConfig.js");
|
|
4
|
+
const require_request_localeValidation = require("./request/localeValidation.js");
|
|
4
5
|
const require_request_getLocale = require("./request/getLocale.js");
|
|
5
6
|
const require_server_dir_buildtime_T = require("./server-dir/buildtime/T.js");
|
|
6
7
|
const require_request_getRegion = require("./request/getRegion.js");
|
|
@@ -80,6 +81,7 @@ exports.getMessages = require_server_dir_buildtime_getTranslationFunction.getMes
|
|
|
80
81
|
exports.getRegion = require_request_getRegion.getRegion;
|
|
81
82
|
exports.getTranslations = require_server_dir_buildtime_getTranslations.getTranslations;
|
|
82
83
|
exports.getVersionId = getVersionId;
|
|
84
|
+
exports.isLocaleSupported = require_request_localeValidation.isLocaleSupported;
|
|
83
85
|
Object.defineProperty(exports, "msg", {
|
|
84
86
|
enumerable: true,
|
|
85
87
|
get: function() {
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":["getI18NConfig"],"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\n\nimport { T } from './server-dir/buildtime/T';\nimport { tx } from './server-dir/runtime/tx';\nimport { getLocale } from './request/getLocale';\nimport { registerLocale } from './request/registerLocale';\nimport { getRegion } from './request/getRegion';\nimport { getI18NConfig } from './config-dir/getI18NConfig';\nimport { getTranslations } from './server-dir/buildtime/getTranslations';\nimport { GTProvider } from './provider/GTProvider';\nimport { Tx } from './server-dir/runtime/_Tx';\nimport type { LocaleProperties } from '@generaltranslation/format/types';\nimport { getLocaleDirection } from './request/getLocaleDirection';\nimport {\n getMessages,\n getGT,\n} from './server-dir/buildtime/getTranslationFunction';\n\nexport function getDefaultLocale(): string {\n return getI18NConfig().getDefaultLocale();\n}\n\nexport function getGTClass() {\n return getI18NConfig().getGTClass();\n}\n\nexport function getLocaleProperties(locale: string): LocaleProperties {\n return getGTClass().getLocaleProperties(locale);\n}\n\nexport function getLocales(): string[] {\n return getI18NConfig().getLocales();\n}\n\nexport function getVersionId(): string | undefined {\n return getI18NConfig().getVersionId();\n}\n\nexport {\n msg,\n decodeMsg,\n decodeOptions,\n declareStatic,\n derive,\n declareVar,\n decodeVars,\n} from 'gt-i18n';\n\nexport {\n GTProvider,\n T,\n getGT,\n getTranslations,\n getMessages,\n tx,\n Tx,\n getLocale,\n registerLocale,\n getRegion,\n getLocaleDirection,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.js","names":["getI18NConfig"],"sources":["../src/server.ts"],"sourcesContent":["import 'server-only';\n\nimport { T } from './server-dir/buildtime/T';\nimport { tx } from './server-dir/runtime/tx';\nimport { getLocale } from './request/getLocale';\nimport { registerLocale } from './request/registerLocale';\nimport { getRegion } from './request/getRegion';\nimport { isLocaleSupported } from './request/localeValidation';\nimport { getI18NConfig } from './config-dir/getI18NConfig';\nimport { getTranslations } from './server-dir/buildtime/getTranslations';\nimport { GTProvider } from './provider/GTProvider';\nimport { Tx } from './server-dir/runtime/_Tx';\nimport type { LocaleProperties } from '@generaltranslation/format/types';\nimport { getLocaleDirection } from './request/getLocaleDirection';\nimport {\n getMessages,\n getGT,\n} from './server-dir/buildtime/getTranslationFunction';\n\nexport function getDefaultLocale(): string {\n return getI18NConfig().getDefaultLocale();\n}\n\nexport function getGTClass() {\n return getI18NConfig().getGTClass();\n}\n\nexport function getLocaleProperties(locale: string): LocaleProperties {\n return getGTClass().getLocaleProperties(locale);\n}\n\nexport function getLocales(): string[] {\n return getI18NConfig().getLocales();\n}\n\nexport function getVersionId(): string | undefined {\n return getI18NConfig().getVersionId();\n}\n\nexport {\n msg,\n decodeMsg,\n decodeOptions,\n declareStatic,\n derive,\n declareVar,\n decodeVars,\n} from 'gt-i18n';\n\nexport {\n GTProvider,\n T,\n getGT,\n getTranslations,\n getMessages,\n tx,\n Tx,\n getLocale,\n isLocaleSupported,\n registerLocale,\n getRegion,\n getLocaleDirection,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,SAAgB,mBAA2B;AACzC,QAAOA,iCAAAA,eAAe,CAAC,kBAAkB;;AAG3C,SAAgB,aAAa;AAC3B,QAAOA,iCAAAA,eAAe,CAAC,YAAY;;AAGrC,SAAgB,oBAAoB,QAAkC;AACpE,QAAO,YAAY,CAAC,oBAAoB,OAAO;;AAGjD,SAAgB,aAAuB;AACrC,QAAOA,iCAAAA,eAAe,CAAC,YAAY;;AAGrC,SAAgB,eAAmC;AACjD,QAAOA,iCAAAA,eAAe,CAAC,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-next",
|
|
3
|
-
"version": "6.16.
|
|
3
|
+
"version": "6.16.36",
|
|
4
4
|
"description": "A Next.js library for automatic internationalization.",
|
|
5
5
|
"main": "dist/index.server.js",
|
|
6
6
|
"peerDependencies": {
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@generaltranslation/compiler": "1.3.26",
|
|
21
21
|
"@generaltranslation/format": "0.1.1",
|
|
22
|
-
"@generaltranslation/next-internal": "0.1.2",
|
|
23
22
|
"@generaltranslation/supported-locales": "2.1.4",
|
|
23
|
+
"@generaltranslation/next-internal": "0.1.2",
|
|
24
24
|
"generaltranslation": "8.2.18",
|
|
25
|
-
"gt-
|
|
26
|
-
"gt-
|
|
25
|
+
"gt-i18n": "0.9.8",
|
|
26
|
+
"gt-react": "10.20.4"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|