@adminforth/i18n 1.0.18-next.3 → 1.0.18-next.4
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/dist/index.js +7 -2
- package/index.ts +12 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -422,20 +422,25 @@ ${JSON.stringify(strings.reduce((acc, s) => {
|
|
|
422
422
|
yield Promise.all(Object.entries(needToTranslateByLang).map((_b) => __awaiter(this, [_b], void 0, function* ([lang, strings]) {
|
|
423
423
|
// first translate without plurals
|
|
424
424
|
const stringsWithoutPlurals = strings.filter(s => !s.en_string.includes('|'));
|
|
425
|
+
process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} noplurals started ${stringsWithoutPlurals.length}`);
|
|
425
426
|
const noPluralKeys = yield translateToLang(lang, stringsWithoutPlurals, false);
|
|
427
|
+
process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} noplurals finished`);
|
|
426
428
|
const stringsWithPlurals = strings.filter(s => s.en_string.includes('|'));
|
|
429
|
+
process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} plurals started ${stringsWithPlurals.length}`);
|
|
427
430
|
const pluralKeys = yield translateToLang(lang, stringsWithPlurals, true);
|
|
431
|
+
process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} plurals finished`);
|
|
428
432
|
totalTranslated = totalTranslated.concat(noPluralKeys, pluralKeys);
|
|
429
433
|
})));
|
|
434
|
+
process.env.HEAVY_DEBUG && console.log('updateStrings were formed', totalTranslated);
|
|
430
435
|
yield Promise.all(Object.entries(updateStrings).map((_c) => __awaiter(this, [_c], void 0, function* ([_, { updates, strId }]) {
|
|
431
436
|
// because this will translate all languages, we can set completedLangs to all languages
|
|
432
437
|
const futureCompletedFieldValue = this.fullCompleatedFieldValue;
|
|
433
438
|
yield this.adminforth.resource(this.resourceConfig.resourceId).update(strId, Object.assign(Object.assign({}, updates), { [this.options.completedFieldName]: futureCompletedFieldValue }));
|
|
434
439
|
})));
|
|
435
440
|
for (const lang of langsInvolved) {
|
|
436
|
-
this.cache.clear(`${this.resourceConfig.resourceId}:frontend:${lang}`);
|
|
441
|
+
yield this.cache.clear(`${this.resourceConfig.resourceId}:frontend:${lang}`);
|
|
437
442
|
for (const [enStr, { category }] of Object.entries(updateStrings)) {
|
|
438
|
-
this.cache.clear(`${this.resourceConfig.resourceId}:${category}:${lang}:${enStr}`);
|
|
443
|
+
yield this.cache.clear(`${this.resourceConfig.resourceId}:${category}:${lang}:${enStr}`);
|
|
439
444
|
}
|
|
440
445
|
}
|
|
441
446
|
return new Set(totalTranslated).size;
|
package/index.ts
CHANGED
|
@@ -503,12 +503,21 @@ ${
|
|
|
503
503
|
await Promise.all(Object.entries(needToTranslateByLang).map(async ([lang, strings]: [LanguageCode, { en_string: string, category: string }[]]) => {
|
|
504
504
|
// first translate without plurals
|
|
505
505
|
const stringsWithoutPlurals = strings.filter(s => !s.en_string.includes('|'));
|
|
506
|
+
process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} noplurals started ${stringsWithoutPlurals.length}`);
|
|
506
507
|
const noPluralKeys = await translateToLang(lang, stringsWithoutPlurals, false);
|
|
508
|
+
process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} noplurals finished`);
|
|
509
|
+
|
|
507
510
|
|
|
508
511
|
const stringsWithPlurals = strings.filter(s => s.en_string.includes('|'));
|
|
512
|
+
|
|
513
|
+
process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} plurals started ${stringsWithPlurals.length}`);
|
|
509
514
|
const pluralKeys = await translateToLang(lang, stringsWithPlurals, true);
|
|
515
|
+
process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} plurals finished`);
|
|
516
|
+
|
|
510
517
|
totalTranslated = totalTranslated.concat(noPluralKeys, pluralKeys);
|
|
511
|
-
}));
|
|
518
|
+
}));
|
|
519
|
+
|
|
520
|
+
process.env.HEAVY_DEBUG && console.log('updateStrings were formed', totalTranslated);
|
|
512
521
|
|
|
513
522
|
await Promise.all(
|
|
514
523
|
Object.entries(updateStrings).map(
|
|
@@ -525,9 +534,9 @@ ${
|
|
|
525
534
|
);
|
|
526
535
|
|
|
527
536
|
for (const lang of langsInvolved) {
|
|
528
|
-
this.cache.clear(`${this.resourceConfig.resourceId}:frontend:${lang}`);
|
|
537
|
+
await this.cache.clear(`${this.resourceConfig.resourceId}:frontend:${lang}`);
|
|
529
538
|
for (const [enStr, { category }] of Object.entries(updateStrings)) {
|
|
530
|
-
this.cache.clear(`${this.resourceConfig.resourceId}:${category}:${lang}:${enStr}`);
|
|
539
|
+
await this.cache.clear(`${this.resourceConfig.resourceId}:${category}:${lang}:${enStr}`);
|
|
531
540
|
}
|
|
532
541
|
}
|
|
533
542
|
|