i18next-cli 1.42.12 → 1.43.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 +7 -0
- package/dist/cjs/cli.js +3 -2
- package/dist/cjs/status.js +5 -3
- package/dist/esm/cli.js +3 -2
- package/dist/esm/status.js +5 -3
- package/package.json +1 -1
- package/types/cli.d.ts.map +1 -1
- package/types/status.d.ts +2 -0
- package/types/status.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -170,6 +170,7 @@ Displays a health check of your project's translation status. Can run without a
|
|
|
170
170
|
|
|
171
171
|
**Options:**
|
|
172
172
|
- `--namespace <ns>, -n <ns>`: Filter the report by a specific namespace.
|
|
173
|
+
- `--hide-translated`: Hide already translated keys in the detailed view, showing only missing translations.
|
|
173
174
|
|
|
174
175
|
**Usage Examples:**
|
|
175
176
|
|
|
@@ -185,6 +186,12 @@ npx i18next-cli status --namespace common
|
|
|
185
186
|
|
|
186
187
|
# Get a detailed report for the 'de' locale, showing only the 'common' namespace
|
|
187
188
|
npx i18next-cli status de --namespace common
|
|
189
|
+
|
|
190
|
+
# Show only the untranslated keys for the 'de' locale
|
|
191
|
+
npx i18next-cli status de --hide-translated
|
|
192
|
+
|
|
193
|
+
# Combine options to see only missing translations in a specific namespace
|
|
194
|
+
npx i18next-cli status de --namespace common --hide-translated
|
|
188
195
|
```
|
|
189
196
|
|
|
190
197
|
The detailed view provides a rich, at-a-glance summary for each namespace, followed by a list of every key and its translation status.
|
package/dist/cjs/cli.js
CHANGED
|
@@ -28,7 +28,7 @@ const program = new commander.Command();
|
|
|
28
28
|
program
|
|
29
29
|
.name('i18next-cli')
|
|
30
30
|
.description('A unified, high-performance i18next CLI.')
|
|
31
|
-
.version('1.
|
|
31
|
+
.version('1.43.0'); // This string is replaced with the actual version at build time by rollup
|
|
32
32
|
// new: global config override option
|
|
33
33
|
program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
|
|
34
34
|
program
|
|
@@ -96,6 +96,7 @@ program
|
|
|
96
96
|
.command('status [locale]')
|
|
97
97
|
.description('Display translation status. Provide a locale for a detailed key-by-key view.')
|
|
98
98
|
.option('-n, --namespace <ns>', 'Filter the status report by a specific namespace')
|
|
99
|
+
.option('--hide-translated', 'Hide already translated keys in the detailed view')
|
|
99
100
|
.action(async (locale, options) => {
|
|
100
101
|
const cfgPath = program.opts().config;
|
|
101
102
|
let config$1 = await config.loadConfig(cfgPath);
|
|
@@ -110,7 +111,7 @@ program
|
|
|
110
111
|
console.log(node_util.styleText('green', 'Project structure detected successfully!'));
|
|
111
112
|
config$1 = detected;
|
|
112
113
|
}
|
|
113
|
-
await status.runStatus(config$1, { detail: locale, namespace: options.namespace });
|
|
114
|
+
await status.runStatus(config$1, { detail: locale, namespace: options.namespace, hideTranslated: !!options.hideTranslated });
|
|
114
115
|
});
|
|
115
116
|
program
|
|
116
117
|
.command('types')
|
package/dist/cjs/status.js
CHANGED
|
@@ -218,7 +218,7 @@ async function generateStatusReport(config) {
|
|
|
218
218
|
*/
|
|
219
219
|
async function displayStatusReport(report, config, options) {
|
|
220
220
|
if (options.detail) {
|
|
221
|
-
await displayDetailedLocaleReport(report, config, options.detail, options.namespace);
|
|
221
|
+
await displayDetailedLocaleReport(report, config, options.detail, options.namespace, options.hideTranslated);
|
|
222
222
|
}
|
|
223
223
|
else if (options.namespace) {
|
|
224
224
|
await displayNamespaceSummaryReport(report, config, options.namespace);
|
|
@@ -240,8 +240,9 @@ async function displayStatusReport(report, config, options) {
|
|
|
240
240
|
* @param config - The i18next toolkit configuration object
|
|
241
241
|
* @param locale - The locale code to display details for
|
|
242
242
|
* @param namespaceFilter - Optional namespace to filter the display
|
|
243
|
+
* @param hideTranslated - When true, only untranslated keys are shown
|
|
243
244
|
*/
|
|
244
|
-
async function displayDetailedLocaleReport(report, config, locale, namespaceFilter) {
|
|
245
|
+
async function displayDetailedLocaleReport(report, config, locale, namespaceFilter, hideTranslated) {
|
|
245
246
|
if (locale === config.extract.primaryLanguage) {
|
|
246
247
|
console.log(node_util.styleText('yellow', `Locale "${locale}" is the primary language. All keys are considered present.`));
|
|
247
248
|
return;
|
|
@@ -265,7 +266,8 @@ async function displayDetailedLocaleReport(report, config, locale, namespaceFilt
|
|
|
265
266
|
continue;
|
|
266
267
|
console.log(node_util.styleText(['cyan', 'bold'], `\nNamespace: ${ns}`));
|
|
267
268
|
printProgressBar('Namespace Progress', nsData.translatedKeys, nsData.totalKeys);
|
|
268
|
-
nsData.keyDetails.
|
|
269
|
+
const keysToDisplay = hideTranslated ? nsData.keyDetails.filter(({ isTranslated }) => !isTranslated) : nsData.keyDetails;
|
|
270
|
+
keysToDisplay.forEach(({ key, isTranslated }) => {
|
|
269
271
|
const icon = isTranslated ? node_util.styleText('green', '✓') : node_util.styleText('red', '✗');
|
|
270
272
|
console.log(` ${icon} ${key}`);
|
|
271
273
|
});
|
package/dist/esm/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ const program = new Command();
|
|
|
26
26
|
program
|
|
27
27
|
.name('i18next-cli')
|
|
28
28
|
.description('A unified, high-performance i18next CLI.')
|
|
29
|
-
.version('1.
|
|
29
|
+
.version('1.43.0'); // This string is replaced with the actual version at build time by rollup
|
|
30
30
|
// new: global config override option
|
|
31
31
|
program.option('-c, --config <path>', 'Path to i18next-cli config file (overrides detection)');
|
|
32
32
|
program
|
|
@@ -94,6 +94,7 @@ program
|
|
|
94
94
|
.command('status [locale]')
|
|
95
95
|
.description('Display translation status. Provide a locale for a detailed key-by-key view.')
|
|
96
96
|
.option('-n, --namespace <ns>', 'Filter the status report by a specific namespace')
|
|
97
|
+
.option('--hide-translated', 'Hide already translated keys in the detailed view')
|
|
97
98
|
.action(async (locale, options) => {
|
|
98
99
|
const cfgPath = program.opts().config;
|
|
99
100
|
let config = await loadConfig(cfgPath);
|
|
@@ -108,7 +109,7 @@ program
|
|
|
108
109
|
console.log(styleText('green', 'Project structure detected successfully!'));
|
|
109
110
|
config = detected;
|
|
110
111
|
}
|
|
111
|
-
await runStatus(config, { detail: locale, namespace: options.namespace });
|
|
112
|
+
await runStatus(config, { detail: locale, namespace: options.namespace, hideTranslated: !!options.hideTranslated });
|
|
112
113
|
});
|
|
113
114
|
program
|
|
114
115
|
.command('types')
|
package/dist/esm/status.js
CHANGED
|
@@ -216,7 +216,7 @@ async function generateStatusReport(config) {
|
|
|
216
216
|
*/
|
|
217
217
|
async function displayStatusReport(report, config, options) {
|
|
218
218
|
if (options.detail) {
|
|
219
|
-
await displayDetailedLocaleReport(report, config, options.detail, options.namespace);
|
|
219
|
+
await displayDetailedLocaleReport(report, config, options.detail, options.namespace, options.hideTranslated);
|
|
220
220
|
}
|
|
221
221
|
else if (options.namespace) {
|
|
222
222
|
await displayNamespaceSummaryReport(report, config, options.namespace);
|
|
@@ -238,8 +238,9 @@ async function displayStatusReport(report, config, options) {
|
|
|
238
238
|
* @param config - The i18next toolkit configuration object
|
|
239
239
|
* @param locale - The locale code to display details for
|
|
240
240
|
* @param namespaceFilter - Optional namespace to filter the display
|
|
241
|
+
* @param hideTranslated - When true, only untranslated keys are shown
|
|
241
242
|
*/
|
|
242
|
-
async function displayDetailedLocaleReport(report, config, locale, namespaceFilter) {
|
|
243
|
+
async function displayDetailedLocaleReport(report, config, locale, namespaceFilter, hideTranslated) {
|
|
243
244
|
if (locale === config.extract.primaryLanguage) {
|
|
244
245
|
console.log(styleText('yellow', `Locale "${locale}" is the primary language. All keys are considered present.`));
|
|
245
246
|
return;
|
|
@@ -263,7 +264,8 @@ async function displayDetailedLocaleReport(report, config, locale, namespaceFilt
|
|
|
263
264
|
continue;
|
|
264
265
|
console.log(styleText(['cyan', 'bold'], `\nNamespace: ${ns}`));
|
|
265
266
|
printProgressBar('Namespace Progress', nsData.translatedKeys, nsData.totalKeys);
|
|
266
|
-
nsData.keyDetails.
|
|
267
|
+
const keysToDisplay = hideTranslated ? nsData.keyDetails.filter(({ isTranslated }) => !isTranslated) : nsData.keyDetails;
|
|
268
|
+
keysToDisplay.forEach(({ key, isTranslated }) => {
|
|
267
269
|
const icon = isTranslated ? styleText('green', '✓') : styleText('red', '✗');
|
|
268
270
|
console.log(` ${icon} ${key}`);
|
|
269
271
|
});
|
package/package.json
CHANGED
package/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAkBnC,QAAA,MAAM,OAAO,SAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAkBnC,QAAA,MAAM,OAAO,SAAgB,CAAA;AAqR7B,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
package/types/status.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ interface StatusOptions {
|
|
|
7
7
|
detail?: string;
|
|
8
8
|
/** Namespace to filter the report by */
|
|
9
9
|
namespace?: string;
|
|
10
|
+
/** When true, only untranslated keys are shown in the detailed view */
|
|
11
|
+
hideTranslated?: boolean;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Runs a health check on the project's i18next translations and displays a status report.
|
package/types/status.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,SAAS,CAAA;AAIjE;;GAEG;AACH,UAAU,aAAa;IACrB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,SAAS,CAAA;AAIjE;;GAEG;AACH,UAAU,aAAa;IACrB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AA4BD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO,GAAE,aAAkB,iBAuBzF"}
|