@sheet-i18n/react 1.2.0-canary.0 → 1.2.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 +25 -5
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -49,10 +49,18 @@ import { I18nStore } from '@sheet-i18n/react';
|
|
|
49
49
|
export const i18nStore = new I18nStore({
|
|
50
50
|
supportedLocales: ['ko', 'en'],
|
|
51
51
|
defaultLocale: 'ko',
|
|
52
|
+
|
|
53
|
+
/** if you want to load translation data statically */
|
|
52
54
|
localeSet: {
|
|
53
55
|
ko,
|
|
54
56
|
en,
|
|
55
57
|
},
|
|
58
|
+
|
|
59
|
+
/** if you want to load translation data dynamically */
|
|
60
|
+
// dynamicLoaders: {
|
|
61
|
+
// ko: () => import('./ko.json'),
|
|
62
|
+
// en: () => import('./en.json'),
|
|
63
|
+
// },
|
|
56
64
|
});
|
|
57
65
|
```
|
|
58
66
|
|
|
@@ -110,8 +118,17 @@ The `I18nStore` manages type-safe translation states, ensuring consistency acros
|
|
|
110
118
|
#### Parameters:
|
|
111
119
|
|
|
112
120
|
- **`supportedLocales`**: Array of supported locale strings.
|
|
121
|
+
<br/>
|
|
122
|
+
<br/>
|
|
113
123
|
- **`defaultLocale`**: The default locale, included in `supportedLocales`.
|
|
114
|
-
|
|
124
|
+
<br/>
|
|
125
|
+
<br/>
|
|
126
|
+
- **`localeSet(optional. choice 1)`**: An object where keys match `supportedLocales`, and values are translation sets. If you want to use this option, you need to provide all static locale data according to the `supportedLocales`.
|
|
127
|
+
<br/>
|
|
128
|
+
<br/>
|
|
129
|
+
- **`dynamicLoaders(optional. choice 2)`**: An object where keys match `supportedLocales`, and values are dynamic translation loader functions.
|
|
130
|
+
<br/>
|
|
131
|
+
<br/>
|
|
115
132
|
- **`typeSafe(optional, default = false)`**: An optional boolean indicating whether to use type-safe translations.
|
|
116
133
|
|
|
117
134
|
> 💡 **typeSafe?** <br/>
|
|
@@ -144,15 +161,18 @@ The `I18nStore` manages type-safe translation states, ensuring consistency acros
|
|
|
144
161
|
export const i18nStore = new I18nStore({
|
|
145
162
|
supportedLocales: ['ko', 'en'],
|
|
146
163
|
defaultLocale: 'ko',
|
|
164
|
+
/** if you want to load translation data statically */
|
|
147
165
|
localeSet: {
|
|
148
166
|
ko,
|
|
149
167
|
en,
|
|
150
168
|
},
|
|
151
|
-
});
|
|
152
169
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
170
|
+
/** if you want to load translation data dynamically */
|
|
171
|
+
// dynamicLoaders: {
|
|
172
|
+
// ko: () => import('./ko.json'),
|
|
173
|
+
// en: () => import('./en.json'),
|
|
174
|
+
// },
|
|
175
|
+
});
|
|
156
176
|
```
|
|
157
177
|
|
|
158
178
|
### `createI18nContext`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheet-i18n/react",
|
|
3
|
-
"version": "1.2.0
|
|
3
|
+
"version": "1.2.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.5.0
|
|
32
|
+
"@sheet-i18n/typescript-config": "1.5.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@sheet-i18n/react-core": "1.2.0
|
|
36
|
-
"@sheet-i18n/react-client": "1.2.0
|
|
35
|
+
"@sheet-i18n/react-core": "1.2.0",
|
|
36
|
+
"@sheet-i18n/react-client": "1.2.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsup",
|