@ttoss/i18n-cli 0.6.5 → 0.7.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 +86 -7
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -11,25 +11,104 @@ You should declare your messages as describe in the [FormatJS](https://formatjs.
11
11
  ## Installation
12
12
 
13
13
  ```sh
14
- yarn add @ttoss/i18n-cli --dev
14
+ pnpm add @ttoss/i18n-cli --dev
15
+ ```
16
+
17
+ ## Setup
18
+
19
+ Add this script to your `package.json`
20
+
21
+ ```json
22
+ {
23
+ "scripts": {
24
+ "i18n": "ttoss-i18n",
25
+ "i18n:extract": "ttoss-i18n --no-compile",
26
+ "i18n:ignore-ttoss-pkg": "ttoss-i18n --ignore-ttoss-packages"
27
+ }
28
+ }
15
29
  ```
16
30
 
17
31
  ## Usage
18
32
 
19
- Extract only:
33
+ ### Extract only:
20
34
 
21
35
  ```sh
22
- yarn ttoss-i18n --no-compile
36
+ pnpm run i18n:extract
37
+ ```
38
+
39
+ This command extracts translations from your code but doesn't compile them. And created a new path (`i18n/lang/en.json`) if doesn't exists with extracted translations. As followed below:
40
+
41
+ - 📂 i18n
42
+ - 📂 lang
43
+ - 📄 en.json
44
+
45
+ ```json
46
+ // i18n/lang/en.json
47
+ {
48
+ "0XOzcH": {
49
+ "defaultMessage": "My title page",
50
+ "description": "Page title"
51
+ }
52
+ }
53
+ ```
54
+
55
+ To translate your text, you only need to duplicate the file `i18n/lang/en.json` to your new language and translate it, as followed below:
56
+
57
+ ```json
58
+ // i18n/lang/pt-BR.json
59
+ {
60
+ "0XOzcH": {
61
+ "defaultMessage": "Título da minha página",
62
+ "description": "Título da página"
63
+ }
64
+ }
23
65
  ```
24
66
 
25
- Extract and compile:
67
+ ### Extract and compile:
26
68
 
27
69
  ```sh
28
- yarn ttoss-i18n
70
+ pnpm run i18n
71
+ ```
72
+
73
+ This command extracts translations from your code and compiles them into a usable format. And create a new path (`i18n/compiled/en.json`) if doesn't exists with compiled translations based in all of the files on path `i18n/lang`. As followed below:
74
+
75
+ - 📂 i18n
76
+ - 📂 compiled
77
+ - 📄 en.json
78
+ - 📄 pt-BR.json
79
+
80
+ #### en.json
81
+
82
+ ```json
83
+ // i18n/compiled/en.json
84
+ {
85
+ "0XOzcH": [
86
+ {
87
+ "type": 0,
88
+ "value": "My title page"
89
+ }
90
+ ]
91
+ }
29
92
  ```
30
93
 
31
- Ignoring ttoss packages:
94
+ #### pt-BR.json
95
+
96
+ ```json
97
+ // i18n/compiled/pt-BR.json
98
+ {
99
+ "0XOzcH": [
100
+ {
101
+ "type": 0,
102
+ "value": "Título da minha página"
103
+ }
104
+ ]
105
+ }
106
+ ```
107
+
108
+ ### Ignoring ttoss packages:
32
109
 
33
110
  ```sh
34
- yarn ttoss-i18n --ignore-ttoss-packages
111
+ pnpm run i18n:ignore-ttoss-pkg
35
112
  ```
113
+
114
+ This command extracts and compiles translations, ignoring translations from all ttoss packages, if you have them installed in your project.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/i18n-cli",
3
- "version": "0.6.5",
3
+ "version": "0.7.0",
4
4
  "license": "UNLICENSED",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -23,8 +23,8 @@
23
23
  "glob": "^10.3.3"
24
24
  },
25
25
  "devDependencies": {
26
- "tsup": "^7.1.0",
27
- "@ttoss/config": "^1.30.6"
26
+ "tsup": "^7.2.0",
27
+ "@ttoss/config": "^1.31.0"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public",