@generaltranslation/react-core 1.8.16 → 1.8.18
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 +23 -0
- package/dist/errors.cjs.min.cjs +2 -2
- package/dist/errors.cjs.min.cjs.map +1 -1
- package/dist/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.esm.min.mjs +2 -2
- package/dist/errors.esm.min.mjs.map +1 -1
- package/dist/index.cjs.min.cjs +2 -2
- package/dist/index.cjs.min.cjs.map +1 -1
- package/dist/index.d.ts +1384 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.min.mjs +2 -2
- package/dist/index.esm.min.mjs.map +1 -1
- package/dist/internal.cjs.min.cjs +2 -2
- package/dist/internal.cjs.min.cjs.map +1 -1
- package/dist/internal.d.ts +764 -31
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.esm.min.mjs +2 -2
- package/dist/internal.esm.min.mjs.map +1 -1
- package/dist/types.d.ts +357 -174
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -20
- package/dist/branches/Branch.d.ts +0 -34
- package/dist/branches/Branch.d.ts.map +0 -1
- package/dist/branches/plurals/Plural.d.ts +0 -38
- package/dist/branches/plurals/Plural.d.ts.map +0 -1
- package/dist/branches/plurals/getPluralBranch.d.ts +0 -9
- package/dist/branches/plurals/getPluralBranch.d.ts.map +0 -1
- package/dist/dictionaries/collectUntranslatedEntries.d.ts +0 -18
- package/dist/dictionaries/collectUntranslatedEntries.d.ts.map +0 -1
- package/dist/dictionaries/getDictionaryEntry.d.ts +0 -4
- package/dist/dictionaries/getDictionaryEntry.d.ts.map +0 -1
- package/dist/dictionaries/getEntryAndMetadata.d.ts +0 -6
- package/dist/dictionaries/getEntryAndMetadata.d.ts.map +0 -1
- package/dist/dictionaries/getSubtree.d.ts +0 -18
- package/dist/dictionaries/getSubtree.d.ts.map +0 -1
- package/dist/dictionaries/indexDict.d.ts +0 -15
- package/dist/dictionaries/indexDict.d.ts.map +0 -1
- package/dist/dictionaries/injectAndMerge.d.ts +0 -9
- package/dist/dictionaries/injectAndMerge.d.ts.map +0 -1
- package/dist/dictionaries/injectEntry.d.ts +0 -18
- package/dist/dictionaries/injectEntry.d.ts.map +0 -1
- package/dist/dictionaries/injectFallbacks.d.ts +0 -18
- package/dist/dictionaries/injectFallbacks.d.ts.map +0 -1
- package/dist/dictionaries/injectHashes.d.ts +0 -11
- package/dist/dictionaries/injectHashes.d.ts.map +0 -1
- package/dist/dictionaries/injectTranslations.d.ts +0 -21
- package/dist/dictionaries/injectTranslations.d.ts.map +0 -1
- package/dist/dictionaries/isDictionaryEntry.d.ts +0 -8
- package/dist/dictionaries/isDictionaryEntry.d.ts.map +0 -1
- package/dist/dictionaries/loadDictionaryHelper.d.ts +0 -3
- package/dist/dictionaries/loadDictionaryHelper.d.ts.map +0 -1
- package/dist/dictionaries/mergeDictionaries.d.ts +0 -3
- package/dist/dictionaries/mergeDictionaries.d.ts.map +0 -1
- package/dist/dictionaries/stripMetadataFromEntries.d.ts +0 -6
- package/dist/dictionaries/stripMetadataFromEntries.d.ts.map +0 -1
- package/dist/errors-dir/constants.d.ts +0 -2
- package/dist/errors-dir/constants.d.ts.map +0 -1
- package/dist/errors-dir/createErrors.d.ts +0 -36
- package/dist/errors-dir/createErrors.d.ts.map +0 -1
- package/dist/errors-dir/internalErrors.d.ts +0 -8
- package/dist/errors-dir/internalErrors.d.ts.map +0 -1
- package/dist/hooks/useDefaultLocale.d.ts +0 -13
- package/dist/hooks/useDefaultLocale.d.ts.map +0 -1
- package/dist/hooks/useGTClass.d.ts +0 -23
- package/dist/hooks/useGTClass.d.ts.map +0 -1
- package/dist/hooks/useLocale.d.ts +0 -11
- package/dist/hooks/useLocale.d.ts.map +0 -1
- package/dist/hooks/useLocaleDirection.d.ts +0 -14
- package/dist/hooks/useLocaleDirection.d.ts.map +0 -1
- package/dist/hooks/useLocaleSelector.d.ts +0 -19
- package/dist/hooks/useLocaleSelector.d.ts.map +0 -1
- package/dist/hooks/useLocales.d.ts +0 -11
- package/dist/hooks/useLocales.d.ts.map +0 -1
- package/dist/hooks/useRegion.d.ts +0 -20
- package/dist/hooks/useRegion.d.ts.map +0 -1
- package/dist/hooks/useRegionSelector.d.ts +0 -82
- package/dist/hooks/useRegionSelector.d.ts.map +0 -1
- package/dist/hooks/useSetLocale.d.ts +0 -12
- package/dist/hooks/useSetLocale.d.ts.map +0 -1
- package/dist/hooks/useVersionId.d.ts +0 -11
- package/dist/hooks/useVersionId.d.ts.map +0 -1
- package/dist/internal/addGTIdentifier.d.ts +0 -4
- package/dist/internal/addGTIdentifier.d.ts.map +0 -1
- package/dist/internal/flattenDictionary.d.ts +0 -11
- package/dist/internal/flattenDictionary.d.ts.map +0 -1
- package/dist/internal/removeInjectedT.d.ts +0 -11
- package/dist/internal/removeInjectedT.d.ts.map +0 -1
- package/dist/internal/writeChildrenAsObjects.d.ts +0 -10
- package/dist/internal/writeChildrenAsObjects.d.ts.map +0 -1
- package/dist/messages/messages.d.ts +0 -2
- package/dist/messages/messages.d.ts.map +0 -1
- package/dist/promises/dangerouslyUsable.d.ts +0 -37
- package/dist/promises/dangerouslyUsable.d.ts.map +0 -1
- package/dist/promises/reactHasUse.d.ts +0 -2
- package/dist/promises/reactHasUse.d.ts.map +0 -1
- package/dist/provider/GTContext.d.ts +0 -4
- package/dist/provider/GTContext.d.ts.map +0 -1
- package/dist/provider/GTProvider.d.ts +0 -3
- package/dist/provider/GTProvider.d.ts.map +0 -1
- package/dist/provider/config/defaultProps.d.ts +0 -4
- package/dist/provider/config/defaultProps.d.ts.map +0 -1
- package/dist/provider/helpers/isSSREnabled.d.ts +0 -5
- package/dist/provider/helpers/isSSREnabled.d.ts.map +0 -1
- package/dist/provider/helpers/validateString.d.ts +0 -6
- package/dist/provider/helpers/validateString.d.ts.map +0 -1
- package/dist/provider/hooks/locales/types.d.ts +0 -13
- package/dist/provider/hooks/locales/types.d.ts.map +0 -1
- package/dist/provider/hooks/locales/useDetermineLocale.d.ts +0 -6
- package/dist/provider/hooks/locales/useDetermineLocale.d.ts.map +0 -1
- package/dist/provider/hooks/locales/useLocaleState.d.ts +0 -20
- package/dist/provider/hooks/locales/useLocaleState.d.ts.map +0 -1
- package/dist/provider/hooks/translation/useCreateInternalUseGTFunction.d.ts +0 -19
- package/dist/provider/hooks/translation/useCreateInternalUseGTFunction.d.ts.map +0 -1
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsFunction.d.ts +0 -5
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsFunction.d.ts.map +0 -1
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.d.ts +0 -4
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.d.ts.map +0 -1
- package/dist/provider/hooks/types.d.ts +0 -19
- package/dist/provider/hooks/types.d.ts.map +0 -1
- package/dist/provider/hooks/useEnableI18n.d.ts +0 -3
- package/dist/provider/hooks/useEnableI18n.d.ts.map +0 -1
- package/dist/provider/hooks/useErrorChecks.d.ts +0 -10
- package/dist/provider/hooks/useErrorChecks.d.ts.map +0 -1
- package/dist/provider/hooks/useLoadDictionary.d.ts +0 -15
- package/dist/provider/hooks/useLoadDictionary.d.ts.map +0 -1
- package/dist/provider/hooks/useLoadTranslations.d.ts +0 -17
- package/dist/provider/hooks/useLoadTranslations.d.ts.map +0 -1
- package/dist/provider/hooks/useRegionState.d.ts +0 -6
- package/dist/provider/hooks/useRegionState.d.ts.map +0 -1
- package/dist/provider/hooks/useRuntimeTranslation.d.ts +0 -24
- package/dist/provider/hooks/useRuntimeTranslation.d.ts.map +0 -1
- package/dist/rendering/getDefaultRenderSettings.d.ts +0 -6
- package/dist/rendering/getDefaultRenderSettings.d.ts.map +0 -1
- package/dist/rendering/getGTTag.d.ts +0 -3
- package/dist/rendering/getGTTag.d.ts.map +0 -1
- package/dist/rendering/isVariableObject.d.ts +0 -3
- package/dist/rendering/isVariableObject.d.ts.map +0 -1
- package/dist/rendering/renderDefaultChildren.d.ts +0 -8
- package/dist/rendering/renderDefaultChildren.d.ts.map +0 -1
- package/dist/rendering/renderSkeleton.d.ts +0 -8
- package/dist/rendering/renderSkeleton.d.ts.map +0 -1
- package/dist/rendering/renderTranslatedChildren.d.ts +0 -9
- package/dist/rendering/renderTranslatedChildren.d.ts.map +0 -1
- package/dist/rendering/renderVariable.d.ts +0 -4
- package/dist/rendering/renderVariable.d.ts.map +0 -1
- package/dist/translation/T.d.ts +0 -42
- package/dist/translation/T.d.ts.map +0 -1
- package/dist/translation/hooks/useGT.d.ts +0 -21
- package/dist/translation/hooks/useGT.d.ts.map +0 -1
- package/dist/translation/hooks/useMessages.d.ts +0 -19
- package/dist/translation/hooks/useMessages.d.ts.map +0 -1
- package/dist/translation/hooks/useTranslations.d.ts +0 -17
- package/dist/translation/hooks/useTranslations.d.ts.map +0 -1
- package/dist/types-dir/config.d.ts +0 -69
- package/dist/types-dir/config.d.ts.map +0 -1
- package/dist/types-dir/context.d.ts +0 -31
- package/dist/types-dir/context.d.ts.map +0 -1
- package/dist/types-dir/runtime.d.ts +0 -22
- package/dist/types-dir/runtime.d.ts.map +0 -1
- package/dist/types-dir/types.d.ts +0 -90
- package/dist/types-dir/types.d.ts.map +0 -1
- package/dist/ui/LocaleSelector.d.ts +0 -7
- package/dist/ui/LocaleSelector.d.ts.map +0 -1
- package/dist/ui/RegionSelector.d.ts +0 -7
- package/dist/ui/RegionSelector.d.ts.map +0 -1
- package/dist/ui/types.d.ts +0 -18
- package/dist/ui/types.d.ts.map +0 -1
- package/dist/utils/cookies.d.ts +0 -14
- package/dist/utils/cookies.d.ts.map +0 -1
- package/dist/utils/fetchTranslations.d.ts +0 -9
- package/dist/utils/fetchTranslations.d.ts.map +0 -1
- package/dist/utils/types.d.ts +0 -9
- package/dist/utils/types.d.ts.map +0 -1
- package/dist/utils/use.d.ts +0 -4
- package/dist/utils/use.d.ts.map +0 -1
- package/dist/utils/utils.d.ts +0 -8
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/variables/Currency.d.ts +0 -30
- package/dist/variables/Currency.d.ts.map +0 -1
- package/dist/variables/DateTime.d.ts +0 -29
- package/dist/variables/DateTime.d.ts.map +0 -1
- package/dist/variables/Derive.d.ts +0 -76
- package/dist/variables/Derive.d.ts.map +0 -1
- package/dist/variables/Num.d.ts +0 -31
- package/dist/variables/Num.d.ts.map +0 -1
- package/dist/variables/RelativeTime.d.ts +0 -45
- package/dist/variables/RelativeTime.d.ts.map +0 -1
- package/dist/variables/Var.d.ts +0 -32
- package/dist/variables/Var.d.ts.map +0 -1
- package/dist/variables/_getVariableProps.d.ts +0 -11
- package/dist/variables/_getVariableProps.d.ts.map +0 -1
- package/dist/variables/getVariableName.d.ts +0 -11
- package/dist/variables/getVariableName.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @generaltranslation/react-core
|
|
2
2
|
|
|
3
|
+
## 1.8.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1408](https://github.com/generaltranslation/gt/pull/1408) [`425d3e4`](https://github.com/generaltranslation/gt/commit/425d3e4e6c61afd108c65c27f7693ba2470b33c6) Thanks [@bgub](https://github.com/bgub)! - Use @generaltranslation/format directly for shared formatting and locale helpers.
|
|
8
|
+
|
|
9
|
+
- [#1415](https://github.com/generaltranslation/gt/pull/1415) [`6e6c69e`](https://github.com/generaltranslation/gt/commit/6e6c69e3ca2f51937407674cf101b69e968952a1) Thanks [@bgub](https://github.com/bgub)! - Switch the React Core package build pipeline to tsdown while preserving the existing public entrypoints.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`73f3ac1`](https://github.com/generaltranslation/gt/commit/73f3ac1308df11c1e6230c13c1999bfc5f6afc99), [`425d3e4`](https://github.com/generaltranslation/gt/commit/425d3e4e6c61afd108c65c27f7693ba2470b33c6), [`8650ae9`](https://github.com/generaltranslation/gt/commit/8650ae9ced69755bf3eebc1bafdf7743ba0c5136)]:
|
|
12
|
+
- @generaltranslation/format@0.1.0
|
|
13
|
+
- generaltranslation@8.2.14
|
|
14
|
+
- gt-i18n@0.9.2
|
|
15
|
+
- @generaltranslation/supported-locales@2.0.72
|
|
16
|
+
|
|
17
|
+
## 1.8.17
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [[`4d77edf`](https://github.com/generaltranslation/gt/commit/4d77edf7cb2bca5c20911c20c58f702803c9acc9), [`feffb35`](https://github.com/generaltranslation/gt/commit/feffb35f75b3deee12e29878792461b8d32fad3e), [`e88fd39`](https://github.com/generaltranslation/gt/commit/e88fd399683868d5af1fe2b0ba2974fe5b17d7a7), [`86263b3`](https://github.com/generaltranslation/gt/commit/86263b3aa8f2d283200515d609d69f570b97a84f), [`95f852a`](https://github.com/generaltranslation/gt/commit/95f852ae086ac79d2c446f4d3072d8fd18688796)]:
|
|
22
|
+
- gt-i18n@0.9.1
|
|
23
|
+
- generaltranslation@8.2.13
|
|
24
|
+
- @generaltranslation/supported-locales@2.0.71
|
|
25
|
+
|
|
3
26
|
## 1.8.16
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/dist/errors.cjs.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
//# sourceMappingURL=errors.cjs.min.cjs.map
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`@generaltranslation/format`);const e=`@generaltranslation/react-core`;`${e}`,`${e}`,`${e}`,`${e}`,`${e}`,`${e}`,`${e}`,`${e}`,`${e}`;const t=(t,n,r=e)=>`${r} Warning: "${n}" is not a supported locale. Update supported locales in your dashboard or gt.config.json. Falling back to "${t}".`;`${e}`,`${e}`,exports.createUnsupportedLocaleWarning=t;
|
|
2
|
+
//# sourceMappingURL=errors.cjs.min.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs.min.cjs","sources":["../src/errors-dir/
|
|
1
|
+
{"version":3,"file":"errors.cjs.min.cjs","names":[],"sources":["../src/errors-dir/constants.ts","../src/errors-dir/createErrors.ts"],"sourcesContent":["export const PACKAGE_NAME = '@generaltranslation/react-core';\n","import { getLocaleProperties } from '@generaltranslation/format';\nimport { PACKAGE_NAME } from './constants';\n\n// ---- ERRORS ---- //\n\nexport const projectIdMissingError = `${PACKAGE_NAME} Error: General Translation cloud services require a project ID! Find yours at generaltranslation.com/dashboard.`;\n\nexport const devApiKeyProductionError = `${PACKAGE_NAME} Error: Production environments cannot include a development api key.`;\n\nexport const apiKeyInProductionError = `${PACKAGE_NAME} Error: Production environments cannot include an api key.`;\n\nexport const createNoAuthError = `${PACKAGE_NAME} Error: Configuration is missing a projectId and/or devApiKey. Add these values to your environment or pass them to <GTProvider> directly.`;\n\nexport const createPluralMissingError = (children: unknown) =>\n `${PACKAGE_NAME} Error: <Plural> component with children \"${children}\" requires \"n\" option.`;\n\nexport const createClientSideTDictionaryCollisionError = (id: string) =>\n `${PACKAGE_NAME} Error: <T id=\"${id}\">, \"${id}\" is also used as a key in the dictionary. Don't give <T> components the same ID as dictionary entries.`;\n\nexport const createClientSideTHydrationError = (id: string) =>\n `${PACKAGE_NAME} Error: <T id=\"${id}\"> is used in a client component without a valid saved translation. This can cause hydration errors.` +\n `\\n\\nTo fix this error, consider using a dictionary with useGT() or pushing translations from the command line in advance.`;\n\nexport const dynamicTranslationError = `${PACKAGE_NAME} Error: Fetching batched translations failed`;\n\nexport const createGenericRuntimeTranslationError = (\n id: string | undefined,\n hash: string\n) => {\n if (!id) {\n return `${PACKAGE_NAME} Error: Translation failed for hash: ${hash}`;\n } else {\n return `${PACKAGE_NAME} Error: Translation failed for id: ${id}, hash: ${hash} `;\n }\n};\n\nexport const runtimeTranslationError = `${PACKAGE_NAME} Error: Runtime translation failed: `;\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n `${PACKAGE_NAME} Error: Failed to fetch locally stored translations. If using a custom loadTranslations(${locale}), make sure it is correctly implemented.`;\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n `${PACKAGE_NAME} Error: Failed to fetch locally stored dictionary. If using a custom loadDictionary(${locale}), make sure it is correctly implemented.`;\n\nexport const missingVariablesError = (variables: string[], message: string) =>\n `${PACKAGE_NAME} Error: missing variables: \"${variables.join('\", \"')}\" in message: \"${message}\"`;\n\nexport const createStringRenderError = (\n message: string,\n id: string | undefined\n) =>\n `${PACKAGE_NAME} Error: error rendering string ${id ? `for id: \"${id}\"` : ''} original message: \"${message}\"`;\n\nexport const createStringTranslationError = (\n string: string,\n id?: string,\n functionName = 'tx'\n) =>\n `${PACKAGE_NAME} Error: string translation error. ${functionName}(\"${string}\")${\n id ? ` with id \"${id}\"` : ''\n } could not locate translation.`;\n\nexport const invalidLocalesError = (locales: string[]) =>\n `${PACKAGE_NAME} Error: Invalid locale codes in your configuration. ` +\n `Specify a list of valid locales or use \"customMapping\" to ` +\n `define aliases for the following invalid locales: ${locales.join(', ')}.`;\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n `${PACKAGE_NAME} Error: Invalid canonical locale codes in your configuration: ${locales.join(', ')}.`;\n\nexport const createEmptyIdError = () =>\n `${PACKAGE_NAME} Error: You cannot provide an empty id to t.obj()`;\n\nexport const createSubtreeNotFoundError = (id: string) =>\n `${PACKAGE_NAME} Error: Dictionary subtree not found for id: \"${id}\"`;\n\nexport const createDictionaryEntryError = () =>\n `${PACKAGE_NAME} Error: Cannot inject and merge a dictionary entry`;\n\nexport const createCannotInjectDictionaryEntryError = () =>\n `${PACKAGE_NAME} Error: Cannot inject and merge a dictionary entry`;\n\nexport const createInvalidIcuDictionaryEntryError = (id: string | undefined) =>\n `${PACKAGE_NAME} Error: Invalid ICU string dictionary entry found for id: \"${id}\"`;\n\n// ---- WARNINGS ---- //\n\nexport const projectIdMissingWarning = `${PACKAGE_NAME} Warning: Translation cloud services require a project ID! Find yours at generaltranslation.com/dashboard.`;\n\nexport const createNoEntryFoundWarning = (id: string) =>\n `${PACKAGE_NAME} Warning: No valid dictionary entry found for id: \"${id}\"`;\n\nexport const createInvalidDictionaryEntryWarning = (id: string) =>\n `${PACKAGE_NAME} Warning: Invalid dictionary entry found for id: \"${id}\"`;\n\nexport const createInvalidIcuDictionaryEntryWarning = (id: string) =>\n `${PACKAGE_NAME} Warning: Invalid ICU string dictionary entry found for id: \"${id}\"`;\n\nexport const createNoEntryTranslationWarning = (\n id: string,\n prefixedId: string\n) =>\n `${PACKAGE_NAME} Warning: t('${id}') finding no translation for dictionary item ${prefixedId} !`;\n\nexport const createMismatchingHashWarning = (\n expectedHash: string,\n receivedHash: string\n) =>\n `${PACKAGE_NAME} Warning: Mismatching hashes! Expected hash: ${expectedHash}, but got hash: ${receivedHash}. We will still render your translation, but make sure to update to the newest version: generaltranslation.com/docs`;\n\nexport const APIKeyMissingWarn =\n `${PACKAGE_NAME} Warning: A development API key is required for runtime translation! ` +\n `Find your development API key: generaltranslation.com/dashboard. ` +\n `(Or, disable this warning message by setting runtimeUrl to an empty string which disables runtime translation.)`;\n\nexport const createUnsupportedLocalesWarning = (locales: string[]) =>\n `${PACKAGE_NAME} Warning: 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 runtimeTranslationTimeoutWarning = `${PACKAGE_NAME} Warning: Runtime translation timed out.`;\n\nexport const createUnsupportedLocaleWarning = (\n validatedLocale: string,\n newLocale: string,\n packageName: string = PACKAGE_NAME\n) => {\n return (\n `${packageName} Warning: \"${newLocale}\" is not a supported locale. ` +\n `Update supported locales in your dashboard or gt.config.json. ` +\n `Falling back to \"${validatedLocale}\".`\n );\n};\n\nexport const dictionaryMissingWarning = `${PACKAGE_NAME} Warning: No dictionary was found. Ensure you are either passing your dictionary to the <GTProvider>.`;\n\nexport const createStringRenderWarning = (\n message: string,\n id: string | undefined\n) =>\n `${PACKAGE_NAME} Warning: failed to render string ${id ? `for id: \"${id}\"` : ''} original message: \"${message}\"`;\n\n// Unlikely edge case: A <_T> component was injected outside of a <Derive> boundary. This would be caused by the compiler overeagerly injecting <_T> components.\nexport const warnNestedInternalTComponent = `${PACKAGE_NAME} Warning: A <_T> component was found injected outside of a <Derive> boundary. This may affect translation resolution for this component.`;\n"],"mappings":"yGAAA,MAAa,EAAe,iCCKS,GAAG,EAAH,EAEG,GAAG,EAAH,EAED,GAAG,EAAH,EAEN,GAAG,EAAH,EAYM,GAAG,EAAH,EAaA,GAAG,EAAH,EAmDA,GAAG,EAAH,EAwBrC,GAAG,EAAH,EAY8C,GAAG,EAAH,EAEhD,MAAa,GACX,EACA,EACA,EAAsB,IAGpB,GAAG,EAAY,aAAa,EAAU,8GAElB,EAAgB,IAIA,GAAG,EAAH,EASI,GAAG,EAAH"}
|
package/dist/errors.d.ts
CHANGED
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","
|
|
1
|
+
{"version":3,"file":"errors.d.ts","names":[],"sources":["../src/errors-dir/createErrors.ts"],"mappings":";cA6Ha,8BAAA,GACX,eAAA,UACA,SAAA,UACA,WAAA"}
|
package/dist/errors.esm.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"generaltranslation";const
|
|
2
|
-
//# sourceMappingURL=errors.esm.min.mjs.map
|
|
1
|
+
import"@generaltranslation/format";const e=`@generaltranslation/react-core`;`${e}`,`${e}`,`${e}`,`${e}`,`${e}`,`${e}`,`${e}`,`${e}`,`${e}`;const t=(t,n,r=e)=>`${r} Warning: "${n}" is not a supported locale. Update supported locales in your dashboard or gt.config.json. Falling back to "${t}".`;`${e}`,`${e}`;export{t as createUnsupportedLocaleWarning};
|
|
2
|
+
//# sourceMappingURL=errors.esm.min.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.esm.min.mjs","sources":["../src/errors-dir/constants.ts","../src/errors-dir/createErrors.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"errors.esm.min.mjs","names":[],"sources":["../src/errors-dir/constants.ts","../src/errors-dir/createErrors.ts"],"sourcesContent":["export const PACKAGE_NAME = '@generaltranslation/react-core';\n","import { getLocaleProperties } from '@generaltranslation/format';\nimport { PACKAGE_NAME } from './constants';\n\n// ---- ERRORS ---- //\n\nexport const projectIdMissingError = `${PACKAGE_NAME} Error: General Translation cloud services require a project ID! Find yours at generaltranslation.com/dashboard.`;\n\nexport const devApiKeyProductionError = `${PACKAGE_NAME} Error: Production environments cannot include a development api key.`;\n\nexport const apiKeyInProductionError = `${PACKAGE_NAME} Error: Production environments cannot include an api key.`;\n\nexport const createNoAuthError = `${PACKAGE_NAME} Error: Configuration is missing a projectId and/or devApiKey. Add these values to your environment or pass them to <GTProvider> directly.`;\n\nexport const createPluralMissingError = (children: unknown) =>\n `${PACKAGE_NAME} Error: <Plural> component with children \"${children}\" requires \"n\" option.`;\n\nexport const createClientSideTDictionaryCollisionError = (id: string) =>\n `${PACKAGE_NAME} Error: <T id=\"${id}\">, \"${id}\" is also used as a key in the dictionary. Don't give <T> components the same ID as dictionary entries.`;\n\nexport const createClientSideTHydrationError = (id: string) =>\n `${PACKAGE_NAME} Error: <T id=\"${id}\"> is used in a client component without a valid saved translation. This can cause hydration errors.` +\n `\\n\\nTo fix this error, consider using a dictionary with useGT() or pushing translations from the command line in advance.`;\n\nexport const dynamicTranslationError = `${PACKAGE_NAME} Error: Fetching batched translations failed`;\n\nexport const createGenericRuntimeTranslationError = (\n id: string | undefined,\n hash: string\n) => {\n if (!id) {\n return `${PACKAGE_NAME} Error: Translation failed for hash: ${hash}`;\n } else {\n return `${PACKAGE_NAME} Error: Translation failed for id: ${id}, hash: ${hash} `;\n }\n};\n\nexport const runtimeTranslationError = `${PACKAGE_NAME} Error: Runtime translation failed: `;\n\nexport const customLoadTranslationsError = (locale: string = '') =>\n `${PACKAGE_NAME} Error: Failed to fetch locally stored translations. If using a custom loadTranslations(${locale}), make sure it is correctly implemented.`;\n\nexport const customLoadDictionaryWarning = (locale: string = '') =>\n `${PACKAGE_NAME} Error: Failed to fetch locally stored dictionary. If using a custom loadDictionary(${locale}), make sure it is correctly implemented.`;\n\nexport const missingVariablesError = (variables: string[], message: string) =>\n `${PACKAGE_NAME} Error: missing variables: \"${variables.join('\", \"')}\" in message: \"${message}\"`;\n\nexport const createStringRenderError = (\n message: string,\n id: string | undefined\n) =>\n `${PACKAGE_NAME} Error: error rendering string ${id ? `for id: \"${id}\"` : ''} original message: \"${message}\"`;\n\nexport const createStringTranslationError = (\n string: string,\n id?: string,\n functionName = 'tx'\n) =>\n `${PACKAGE_NAME} Error: string translation error. ${functionName}(\"${string}\")${\n id ? ` with id \"${id}\"` : ''\n } could not locate translation.`;\n\nexport const invalidLocalesError = (locales: string[]) =>\n `${PACKAGE_NAME} Error: Invalid locale codes in your configuration. ` +\n `Specify a list of valid locales or use \"customMapping\" to ` +\n `define aliases for the following invalid locales: ${locales.join(', ')}.`;\n\nexport const invalidCanonicalLocalesError = (locales: string[]) =>\n `${PACKAGE_NAME} Error: Invalid canonical locale codes in your configuration: ${locales.join(', ')}.`;\n\nexport const createEmptyIdError = () =>\n `${PACKAGE_NAME} Error: You cannot provide an empty id to t.obj()`;\n\nexport const createSubtreeNotFoundError = (id: string) =>\n `${PACKAGE_NAME} Error: Dictionary subtree not found for id: \"${id}\"`;\n\nexport const createDictionaryEntryError = () =>\n `${PACKAGE_NAME} Error: Cannot inject and merge a dictionary entry`;\n\nexport const createCannotInjectDictionaryEntryError = () =>\n `${PACKAGE_NAME} Error: Cannot inject and merge a dictionary entry`;\n\nexport const createInvalidIcuDictionaryEntryError = (id: string | undefined) =>\n `${PACKAGE_NAME} Error: Invalid ICU string dictionary entry found for id: \"${id}\"`;\n\n// ---- WARNINGS ---- //\n\nexport const projectIdMissingWarning = `${PACKAGE_NAME} Warning: Translation cloud services require a project ID! Find yours at generaltranslation.com/dashboard.`;\n\nexport const createNoEntryFoundWarning = (id: string) =>\n `${PACKAGE_NAME} Warning: No valid dictionary entry found for id: \"${id}\"`;\n\nexport const createInvalidDictionaryEntryWarning = (id: string) =>\n `${PACKAGE_NAME} Warning: Invalid dictionary entry found for id: \"${id}\"`;\n\nexport const createInvalidIcuDictionaryEntryWarning = (id: string) =>\n `${PACKAGE_NAME} Warning: Invalid ICU string dictionary entry found for id: \"${id}\"`;\n\nexport const createNoEntryTranslationWarning = (\n id: string,\n prefixedId: string\n) =>\n `${PACKAGE_NAME} Warning: t('${id}') finding no translation for dictionary item ${prefixedId} !`;\n\nexport const createMismatchingHashWarning = (\n expectedHash: string,\n receivedHash: string\n) =>\n `${PACKAGE_NAME} Warning: Mismatching hashes! Expected hash: ${expectedHash}, but got hash: ${receivedHash}. We will still render your translation, but make sure to update to the newest version: generaltranslation.com/docs`;\n\nexport const APIKeyMissingWarn =\n `${PACKAGE_NAME} Warning: A development API key is required for runtime translation! ` +\n `Find your development API key: generaltranslation.com/dashboard. ` +\n `(Or, disable this warning message by setting runtimeUrl to an empty string which disables runtime translation.)`;\n\nexport const createUnsupportedLocalesWarning = (locales: string[]) =>\n `${PACKAGE_NAME} Warning: 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 runtimeTranslationTimeoutWarning = `${PACKAGE_NAME} Warning: Runtime translation timed out.`;\n\nexport const createUnsupportedLocaleWarning = (\n validatedLocale: string,\n newLocale: string,\n packageName: string = PACKAGE_NAME\n) => {\n return (\n `${packageName} Warning: \"${newLocale}\" is not a supported locale. ` +\n `Update supported locales in your dashboard or gt.config.json. ` +\n `Falling back to \"${validatedLocale}\".`\n );\n};\n\nexport const dictionaryMissingWarning = `${PACKAGE_NAME} Warning: No dictionary was found. Ensure you are either passing your dictionary to the <GTProvider>.`;\n\nexport const createStringRenderWarning = (\n message: string,\n id: string | undefined\n) =>\n `${PACKAGE_NAME} Warning: failed to render string ${id ? `for id: \"${id}\"` : ''} original message: \"${message}\"`;\n\n// Unlikely edge case: A <_T> component was injected outside of a <Derive> boundary. This would be caused by the compiler overeagerly injecting <_T> components.\nexport const warnNestedInternalTComponent = `${PACKAGE_NAME} Warning: A <_T> component was found injected outside of a <Derive> boundary. This may affect translation resolution for this component.`;\n"],"mappings":"mCAAA,MAAa,EAAe,iCCKS,GAAG,EAAH,EAEG,GAAG,EAAH,EAED,GAAG,EAAH,EAEN,GAAG,EAAH,EAYM,GAAG,EAAH,EAaA,GAAG,EAAH,EAmDA,GAAG,EAAH,EAwBrC,GAAG,EAAH,EAY8C,GAAG,EAAH,EAEhD,MAAa,GACX,EACA,EACA,EAAsB,IAGpB,GAAG,EAAY,aAAa,EAAU,8GAElB,EAAgB,IAIA,GAAG,EAAH,EASI,GAAG,EAAH"}
|