i18nexus-cli 3.2.0 → 3.3.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 +23 -10
- package/commands/pull.js +14 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,9 +32,11 @@ The commands below have options that can be set with environment variables. Sinc
|
|
|
32
32
|
i18nexus pull -k <PROJECT_API_KEY>
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
The above snippet will download all of your latest translations to your current directory. Your translation files will be downloaded in a file structure based on the convention of your i18n library
|
|
35
|
+
The above snippet will download all of your latest translations to your current directory. Your translation files will be downloaded in a file structure based on the convention of your i18n library.
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
### Default download path:
|
|
38
|
+
|
|
39
|
+
If your i18nexus project is set to **`i18next`**:
|
|
38
40
|
|
|
39
41
|
```
|
|
40
42
|
.
|
|
@@ -46,7 +48,18 @@ If your i18nexus project is set to `i18next`:
|
|
|
46
48
|
└── common.json
|
|
47
49
|
```
|
|
48
50
|
|
|
49
|
-
If your i18nexus project is set to
|
|
51
|
+
If your i18nexus project is set to **`i18next`** and the CLI detects you're using **Next.js + App Router**:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
.
|
|
55
|
+
└── locales
|
|
56
|
+
├── en
|
|
57
|
+
| └── common.json
|
|
58
|
+
└── de
|
|
59
|
+
└── common.json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
If your i18nexus project is set to **`next-intl`**:
|
|
50
63
|
|
|
51
64
|
```
|
|
52
65
|
.
|
|
@@ -55,7 +68,7 @@ If your i18nexus project is set to `next-intl`:
|
|
|
55
68
|
└── de.json
|
|
56
69
|
```
|
|
57
70
|
|
|
58
|
-
If your i18nexus project is set to
|
|
71
|
+
If your i18nexus project is set to **`react-intl`**:
|
|
59
72
|
|
|
60
73
|
```
|
|
61
74
|
.
|
|
@@ -71,12 +84,12 @@ If you wish to download your files to a different directory, you can use the `--
|
|
|
71
84
|
|
|
72
85
|
### Options
|
|
73
86
|
|
|
74
|
-
| Option | Default value
|
|
75
|
-
| ------------------- |
|
|
76
|
-
| `--api-key` or `-k` |
|
|
77
|
-
| `--path` or `-p` |
|
|
78
|
-
| `--ver` or `-v` | `latest`
|
|
79
|
-
| `--clean` | `false`
|
|
87
|
+
| Option | Default value |
|
|
88
|
+
| ------------------- | ------------- |
|
|
89
|
+
| `--api-key` or `-k` | |
|
|
90
|
+
| `--path` or `-p` | (See above) |
|
|
91
|
+
| `--ver` or `-v` | `latest` |
|
|
92
|
+
| `--clean` | `false` |
|
|
80
93
|
|
|
81
94
|
### Notes
|
|
82
95
|
|
package/commands/pull.js
CHANGED
|
@@ -40,7 +40,20 @@ const pull = async opt => {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
if (projectLibrary === 'i18next') {
|
|
43
|
-
|
|
43
|
+
const hasAppDir =
|
|
44
|
+
fs.existsSync(`${process.cwd()}/app`) ||
|
|
45
|
+
fs.existsSync(`${process.cwd()}/src/app`);
|
|
46
|
+
const usingAppRouter =
|
|
47
|
+
hasAppDir &&
|
|
48
|
+
(fs.existsSync(`${process.cwd()}/.next`) ||
|
|
49
|
+
fs.existsSync(`${process.cwd()}/next.config.js`) ||
|
|
50
|
+
fs.existsSync(`${process.cwd()}/next.config.ts`));
|
|
51
|
+
|
|
52
|
+
if (usingAppRouter) {
|
|
53
|
+
path = `${process.cwd()}/locales`;
|
|
54
|
+
} else {
|
|
55
|
+
path = `${process.cwd()}/public/locales`;
|
|
56
|
+
}
|
|
44
57
|
} else {
|
|
45
58
|
path = `${process.cwd()}/messages`;
|
|
46
59
|
}
|