@ttoss/react-i18n 1.25.4 → 1.25.5

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 +7 -6
  2. package/package.json +4 -7
package/README.md CHANGED
@@ -11,26 +11,27 @@ You should declare your messages as describe in the [FormatJS](https://formatjs.
11
11
  ### Install @ttoss/react-i18n
12
12
 
13
13
  ```shell
14
- yarn add @ttoss/react-i18n @ttoss/i18n-cli
14
+ pnpm add @ttoss/react-i18n
15
+ pnpm add -D @ttoss/i18n-cli
15
16
  ```
16
17
 
17
18
  To extract and compile your translations, check the [ttoss/i18n-cli](./i18n-cli/) documentation.
18
19
 
19
20
  ## Examples of use
20
21
 
21
- ### Index.tsx
22
+ ### index.tsx
22
23
 
23
- Import the I18nProvider and wrap your application with it. Add to it a function called `loadLocaleData` to load all the translation data.
24
+ Import the `I18nProvider` and wrap your application with it. Add to it a function called `loadLocaleData` to load all the translation data.
24
25
 
25
26
  ```tsx title="src/index.tsx"
26
27
  import { I18nProvider, LoadLocaleData } from '@ttoss/react-i18n';
27
28
 
28
- const loadLocaleData: LoadLocaleData = (locale) => {
29
+ const loadLocaleData: LoadLocaleData = async (locale) => {
29
30
  switch (locale) {
30
31
  case 'pt-BR':
31
- return import('../i18n/compiled-lang/pt-BR.json');
32
+ return import('../i18n/compiled/pt-BR.json');
32
33
  default:
33
- return import('../i18n/compiled-lang/en.json');
34
+ return import('../i18n/compiled/en.json');
34
35
  }
35
36
  };
36
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/react-i18n",
3
- "version": "1.25.4",
3
+ "version": "1.25.5",
4
4
  "author": "ttoss",
5
5
  "contributors": [
6
6
  "Pedro Arantes <arantespp@gmail.com> (https://arantespp.com)",
@@ -31,7 +31,7 @@
31
31
  "jest": "^29.7.0",
32
32
  "tsup": "^8.0.1",
33
33
  "@ttoss/config": "^1.31.3",
34
- "@ttoss/i18n-cli": "^0.7.3",
34
+ "@ttoss/i18n-cli": "^0.7.4",
35
35
  "@ttoss/test-utils": "^2.0.2"
36
36
  },
37
37
  "keywords": [
@@ -46,11 +46,8 @@
46
46
  "scripts": {
47
47
  "build": "tsup",
48
48
  "dev": "pnpm workspace @ttoss/storybook run dev",
49
- "pretest:compile": "pnpm run pretest:compile:en && pnpm run pretest:compile:ptBR",
50
- "pretest:compile:en": "formatjs compile i18n/lang/en.json --ast --out-file i18n/compiled/en.json",
51
- "pretest:compile:ptBR": "formatjs compile i18n/lang/pt-BR.json --ast --out-file i18n/compiled/pt-BR.json",
52
- "pretest:extract": "formatjs extract 'tests/**/*.ts*' --out-file i18n/lang/en.json",
53
- "pretest": "pnpm run pretest:extract && pnpm run pretest:compile",
49
+ "i18n": "ttoss-i18n --pattern './tests/**/*.test.tsx'",
50
+ "pretest": "pnpm run i18n",
54
51
  "test": "jest"
55
52
  }
56
53
  }