i18nexus-cli 3.3.1 → 3.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.
package/README.md CHANGED
@@ -6,14 +6,15 @@
6
6
 
7
7
  [i18nexus](https://i18nexus.com) is a translation management web application designed for use with i18next, next-intl, and react-intl. Learn more with these quick tutorials:
8
8
 
9
- - [next-i18next Walkthrough](https://i18nexus.com/tutorials/nextjs/next-i18next)
10
- - [next-intl Walkthrough](https://i18nexus.com/tutorials/nextjs/next-intl)
11
9
  - [react-i18next Walkthrough](https://i18nexus.com/tutorials/react/react-i18next)
12
10
  - [react-intl Walkthrough](https://i18nexus.com/tutorials/react/react-intl)
11
+ - [next-intl for Next.js App Router Walkthrough](https://i18nexus.com/tutorials/nextjs/next-intl)
12
+ - [react-i18next for Next.js App Router Walkthrough](https://i18nexus.com/tutorials/nextjs/react-i18next)
13
+ - [next-i18next for Next.js Pages Router Walkthrough](https://i18nexus.com/tutorials/nextjs/next-i18next)
13
14
 
14
15
  ## Who is this CLI meant for?
15
16
 
16
- - Developers who prefer to download and bundle their translation files with their app (especially useful for those who use SSR/SSG and libraries like Next.js).
17
+ - Developers who prefer to download and bundle their translation files with their app (especially useful for those who use SSR/SSG frameworks such as Next.js).
17
18
  - Developers who wish to add, edit, or delete strings in their i18nexus project from the command line.
18
19
 
19
20
  ## Installation
@@ -89,6 +90,7 @@ If you wish to download your files to a different directory, you can use the `--
89
90
  | `--api-key` or `-k` | |
90
91
  | `--path` or `-p` | (See above) |
91
92
  | `--ver` or `-v` | `latest` |
93
+ | `--confirmed` | `false` |
92
94
  | `--clean` | `false` |
93
95
 
94
96
  ### Notes
@@ -102,6 +104,9 @@ The path to the destination folder in which translation files will be downloaded
102
104
  `--ver`
103
105
  The version of your project's translations to be downloaded (Can also be set using environment variable `I18NEXUS_VERSION`)
104
106
 
107
+ `--confirmed`
108
+ Downloads only translations that have been confirmed in i18nexus
109
+
105
110
  `--clean`
106
111
  Before download, clears your destination folder specified in --path. As a safety precaution, this only deletes folders with names that match a simple language code regex. You should still ensure you are not storing any files in your destination folder that you do not want deleted.
107
112
 
@@ -125,14 +130,15 @@ Translations for the string will be automatically generated and machine translat
125
130
 
126
131
  ### Options
127
132
 
128
- | Option | Required? |
129
- | ---------------------- | --------- |
130
- | `--api-key` or `-k` | ✔ |
131
- | `--pat` or `-t` | ✔ |
132
- | `--namespace` or `-ns` | ✔ |
133
- | `--key` or `-K` | ✔ |
134
- | `--value` or `-v` | ✔ |
135
- | `--details` or `-d` | |
133
+ | Option | Required? |
134
+ | ---------------------------- | --------- |
135
+ | `--api-key` or `-k` | ✔ |
136
+ | `--pat` or `-t` | ✔ |
137
+ | `--namespace` or `-ns` | ✔ |
138
+ | `--key` or `-K` | ✔ |
139
+ | `--value` or `-v` | ✔ |
140
+ | `--details` or `-d` | |
141
+ | `--ai-instructions` or `-ai` | |
136
142
 
137
143
  ### Notes
138
144
 
@@ -154,6 +160,9 @@ The value of the string to create
154
160
  `--details`
155
161
  The details of the string to create (optional)
156
162
 
163
+ `--ai-instructions`
164
+ Instructions or context for AI machine translator (optional)
165
+
157
166
  ## Updating existing strings
158
167
 
159
168
  `i18nexus update-string <namespace> <key>` or `i18nexus u <namespace> <key>`
@@ -170,16 +179,17 @@ You can then update the key, value, details, and/or namespace by using the comma
170
179
 
171
180
  ### Options
172
181
 
173
- | Option | Required? |
174
- | ---------------------- | --------- |
175
- | `--api-key` or `-k` | &#10004; |
176
- | `--pat` or `-t` | &#10004; |
177
- | `--namespace` or `-ns` | |
178
- | `--key` or `-K` | |
179
- | `--value` or `-v` | |
180
- | `--details` or `-d` | |
181
- | `--reset-confirmed` | |
182
- | `--retain-confirmed` | |
182
+ | Option | Required? |
183
+ | ---------------------------- | --------- |
184
+ | `--api-key` or `-k` | &#10004; |
185
+ | `--pat` or `-t` | &#10004; |
186
+ | `--namespace` or `-ns` | |
187
+ | `--key` or `-K` | |
188
+ | `--value` or `-v` | |
189
+ | `--details` or `-d` | |
190
+ | `--ai-instructions` or `-ai` | |
191
+ | `--reset-confirmed` | |
192
+ | `--retain-confirmed` | |
183
193
 
184
194
  ### Notes
185
195
 
@@ -201,6 +211,9 @@ The new value of the string
201
211
  `--details`
202
212
  The new details of the string
203
213
 
214
+ `--ai-instructions`
215
+ Instructions or context for AI machine translator
216
+
204
217
  #### If you are updating the value of a string that contains translations that have been marked confirmed in i18nexus, you will be required to include one of the following options to your command:
205
218
 
206
219
  `--reset-confirmed`
package/bin/index.js CHANGED
@@ -36,6 +36,11 @@ program
36
36
  '-p, --path <path>',
37
37
  'The path to the destination folder in which translation files will be downloaded'
38
38
  )
39
+ .option(
40
+ '--confirmed',
41
+ 'Only downloads confirmed translations (Cannot be used with `version`)',
42
+ false
43
+ )
39
44
  .option(
40
45
  '--clean',
41
46
  'Removes and rebuilds destination folder before download',
@@ -46,7 +51,8 @@ program
46
51
  apiKey: options.apiKey,
47
52
  version: options.ver,
48
53
  path: options.path,
49
- clean: options.clean
54
+ clean: options.clean,
55
+ confirmed: options.confirmed
50
56
  });
51
57
  });
52
58
 
@@ -77,6 +83,10 @@ program
77
83
  '-d, --details <stringDetails>',
78
84
  'The details of the string to create (optional)'
79
85
  )
86
+ .option(
87
+ '-ai, --ai-instructions <stringAiInstructions>',
88
+ 'Instructions/Context for AI machine translator (optional)'
89
+ )
80
90
  .action(options => {
81
91
  addString({
82
92
  key: options.key,
@@ -84,7 +94,8 @@ program
84
94
  details: options.details,
85
95
  namespace: options.namespace,
86
96
  apiKey: options.apiKey,
87
- pat: options.pat
97
+ pat: options.pat,
98
+ aiInstructions: options.aiInstructions
88
99
  });
89
100
  });
90
101
 
@@ -109,6 +120,10 @@ program
109
120
  'The new namespace of the string'
110
121
  )
111
122
  .option('-d, --details <stringDetails>', 'The new details of the string')
123
+ .option(
124
+ '-ai, --ai-instructions <stringAiInstructions>',
125
+ 'Instructions/Context for AI machine translator (optional)'
126
+ )
112
127
  .option(
113
128
  '--reset-confirmed',
114
129
  'Reset confirmed translations of this string with machine translations.'
@@ -126,6 +141,7 @@ program
126
141
  key: options.key,
127
142
  value: options.value,
128
143
  details: options.details,
144
+ aiInstructions: options.aiInstructions,
129
145
  namespace: options.namespace,
130
146
  apiKey: options.apiKey,
131
147
  pat: options.pat,
@@ -14,7 +14,8 @@ const addString = async opt => {
14
14
  key: opt.key,
15
15
  value: opt.value,
16
16
  namespace: opt.namespace,
17
- description: opt.details
17
+ description: opt.details,
18
+ ai_instructions: opt.aiInstructions
18
19
  }),
19
20
  headers: {
20
21
  Authorization: `Bearer ${opt.pat}`,
package/commands/pull.js CHANGED
@@ -17,7 +17,7 @@ const cleanDirectory = path => {
17
17
 
18
18
  contents.forEach(name => {
19
19
  if (regex.test(name)) {
20
- fs.rmdirSync(`${path}/${name}`, { recursive: true });
20
+ fs.rmSync(`${path}/${name}`, { recursive: true });
21
21
  }
22
22
  });
23
23
  };
@@ -61,6 +61,11 @@ const pull = async opt => {
61
61
 
62
62
  const usingVersion = opt.version !== 'latest';
63
63
 
64
+ if (usingVersion && opt.confirmed) {
65
+ console.log(colors.red('The --confirmed flag cannot be used with version'));
66
+ return process.exit(1);
67
+ }
68
+
64
69
  console.log(`Downloading translations to ${path}...`);
65
70
 
66
71
  const lngResponse = await handleFetch(
@@ -91,6 +96,10 @@ const pull = async opt => {
91
96
 
92
97
  url += `?api_key=${opt.apiKey}`;
93
98
 
99
+ if (opt.confirmed) {
100
+ url += '&confirmed=true';
101
+ }
102
+
94
103
  const response = await handleFetch(url);
95
104
 
96
105
  if (response.status !== 200) {
@@ -29,6 +29,7 @@ const addString = async opt => {
29
29
  value: opt.value,
30
30
  namespace: opt.namespace,
31
31
  description: opt.details,
32
+ ai_instructions: opt.aiInstructions,
32
33
  reset_confirmed: resetConfirmed
33
34
  }),
34
35
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18nexus-cli",
3
- "version": "3.3.1",
3
+ "version": "3.5.0",
4
4
  "description": "Command line interface (CLI) for accessing the i18nexus API",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -9,7 +9,9 @@
9
9
  "keywords": [
10
10
  "i18nexus",
11
11
  "cli",
12
- "i18next"
12
+ "react-intl",
13
+ "i18next",
14
+ "next-intl"
13
15
  ],
14
16
  "author": "i18nexus",
15
17
  "license": "MIT",