@generaltranslation/react-core 0.0.0 → 0.0.1-alpha.0
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/LICENSE.md +105 -0
- package/README.md +9 -0
- package/dist/branches/Branch.d.ts +34 -0
- package/dist/branches/Branch.d.ts.map +1 -0
- package/dist/branches/plurals/Plural.d.ts +38 -0
- package/dist/branches/plurals/Plural.d.ts.map +1 -0
- package/dist/branches/plurals/getPluralBranch.d.ts +9 -0
- package/dist/branches/plurals/getPluralBranch.d.ts.map +1 -0
- package/dist/dictionaries/collectUntranslatedEntries.d.ts +17 -0
- package/dist/dictionaries/collectUntranslatedEntries.d.ts.map +1 -0
- package/dist/dictionaries/getDictionaryEntry.d.ts +4 -0
- package/dist/dictionaries/getDictionaryEntry.d.ts.map +1 -0
- package/dist/dictionaries/getEntryAndMetadata.d.ts +6 -0
- package/dist/dictionaries/getEntryAndMetadata.d.ts.map +1 -0
- package/dist/dictionaries/getSubtree.d.ts +18 -0
- package/dist/dictionaries/getSubtree.d.ts.map +1 -0
- package/dist/dictionaries/indexDict.d.ts +15 -0
- package/dist/dictionaries/indexDict.d.ts.map +1 -0
- package/dist/dictionaries/injectAndMerge.d.ts +9 -0
- package/dist/dictionaries/injectAndMerge.d.ts.map +1 -0
- package/dist/dictionaries/injectEntry.d.ts +18 -0
- package/dist/dictionaries/injectEntry.d.ts.map +1 -0
- package/dist/dictionaries/injectFallbacks.d.ts +17 -0
- package/dist/dictionaries/injectFallbacks.d.ts.map +1 -0
- package/dist/dictionaries/injectHashes.d.ts +11 -0
- package/dist/dictionaries/injectHashes.d.ts.map +1 -0
- package/dist/dictionaries/injectTranslations.d.ts +20 -0
- package/dist/dictionaries/injectTranslations.d.ts.map +1 -0
- package/dist/dictionaries/isDictionaryEntry.d.ts +8 -0
- package/dist/dictionaries/isDictionaryEntry.d.ts.map +1 -0
- package/dist/dictionaries/loadDictionaryHelper.d.ts +3 -0
- package/dist/dictionaries/loadDictionaryHelper.d.ts.map +1 -0
- package/dist/dictionaries/mergeDictionaries.d.ts +3 -0
- package/dist/dictionaries/mergeDictionaries.d.ts.map +1 -0
- package/dist/dictionaries/stripMetadataFromEntries.d.ts +6 -0
- package/dist/dictionaries/stripMetadataFromEntries.d.ts.map +1 -0
- package/dist/errors-dir/constants.d.ts +2 -0
- package/dist/errors-dir/constants.d.ts.map +1 -0
- package/dist/errors-dir/createErrors.d.ts +32 -0
- package/dist/errors-dir/createErrors.d.ts.map +1 -0
- package/dist/errors-dir/internalErrors.d.ts +8 -0
- package/dist/errors-dir/internalErrors.d.ts.map +1 -0
- package/dist/errors.cjs.min.cjs +1 -0
- package/dist/errors.d.ts +3 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.esm.min.mjs +1 -0
- package/dist/hooks/useDefaultLocale.d.ts +13 -0
- package/dist/hooks/useDefaultLocale.d.ts.map +1 -0
- package/dist/hooks/useGTClass.d.ts +23 -0
- package/dist/hooks/useGTClass.d.ts.map +1 -0
- package/dist/hooks/useLocale.d.ts +11 -0
- package/dist/hooks/useLocale.d.ts.map +1 -0
- package/dist/hooks/useLocaleDirection.d.ts +14 -0
- package/dist/hooks/useLocaleDirection.d.ts.map +1 -0
- package/dist/hooks/useLocaleSelector.d.ts +42 -0
- package/dist/hooks/useLocaleSelector.d.ts.map +1 -0
- package/dist/hooks/useLocales.d.ts +11 -0
- package/dist/hooks/useLocales.d.ts.map +1 -0
- package/dist/hooks/useRegion.d.ts +20 -0
- package/dist/hooks/useRegion.d.ts.map +1 -0
- package/dist/hooks/useRegionSelector.d.ts +82 -0
- package/dist/hooks/useRegionSelector.d.ts.map +1 -0
- package/dist/hooks/useSetLocale.d.ts +12 -0
- package/dist/hooks/useSetLocale.d.ts.map +1 -0
- package/dist/index.cjs.min.cjs +18 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.min.mjs +18 -0
- package/dist/internal/addGTIdentifier.d.ts +4 -0
- package/dist/internal/addGTIdentifier.d.ts.map +1 -0
- package/dist/internal/flattenDictionary.d.ts +11 -0
- package/dist/internal/flattenDictionary.d.ts.map +1 -0
- package/dist/internal/writeChildrenAsObjects.d.ts +10 -0
- package/dist/internal/writeChildrenAsObjects.d.ts.map +1 -0
- package/dist/internal.cjs.min.cjs +18 -0
- package/dist/internal.d.ts +32 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.esm.min.mjs +18 -0
- package/dist/messages/messages.d.ts +43 -0
- package/dist/messages/messages.d.ts.map +1 -0
- package/dist/promises/dangerouslyUsable.d.ts +37 -0
- package/dist/promises/dangerouslyUsable.d.ts.map +1 -0
- package/dist/promises/reactHasUse.d.ts +2 -0
- package/dist/promises/reactHasUse.d.ts.map +1 -0
- package/dist/provider/GTContext.d.ts +4 -0
- package/dist/provider/GTContext.d.ts.map +1 -0
- package/dist/provider/GTProvider.d.ts +32 -0
- package/dist/provider/GTProvider.d.ts.map +1 -0
- package/dist/provider/config/defaultProps.d.ts +4 -0
- package/dist/provider/config/defaultProps.d.ts.map +1 -0
- package/dist/provider/helpers/isSSREnabled.d.ts +5 -0
- package/dist/provider/helpers/isSSREnabled.d.ts.map +1 -0
- package/dist/provider/helpers/validateString.d.ts +6 -0
- package/dist/provider/helpers/validateString.d.ts.map +1 -0
- package/dist/provider/hooks/locales/types.d.ts +11 -0
- package/dist/provider/hooks/locales/types.d.ts.map +1 -0
- package/dist/provider/hooks/locales/useDetermineLocale.d.ts +6 -0
- package/dist/provider/hooks/locales/useDetermineLocale.d.ts.map +1 -0
- package/dist/provider/hooks/locales/useLocaleState.d.ts +18 -0
- package/dist/provider/hooks/locales/useLocaleState.d.ts.map +1 -0
- package/dist/provider/hooks/translation/useCreateInternalUseGTFunction.d.ts +18 -0
- package/dist/provider/hooks/translation/useCreateInternalUseGTFunction.d.ts.map +1 -0
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsFunction.d.ts +4 -0
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsFunction.d.ts.map +1 -0
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.d.ts +4 -0
- package/dist/provider/hooks/translation/useCreateInternalUseTranslationsObjFunction.d.ts.map +1 -0
- package/dist/provider/hooks/types.d.ts +10 -0
- package/dist/provider/hooks/types.d.ts.map +1 -0
- package/dist/provider/hooks/useErrorChecks.d.ts +9 -0
- package/dist/provider/hooks/useErrorChecks.d.ts.map +1 -0
- package/dist/provider/hooks/useLoadDictionary.d.ts +15 -0
- package/dist/provider/hooks/useLoadDictionary.d.ts.map +1 -0
- package/dist/provider/hooks/useLoadTranslations.d.ts +17 -0
- package/dist/provider/hooks/useLoadTranslations.d.ts.map +1 -0
- package/dist/provider/hooks/useRegionState.d.ts +6 -0
- package/dist/provider/hooks/useRegionState.d.ts.map +1 -0
- package/dist/provider/hooks/useRuntimeTranslation.d.ts +23 -0
- package/dist/provider/hooks/useRuntimeTranslation.d.ts.map +1 -0
- package/dist/rendering/defaultRenderSettings.d.ts +6 -0
- package/dist/rendering/defaultRenderSettings.d.ts.map +1 -0
- package/dist/rendering/getGTTag.d.ts +3 -0
- package/dist/rendering/getGTTag.d.ts.map +1 -0
- package/dist/rendering/isVariableObject.d.ts +3 -0
- package/dist/rendering/isVariableObject.d.ts.map +1 -0
- package/dist/rendering/renderDefaultChildren.d.ts +8 -0
- package/dist/rendering/renderDefaultChildren.d.ts.map +1 -0
- package/dist/rendering/renderSkeleton.d.ts +8 -0
- package/dist/rendering/renderSkeleton.d.ts.map +1 -0
- package/dist/rendering/renderTranslatedChildren.d.ts +9 -0
- package/dist/rendering/renderTranslatedChildren.d.ts.map +1 -0
- package/dist/rendering/renderVariable.d.ts +4 -0
- package/dist/rendering/renderVariable.d.ts.map +1 -0
- package/dist/translation/hooks/useGT.d.ts +20 -0
- package/dist/translation/hooks/useGT.d.ts.map +1 -0
- package/dist/translation/hooks/useMessages.d.ts +19 -0
- package/dist/translation/hooks/useMessages.d.ts.map +1 -0
- package/dist/translation/hooks/useTranslations.d.ts +17 -0
- package/dist/translation/hooks/useTranslations.d.ts.map +1 -0
- package/dist/translation/inline/T.d.ts +42 -0
- package/dist/translation/inline/T.d.ts.map +1 -0
- package/dist/types-dir/config.d.ts +50 -0
- package/dist/types-dir/config.d.ts.map +1 -0
- package/dist/types-dir/context.d.ts +30 -0
- package/dist/types-dir/context.d.ts.map +1 -0
- package/dist/types-dir/runtime.d.ts +20 -0
- package/dist/types-dir/runtime.d.ts.map +1 -0
- package/dist/types-dir/types.d.ts +90 -0
- package/dist/types-dir/types.d.ts.map +1 -0
- package/dist/types.d.ts +214 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/ui/LocaleSelector.d.ts +7 -0
- package/dist/ui/LocaleSelector.d.ts.map +1 -0
- package/dist/ui/RegionSelector.d.ts +7 -0
- package/dist/ui/RegionSelector.d.ts.map +1 -0
- package/dist/ui/types.d.ts +18 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/utils/cookies.d.ts +9 -0
- package/dist/utils/cookies.d.ts.map +1 -0
- package/dist/utils/fetchTranslations.d.ts +9 -0
- package/dist/utils/fetchTranslations.d.ts.map +1 -0
- package/dist/utils/types.d.ts +9 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/utils.d.ts +8 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/variables/Currency.d.ts +30 -0
- package/dist/variables/Currency.d.ts.map +1 -0
- package/dist/variables/DateTime.d.ts +29 -0
- package/dist/variables/DateTime.d.ts.map +1 -0
- package/dist/variables/Num.d.ts +31 -0
- package/dist/variables/Num.d.ts.map +1 -0
- package/dist/variables/Var.d.ts +32 -0
- package/dist/variables/Var.d.ts.map +1 -0
- package/dist/variables/_getVariableProps.d.ts +11 -0
- package/dist/variables/_getVariableProps.d.ts.map +1 -0
- package/dist/variables/getVariableName.d.ts +10 -0
- package/dist/variables/getVariableName.d.ts.map +1 -0
- package/package.json +109 -14
- package/index.d.ts +0 -4
- package/index.js +0 -7
package/LICENSE.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-ALv2
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2025 General Translation, Inc.
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://generaltranslation.com" target="_blank">
|
|
3
|
+
<img src="https://generaltranslation.com/gt-logo-light.svg" alt="General Translation" width="100" height="100">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
# @generaltranslation/react-core
|
|
8
|
+
|
|
9
|
+
A pure React library for internationalization
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `<Branch>` component dynamically renders a specified branch of content or a fallback child component.
|
|
3
|
+
* It allows for flexible content switching based on the `branch` prop and an object of possible branches (`...branches`).
|
|
4
|
+
* If the specified `branch` is present in the `branches` object, it renders the content of that branch.
|
|
5
|
+
* If the `branch` is not found, it renders the provided `children` as fallback content.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```jsx
|
|
9
|
+
* <Branch
|
|
10
|
+
* branch="summary"
|
|
11
|
+
* summary={<p>This is a summary</p>}
|
|
12
|
+
* details={<p>Details here</p>}
|
|
13
|
+
* >
|
|
14
|
+
* <p>Fallback content</p>
|
|
15
|
+
* </Branch>
|
|
16
|
+
* ```
|
|
17
|
+
* If the `branch` prop is set to `"summary"`, it will render `<p>This is a summary</p>`. If the `branch` is not set or does not match any keys in the branches object, it renders the fallback content `<p>Fallback content</p>`.
|
|
18
|
+
*
|
|
19
|
+
* @param {any} [children] - Fallback content to render if no matching branch is found.
|
|
20
|
+
* @param {any} [name="branch"] - Optional name for the component, used for metadata or tracking purposes.
|
|
21
|
+
* @param {string} [branch] - The name of the branch to render. The component looks for this key in the `...branches` object.
|
|
22
|
+
* @param {...{[key: string]: any}} [branches] - A spread object containing possible branches as keys and their corresponding content as values.
|
|
23
|
+
* @returns {React.JSX.Element} The rendered branch or fallback content.
|
|
24
|
+
*/
|
|
25
|
+
declare function Branch({ children, branch, ...branches }: {
|
|
26
|
+
children?: any;
|
|
27
|
+
branch?: string | number | boolean;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}): React.JSX.Element;
|
|
30
|
+
declare namespace Branch {
|
|
31
|
+
var _gtt: string;
|
|
32
|
+
}
|
|
33
|
+
export default Branch;
|
|
34
|
+
//# sourceMappingURL=Branch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Branch.d.ts","sourceRoot":"","sources":["../../src/branches/Branch.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,iBAAS,MAAM,CAAC,EACd,QAAQ,EACR,MAAM,EACN,GAAG,QAAQ,EACZ,EAAE;IACD,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAOpB;kBAfQ,MAAM;;;AAkBf,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `<Plural>` component dynamically renders content based on the plural form of the given number (`n`).
|
|
3
|
+
* It determines which content to display by matching the value of `n` to the appropriate pluralization branch,
|
|
4
|
+
* based on the current locale or a default locale. If no matching plural branch is found, the component renders
|
|
5
|
+
* the fallback `children` content.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```jsx
|
|
9
|
+
* <Plural
|
|
10
|
+
* n={1}
|
|
11
|
+
* one="There is 1 item"
|
|
12
|
+
* other="There are {n} items"
|
|
13
|
+
* />
|
|
14
|
+
* ```
|
|
15
|
+
* In this example, if `n` is 1, it renders `"There is 1 item"`. If `n` is a different number, it renders
|
|
16
|
+
* `"There are {n} items"`.
|
|
17
|
+
*
|
|
18
|
+
* @param {any} [children] - Fallback content to render if no matching plural branch is found.
|
|
19
|
+
* @param {number} [n] - The number used to determine the plural form. This is required for pluralization to work.
|
|
20
|
+
* @param {string} [locales] - Optional parameter, the locale to use for pluralization format. If not provided and wrapped
|
|
21
|
+
* in <GTProvider> will automatically populate this value as user's current locale. If not provided and not wrapped in
|
|
22
|
+
* <GTProvider>, will use the library default locale (en-US).
|
|
23
|
+
* @param {...{[key: string]: any}} [branches] - A spread object containing possible plural branches, typically including `one` for singular
|
|
24
|
+
* and `other` for plural forms, but it may vary depending on the locale.
|
|
25
|
+
* @returns {React.JSX.Element} The rendered content corresponding to the plural form of `n`, or the fallback content.
|
|
26
|
+
* @throws {Error} If `n` is not provided or not a valid number.
|
|
27
|
+
*/
|
|
28
|
+
declare function Plural({ children, n, locales, ...branches }: {
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
n?: number;
|
|
31
|
+
locales?: string;
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
}): React.JSX.Element;
|
|
34
|
+
declare namespace Plural {
|
|
35
|
+
var _gtt: string;
|
|
36
|
+
}
|
|
37
|
+
export default Plural;
|
|
38
|
+
//# sourceMappingURL=Plural.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Plural.d.ts","sourceRoot":"","sources":["../../../src/branches/plurals/Plural.tsx"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,iBAAS,MAAM,CAAC,EACd,QAAQ,EACR,CAAC,EACD,OAAO,EACP,GAAG,QAAQ,EACZ,EAAE;IACD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAcpB;kBAxBQ,MAAM;;;AA4Bf,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main function to get the appropriate branch based on the provided number and branches.
|
|
3
|
+
*
|
|
4
|
+
* @param {number} n - The number to determine the branch for.
|
|
5
|
+
* @param {any} branches - The object containing possible branches.
|
|
6
|
+
* @returns {any} The determined branch.
|
|
7
|
+
*/
|
|
8
|
+
export default function getPluralBranch(n: number, locales: string[], branches: Record<string, any>): any;
|
|
9
|
+
//# sourceMappingURL=getPluralBranch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPluralBranch.d.ts","sourceRoot":"","sources":["../../../src/branches/plurals/getPluralBranch.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,CAAC,EAAE,MAAM,EACT,OAAO,EAAE,MAAM,EAAE,EACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,OAQ9B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Dictionary } from '../types-dir/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Collects all untranslated entries from a dictionary
|
|
4
|
+
* @param dictionary - The dictionary to collect untranslated entries from
|
|
5
|
+
* @param translationsDictionary - The translated dictionary to compare against
|
|
6
|
+
* @param id - The id of the dictionary to collect untranslated entries from
|
|
7
|
+
* @returns An array of untranslated entries
|
|
8
|
+
*/
|
|
9
|
+
export declare function collectUntranslatedEntries(dictionary: Dictionary, translationsDictionary: Dictionary, id?: string): {
|
|
10
|
+
source: string;
|
|
11
|
+
metadata: {
|
|
12
|
+
$id: string;
|
|
13
|
+
$context?: string;
|
|
14
|
+
$_hash: string;
|
|
15
|
+
};
|
|
16
|
+
}[];
|
|
17
|
+
//# sourceMappingURL=collectUntranslatedEntries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectUntranslatedEntries.d.ts","sourceRoot":"","sources":["../../src/dictionaries/collectUntranslatedEntries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKhD;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,UAAU,EAClC,EAAE,GAAE,MAAW,GACd;IACD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9D,EAAE,CAgCF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Dictionary, DictionaryEntry } from '../types-dir/types';
|
|
2
|
+
export declare function isValidDictionaryEntry(value: unknown): value is DictionaryEntry;
|
|
3
|
+
export declare function getDictionaryEntry<T extends Dictionary>(dictionary: T, id: string): Dictionary | DictionaryEntry | undefined;
|
|
4
|
+
//# sourceMappingURL=getDictionaryEntry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDictionaryEntry.d.ts","sourceRoot":"","sources":["../../src/dictionaries/getDictionaryEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGjE,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,eAAe,CAgB1B;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,EACrD,UAAU,EAAE,CAAC,EACb,EAAE,EAAE,MAAM,GACT,UAAU,GAAG,eAAe,GAAG,SAAS,CAU1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEntryAndMetadata.d.ts","sourceRoot":"","sources":["../../src/dictionaries/getEntryAndMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEhE,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAUA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Dictionary, DictionaryEntry } from '../types-dir/types';
|
|
2
|
+
export declare function getSubtree<T extends Dictionary>({ dictionary, id, }: {
|
|
3
|
+
dictionary: T;
|
|
4
|
+
id: string;
|
|
5
|
+
}): Dictionary | DictionaryEntry | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* @description A function that gets a subtree from a dictionary
|
|
8
|
+
* @param dictionary - new dictionary to get the subtree from
|
|
9
|
+
* @param id - id of the subtree to get
|
|
10
|
+
* @param sourceDictionary - source dictionary to model off of
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export declare function getSubtreeWithCreation<T extends Dictionary>({ dictionary, id, sourceDictionary, }: {
|
|
14
|
+
dictionary: T;
|
|
15
|
+
id: string;
|
|
16
|
+
sourceDictionary: T;
|
|
17
|
+
}): Dictionary | DictionaryEntry | undefined;
|
|
18
|
+
//# sourceMappingURL=getSubtree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSubtree.d.ts","sourceRoot":"","sources":["../../src/dictionaries/getSubtree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGjE,wBAAgB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,EAC/C,UAAU,EACV,EAAE,GACH,EAAE;IACD,UAAU,EAAE,CAAC,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,UAAU,GAAG,eAAe,GAAG,SAAS,CAW3C;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,UAAU,EAAE,EAC3D,UAAU,EACV,EAAE,EACF,gBAAgB,GACjB,EAAE;IACD,UAAU,EAAE,CAAC,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,EAAE,CAAC,CAAC;CACrB,GAAG,UAAU,GAAG,eAAe,GAAG,SAAS,CAoB3C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Dictionary, DictionaryEntry } from '../types-dir/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description A function that gets a value from a dictionary, only one level
|
|
4
|
+
* @param dictionary - dictionary to get the value from
|
|
5
|
+
* @param id - id of the value to get
|
|
6
|
+
*/
|
|
7
|
+
export declare function get(dictionary: Dictionary, id: string | number): DictionaryEntry | Dictionary;
|
|
8
|
+
/**
|
|
9
|
+
* @description A function that sets a value in a dictionary
|
|
10
|
+
* @param dictionary - dictionary to set the value in
|
|
11
|
+
* @param id - id of the value to set
|
|
12
|
+
* @param value - value to set
|
|
13
|
+
*/
|
|
14
|
+
export declare function set(dictionary: Dictionary, id: string | number, value: Dictionary | DictionaryEntry): void;
|
|
15
|
+
//# sourceMappingURL=indexDict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexDict.d.ts","sourceRoot":"","sources":["../../src/dictionaries/indexDict.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACjE;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,gCAQ9D;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CACjB,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,KAAK,EAAE,UAAU,GAAG,eAAe,QAOpC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dictionary } from '../types-dir/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Given a subtree and a dictionary, injects the subtree into the dictionary at the given id
|
|
4
|
+
* @param dictionary - The dictionary to inject the subtree into
|
|
5
|
+
* @param subtree - The subtree to inject into the dictionary
|
|
6
|
+
* @param id - The id of the subtree to inject into the dictionary
|
|
7
|
+
*/
|
|
8
|
+
export declare function injectAndMerge(dictionary: Dictionary, subtree: Dictionary, id: string): Dictionary;
|
|
9
|
+
//# sourceMappingURL=injectAndMerge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectAndMerge.d.ts","sourceRoot":"","sources":["../../src/dictionaries/injectAndMerge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,oBAAoB,CAAC;AAYjE;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,UAAU,EACnB,EAAE,EAAE,MAAM,cAeX"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Dictionary, DictionaryEntry, TranslatedChildren } from '../types-dir/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Injects an entry into a translations object
|
|
4
|
+
* @param translations - The translations object to inject the entry into
|
|
5
|
+
* @param entry - The entry to inject
|
|
6
|
+
* @param hash - The hash of the entry
|
|
7
|
+
* @param sourceDictionary - The source dictionary to model the new dictionary after
|
|
8
|
+
*/
|
|
9
|
+
export declare function injectEntry(dictionaryEntry: DictionaryEntry, dictionary: Dictionary | DictionaryEntry, id: string, sourceDictionary: Dictionary | DictionaryEntry): DictionaryEntry | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* @description Merge results into a dictionary
|
|
12
|
+
* @param dictionary - The dictionary to merge the results into
|
|
13
|
+
* @param results - The results to merge into the dictionary
|
|
14
|
+
* @param sourceDictionary - The source dictionary to model the new dictionary after
|
|
15
|
+
* @returns The merged dictionary
|
|
16
|
+
*/
|
|
17
|
+
export declare function mergeResultsIntoDictionary(dictionary: Dictionary, results: [string, TranslatedChildren][], sourceDictionary: Dictionary): Dictionary;
|
|
18
|
+
//# sourceMappingURL=injectEntry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectEntry.d.ts","sourceRoot":"","sources":["../../src/dictionaries/injectEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,eAAe,EACf,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAY5B;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,UAAU,GAAG,eAAe,EACxC,EAAE,EAAE,MAAM,EACV,gBAAgB,EAAE,UAAU,GAAG,eAAe,+BAiC/C;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,EACvC,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAKZ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Dictionary } from '../types-dir/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Injects fallbacks into a dictionary
|
|
4
|
+
* @param dictionary - The dictionary to inject translations into
|
|
5
|
+
* @param translationsDictionary - The translations to inject into the dictionary
|
|
6
|
+
* @param translations - The translations to inject into the dictionary
|
|
7
|
+
* @param id - The id of the dictionary to inject translations into
|
|
8
|
+
*/
|
|
9
|
+
export declare function injectFallbacks(dictionary: Dictionary, translationsDictionary: Dictionary, missingTranslations: {
|
|
10
|
+
source: string;
|
|
11
|
+
metadata: {
|
|
12
|
+
$id: string;
|
|
13
|
+
$context?: string;
|
|
14
|
+
$_hash: string;
|
|
15
|
+
};
|
|
16
|
+
}[], prefixToRemove?: string): Dictionary;
|
|
17
|
+
//# sourceMappingURL=injectFallbacks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectFallbacks.d.ts","sourceRoot":"","sources":["../../src/dictionaries/injectFallbacks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMhD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,UAAU,EAClC,mBAAmB,EAAE;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9D,EAAE,EACH,cAAc,GAAE,MAAW,cAuB5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dictionary } from '../types-dir/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Given a dictionary, adds hashes to all dictionary entries
|
|
4
|
+
* @param dictionary - The dictionary to add hashes to
|
|
5
|
+
* @param id - The starting point of dictionary (if subtree)
|
|
6
|
+
*/
|
|
7
|
+
export declare function injectHashes(dictionary: Dictionary, id?: string): {
|
|
8
|
+
dictionary: Dictionary;
|
|
9
|
+
updateDictionary: boolean;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=injectHashes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectHashes.d.ts","sourceRoot":"","sources":["../../src/dictionaries/injectHashes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,UAAU,EACtB,EAAE,GAAE,MAAW,GACd;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,CAwBvD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Dictionary, Translations } from '../types-dir/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Injects translations into a dictionary
|
|
4
|
+
* @param dictionary - The dictionary to inject translations into
|
|
5
|
+
* @param translationsDictionary - The translations to inject into the dictionary
|
|
6
|
+
* @param translations - The translations to inject into the dictionary
|
|
7
|
+
* @param id - The id of the dictionary to inject translations into
|
|
8
|
+
*/
|
|
9
|
+
export declare function injectTranslations(dictionary: Dictionary, translationsDictionary: Dictionary, translations: Translations, missingTranslations: {
|
|
10
|
+
source: string;
|
|
11
|
+
metadata: {
|
|
12
|
+
$id: string;
|
|
13
|
+
$context?: string;
|
|
14
|
+
$_hash: string;
|
|
15
|
+
};
|
|
16
|
+
}[], prefixToRemove?: string): {
|
|
17
|
+
dictionary: Dictionary;
|
|
18
|
+
updateDictionary: boolean;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=injectTranslations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injectTranslations.d.ts","sourceRoot":"","sources":["../../src/dictionaries/injectTranslations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAM9D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,sBAAsB,EAAE,UAAU,EAClC,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9D,EAAE,EACH,cAAc,GAAE,MAAW,GAC1B;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,CA8BvD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dictionary, DictionaryEntry } from '../types-dir/types';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard function that checks if a value is a DictionaryEntry
|
|
4
|
+
* @param value - The value to check
|
|
5
|
+
* @returns true if the value is a DictionaryEntry, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function isDictionaryEntry(value: Dictionary | DictionaryEntry | undefined): value is DictionaryEntry;
|
|
8
|
+
//# sourceMappingURL=isDictionaryEntry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDictionaryEntry.d.ts","sourceRoot":"","sources":["../../src/dictionaries/isDictionaryEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,SAAS,GAC9C,KAAK,IAAI,eAAe,CAoC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadDictionaryHelper.d.ts","sourceRoot":"","sources":["../../src/dictionaries/loadDictionaryHelper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE9D,wBAA8B,oBAAoB,CAChD,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,YAAY,GAC3B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAkBjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeDictionaries.d.ts","sourceRoot":"","sources":["../../src/dictionaries/mergeDictionaries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,oBAAoB,CAAC;AAUjE,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,uBAAuB,EAAE,UAAU,EACnC,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAiDZ"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Dictionary } from '../types-dir/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Iterate over tree and remove metadata leaving just the entry
|
|
4
|
+
*/
|
|
5
|
+
export declare function stripMetadataFromEntries(dictionary: Dictionary): Dictionary;
|
|
6
|
+
//# sourceMappingURL=stripMetadataFromEntries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripMetadataFromEntries.d.ts","sourceRoot":"","sources":["../../src/dictionaries/stripMetadataFromEntries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKhD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAc3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/errors-dir/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const projectIdMissingError = "@generaltranslation/react-core Error: General Translation cloud services require a project ID! Find yours at generaltranslation.com/dashboard.";
|
|
2
|
+
export declare const devApiKeyProductionError = "@generaltranslation/react-core Error: Production environments cannot include a development api key.";
|
|
3
|
+
export declare const apiKeyInProductionError = "@generaltranslation/react-core Error: Production environments cannot include an api key.";
|
|
4
|
+
export declare const createNoAuthError = "@generaltranslation/react-core Error: Configuration is missing a projectId and/or devApiKey. Please add these values to your environment or pass them to the <GTProvider> directly.";
|
|
5
|
+
export declare const createPluralMissingError: (children: any) => string;
|
|
6
|
+
export declare const createClientSideTDictionaryCollisionError: (id: string) => string;
|
|
7
|
+
export declare const createClientSideTHydrationError: (id: string) => string;
|
|
8
|
+
export declare const dynamicTranslationError = "@generaltranslation/react-core Error: Fetching batched translations failed";
|
|
9
|
+
export declare const createGenericRuntimeTranslationError: (id: string | undefined, hash: string) => string;
|
|
10
|
+
export declare const runtimeTranslationError = "@generaltranslation/react-core Error: Runtime translation failed: ";
|
|
11
|
+
export declare const customLoadTranslationsError: (locale?: string) => string;
|
|
12
|
+
export declare const customLoadDictionaryWarning: (locale?: string) => string;
|
|
13
|
+
export declare const missingVariablesError: (variables: string[], message: string) => string;
|
|
14
|
+
export declare const createStringRenderError: (message: string, id: string | undefined) => string;
|
|
15
|
+
export declare const createStringTranslationError: (string: string, id?: string, functionName?: string) => string;
|
|
16
|
+
export declare const invalidLocalesError: (locales: string[]) => string;
|
|
17
|
+
export declare const invalidCanonicalLocalesError: (locales: string[]) => string;
|
|
18
|
+
export declare const createEmptyIdError: () => string;
|
|
19
|
+
export declare const createSubtreeNotFoundError: (id: string) => string;
|
|
20
|
+
export declare const createDictionaryEntryError: () => string;
|
|
21
|
+
export declare const createCannotInjectDictionaryEntryError: () => string;
|
|
22
|
+
export declare const projectIdMissingWarning = "@generaltranslation/react-core Warning: Translation cloud services require a project ID! Find yours at generaltranslation.com/dashboard.";
|
|
23
|
+
export declare const createNoEntryFoundWarning: (id: string) => string;
|
|
24
|
+
export declare const createInvalidDictionaryEntryWarning: (id: string) => string;
|
|
25
|
+
export declare const createNoEntryTranslationWarning: (id: string, prefixedId: string) => string;
|
|
26
|
+
export declare const createMismatchingHashWarning: (expectedHash: string, receivedHash: string) => string;
|
|
27
|
+
export declare const APIKeyMissingWarn: string;
|
|
28
|
+
export declare const createUnsupportedLocalesWarning: (locales: string[]) => string;
|
|
29
|
+
export declare const runtimeTranslationTimeoutWarning = "@generaltranslation/react-core Warning: Runtime translation timed out.";
|
|
30
|
+
export declare const createUnsupportedLocaleWarning: (validatedLocale: string, newLocale: string, packageName?: string) => string;
|
|
31
|
+
export declare const dictionaryMissingWarning = "@generaltranslation/react-core Warning: No dictionary was found. Ensure you are either passing your dictionary to the <GTProvider>.";
|
|
32
|
+
//# sourceMappingURL=createErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createErrors.d.ts","sourceRoot":"","sources":["../../src/errors-dir/createErrors.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,mJAAoI,CAAC;AAEvK,eAAO,MAAM,wBAAwB,wGAAyF,CAAC;AAE/H,eAAO,MAAM,uBAAuB,6FAA8E,CAAC;AAEnH,eAAO,MAAM,iBAAiB,wLAAyK,CAAC;AAExM,eAAO,MAAM,wBAAwB,GAAI,UAAU,GAAG,WACwC,CAAC;AAE/F,eAAO,MAAM,yCAAyC,GAAI,IAAI,MAAM,WACoF,CAAC;AAEzJ,eAAO,MAAM,+BAA+B,GAAI,IAAI,MAAM,WAEmE,CAAC;AAE9H,eAAO,MAAM,uBAAuB,+EAAgE,CAAC;AAErG,eAAO,MAAM,oCAAoC,GAC/C,IAAI,MAAM,GAAG,SAAS,EACtB,MAAM,MAAM,WAOb,CAAC;AAEF,eAAO,MAAM,uBAAuB,uEAAwD,CAAC;AAE7F,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAW,WAC+F,CAAC;AAE/J,eAAO,MAAM,2BAA2B,GAAI,SAAQ,MAAW,WAC2F,CAAC;AAE3J,eAAO,MAAM,qBAAqB,GAAI,WAAW,MAAM,EAAE,EAAE,SAAS,MAAM,WACwB,CAAC;AAEnG,eAAO,MAAM,uBAAuB,GAClC,SAAS,MAAM,EACf,IAAI,MAAM,GAAG,SAAS,WAEuF,CAAC;AAEhH,eAAO,MAAM,4BAA4B,GACvC,QAAQ,MAAM,EACd,KAAK,MAAM,EACX,qBAAmB,WAIa,CAAC;AAEnC,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,EAAE,WAGwB,CAAC;AAE9E,eAAO,MAAM,4BAA4B,GAAI,SAAS,MAAM,EAAE,WACuD,CAAC;AAEtH,eAAO,MAAM,kBAAkB,cACqC,CAAC;AAErE,eAAO,MAAM,0BAA0B,GAAI,IAAI,MAAM,WACkB,CAAC;AAExE,eAAO,MAAM,0BAA0B,cAC8B,CAAC;AAEtE,eAAO,MAAM,sCAAsC,cACkB,CAAC;AAItE,eAAO,MAAM,uBAAuB,6IAA8H,CAAC;AAEnK,eAAO,MAAM,yBAAyB,GAAI,IAAI,MAAM,WACwB,CAAC;AAE7E,eAAO,MAAM,mCAAmC,GAAI,IAAI,MAAM,WACa,CAAC;AAE5E,eAAO,MAAM,+BAA+B,GAC1C,IAAI,MAAM,EACV,YAAY,MAAM,WAE8E,CAAC;AAEnG,eAAO,MAAM,4BAA4B,GACvC,cAAc,MAAM,EACpB,cAAc,MAAM,WAE2M,CAAC;AAElO,eAAO,MAAM,iBAAiB,QAGqF,CAAC;AAEpH,eAAO,MAAM,+BAA+B,GAAI,SAAS,MAAM,EAAE,WAMhD,CAAC;AAElB,eAAO,MAAM,gCAAgC,2EAA4D,CAAC;AAE1G,eAAO,MAAM,8BAA8B,GACzC,iBAAiB,MAAM,EACvB,WAAW,MAAM,EACjB,cAAa,MAAqB,WAOnC,CAAC;AAEF,eAAO,MAAM,wBAAwB,wIAAyH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invoked when a method that was designated for overriding is invoked by @generaltranslation/react-core.
|
|
3
|
+
* This is an internal library error due to incorrect implementation of a wrapper library.
|
|
4
|
+
* @param methodName
|
|
5
|
+
* @returns Error object
|
|
6
|
+
*/
|
|
7
|
+
export declare function createInternalUsageError(methodName: string): Error;
|
|
8
|
+
//# sourceMappingURL=internalErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internalErrors.d.ts","sourceRoot":"","sources":["../../src/errors-dir/internalErrors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,CAIlE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";require("generaltranslation");exports.createUnsupportedLocaleWarning=(o,r,e="@generaltranslation/react-core")=>`${e} Warning: You are trying to switch to "${r}" which is not supported. Update the list of supported locales through your dashboard or your config.json file if you are using a config file. Falling back to "${o}".`;
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAE3E,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"generaltranslation";const o=(o,t,r="@generaltranslation/react-core")=>`${r} Warning: You are trying to switch to "${t}" which is not supported. Update the list of supported locales through your dashboard or your config.json file if you are using a config file. Falling back to "${o}".`;export{o as createUnsupportedLocaleWarning};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the application's default locale from the `<GTProvider>` context.
|
|
3
|
+
*
|
|
4
|
+
* If no default locale is passed to the `<GTProvider>`, it defaults to providing 'en'.
|
|
5
|
+
*
|
|
6
|
+
* @returns {string} The application's default locale, e.g., 'en-US'.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const locale = useDefaultLocale();
|
|
10
|
+
* console.log(locale); // 'en-US'
|
|
11
|
+
*/
|
|
12
|
+
export default function useDefaultLocale(): string;
|
|
13
|
+
//# sourceMappingURL=useDefaultLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDefaultLocale.d.ts","sourceRoot":"","sources":["../../src/hooks/useDefaultLocale.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,IAAI,MAAM,CAIjD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LocaleProperties } from 'generaltranslation/types';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the configured GT class instance.
|
|
4
|
+
*
|
|
5
|
+
* @returns {GT} The configured GT class instance.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const gt = useGTClass();
|
|
9
|
+
* console.log(gt.getLocaleProperties('en-US'));
|
|
10
|
+
*/
|
|
11
|
+
export declare function useGTClass(): import("generaltranslation").GT;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the locale properties for the given locale.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} locale - The locale to get the properties for.
|
|
16
|
+
* @returns {LocaleProperties} The locale properties for the given locale.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const localeProperties = useLocaleProperties('en-US');
|
|
20
|
+
* console.log(localeProperties);
|
|
21
|
+
*/
|
|
22
|
+
export declare function useLocaleProperties(locale: string): LocaleProperties;
|
|
23
|
+
//# sourceMappingURL=useGTClass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGTClass.d.ts","sourceRoot":"","sources":["../../src/hooks/useGTClass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;;;;;;GAQG;AACH,wBAAgB,UAAU,oCAIzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAGpE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the user's locale from the `<GTProvider>` context.
|
|
3
|
+
*
|
|
4
|
+
* @returns {string} The user's locale, e.g., 'en-US'.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const locale = useLocale();
|
|
8
|
+
* console.log(locale); // 'en-US'
|
|
9
|
+
*/
|
|
10
|
+
export default function useLocale(): string;
|
|
11
|
+
//# sourceMappingURL=useLocale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../src/hooks/useLocale.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,IAAI,MAAM,CAI1C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the text direction ('ltr' or 'rtl') for the current or specified locale from the `<GTProvider>` context.
|
|
3
|
+
*
|
|
4
|
+
* If no locale is provided, the direction for the current user's locale is returned.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} [locale] - Optional locale code (e.g., 'ar', 'en-US'). If omitted, uses the current locale from context.
|
|
7
|
+
* @returns {'ltr' | 'rtl'} The text direction for the locale: 'rtl' for right-to-left languages, otherwise 'ltr'.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const dir = useLocaleDirection(); // e.g., 'ltr'
|
|
11
|
+
* const arabicDir = useLocaleDirection('ar'); // 'rtl'
|
|
12
|
+
*/
|
|
13
|
+
export declare function useLocaleDirection(locale?: string): 'ltr' | 'rtl';
|
|
14
|
+
//# sourceMappingURL=useLocaleDirection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocaleDirection.d.ts","sourceRoot":"","sources":["../../src/hooks/useLocaleDirection.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,CAKjE"}
|