@sheet-i18n/react 1.1.0-canary.5 → 1.1.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/README.md +5 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -112,20 +112,20 @@ The `I18nStore` manages type-safe translation states, ensuring consistency acros
|
|
|
112
112
|
- **`supportedLocales`**: Array of supported locale strings.
|
|
113
113
|
- **`defaultLocale`**: The default locale, included in `supportedLocales`.
|
|
114
114
|
- **`localeSet`**: An object where keys match `supportedLocales`, and values are translation sets.
|
|
115
|
-
- **`typeSafe(optional, default =
|
|
115
|
+
- **`typeSafe(optional, default = false)`**: An optional boolean indicating whether to use type-safe translations.
|
|
116
116
|
|
|
117
117
|
> 💡 **typeSafe?** <br/>
|
|
118
|
-
> I18nStore
|
|
118
|
+
> I18nStore doesn't enforce adherence to your locale JSON definitions by default. This means that you can add translation data even if it isn’t pre-defined in your locale JSON files. However, if you prefer to enforce strict type-safety, you can manually enable the typeSafe option which allows you to notice the auto-completed list in translation data.
|
|
119
119
|
>
|
|
120
120
|
> ```tsx
|
|
121
|
-
> // typeSafe:
|
|
121
|
+
> // typeSafe: true
|
|
122
122
|
> const YourComponent = () => {
|
|
123
|
-
> // useTranslation
|
|
123
|
+
> // "useTranslation" shows the autocompletion suggestions
|
|
124
124
|
> const { t } = useTranslation('header');
|
|
125
125
|
>
|
|
126
126
|
> return (
|
|
127
127
|
> <div>
|
|
128
|
-
> {/* t
|
|
128
|
+
> {/* "t" function shows the autocompletion suggestions */}
|
|
129
129
|
> <button>{t('login')}</button>
|
|
130
130
|
> </div>
|
|
131
131
|
> );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheet-i18n/react",
|
|
3
|
-
"version": "1.1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "i18n client logic based on react",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"license": "ISC",
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@swc/core": "^1.10.2",
|
|
32
|
-
"@sheet-i18n/typescript-config": "1.4.0
|
|
32
|
+
"@sheet-i18n/typescript-config": "1.4.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@sheet-i18n/react-core": "1.1.0
|
|
36
|
-
"@sheet-i18n/react-client": "1.1.0
|
|
35
|
+
"@sheet-i18n/react-core": "1.1.0",
|
|
36
|
+
"@sheet-i18n/react-client": "1.1.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsup",
|