sheet-i18n 1.4.0 → 1.5.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.
Files changed (2) hide show
  1. package/README.md +25 -5
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -205,10 +205,18 @@ import { I18nStore } from '@sheet-i18n/react';
205
205
  export const i18nStore = new I18nStore({
206
206
  supportedLocales: ['ko', 'en'],
207
207
  defaultLocale: 'ko',
208
+
209
+ /** if you want to load translation data statically */
208
210
  localeSet: {
209
211
  ko,
210
212
  en,
211
213
  },
214
+
215
+ /** if you want to load translation data dynamically */
216
+ // dynamicLoaders: {
217
+ // ko: () => import('./ko.json'),
218
+ // en: () => import('./en.json'),
219
+ // },
212
220
  });
213
221
  ```
214
222
 
@@ -266,8 +274,17 @@ The `I18nStore` manages type-safe translation states, ensuring consistency acros
266
274
  #### Parameters:
267
275
 
268
276
  - **`supportedLocales`**: Array of supported locale strings.
277
+ <br/>
278
+ <br/>
269
279
  - **`defaultLocale`**: The default locale, included in `supportedLocales`.
270
- - **`localeSet`**: An object where keys match `supportedLocales`, and values are translation sets.
280
+ <br/>
281
+ <br/>
282
+ - **`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`.
283
+ <br/>
284
+ <br/>
285
+ - **`dynamicLoaders(optional. choice 2)`**: An object where keys match `supportedLocales`, and values are dynamic translation loader functions.
286
+ <br/>
287
+ <br/>
271
288
  - **`typeSafe(optional, default = false)`**: An optional boolean indicating whether to use type-safe translations.
272
289
 
273
290
  > 💡 **typeSafe?** <br/>
@@ -300,15 +317,18 @@ The `I18nStore` manages type-safe translation states, ensuring consistency acros
300
317
  export const i18nStore = new I18nStore({
301
318
  supportedLocales: ['ko', 'en'],
302
319
  defaultLocale: 'ko',
320
+ /** if you want to load translation data statically */
303
321
  localeSet: {
304
322
  ko,
305
323
  en,
306
324
  },
307
- });
308
325
 
309
- // Accessing properties
310
- i18nStore.supportedLocales; // ['ko', 'en']
311
- i18nStore.defaultLocale; // 'ko'
326
+ /** if you want to load translation data dynamically */
327
+ // dynamicLoaders: {
328
+ // ko: () => import('./ko.json'),
329
+ // en: () => import('./en.json'),
330
+ // },
331
+ });
312
332
  ```
313
333
 
314
334
  ### `createI18nContext`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sheet-i18n",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/chltjdrhd777/sheet-i18n"
@@ -36,13 +36,13 @@
36
36
  },
37
37
  "license": "ISC",
38
38
  "dependencies": {
39
- "@sheet-i18n/react": "1.1.0",
40
- "@sheet-i18n/importer": "1.4.0"
39
+ "@sheet-i18n/importer": "1.5.0",
40
+ "@sheet-i18n/react": "1.2.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "tsup": "^6.0.0",
44
44
  "typescript": "^5.0.0",
45
- "@sheet-i18n/typescript-config": "1.4.0"
45
+ "@sheet-i18n/typescript-config": "1.5.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsup",