@adminforth/i18n 1.0.18-next.10 → 1.0.18-next.12

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.
@@ -18,21 +18,25 @@
18
18
  />
19
19
  </div>
20
20
 
21
- <div v-if="showDropdown" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm
22
- text-black dark:text-darkSidebarTextHover
23
- bg-black bg-opacity-10
24
- hover:bg-html dark:hover:bg-darkSidebarItemHover dark:hover:text-darkSidebarTextActive
25
- w-full text-select-none pl-5 select-none"
26
- v-for="option in options.filter((opt) => opt.value !== selectedOption.value)"
27
- @click="doChangeLang(option.value)"
28
- >
29
- <span class="mr-1">
30
- <span class="flag-icon"
31
- :class="`flag-icon-${getCountryCodeFromLangCode(option.value)}`"
32
- ></span>
33
- </span>
34
- <span>{{ option.label }}</span>
35
-
21
+ <div v-if="showDropdown" >
22
+
23
+ <div class="cursor-pointer flex items-center gap-1 block px-4 py-1 text-sm
24
+ text-black dark:text-darkSidebarTextHover
25
+ bg-black bg-opacity-10
26
+ hover:brightness-110
27
+ hover:bg-lightPrimaryContrast dark:hover:bg-darkPrimaryContrasts
28
+ w-full text-select-none pl-5 select-none"
29
+ v-for="option in options.filter((opt) => opt.value !== selectedOption.value)"
30
+ @click="doChangeLang(option.value)"
31
+ >
32
+ <span class="mr-1">
33
+ <span class="flag-icon"
34
+ :class="`flag-icon-${getCountryCodeFromLangCode(option.value)}`"
35
+ ></span>
36
+ </span>
37
+ <span>{{ option.label }}</span>
38
+
39
+ </div>
36
40
  </div>
37
41
 
38
42
 
@@ -18,21 +18,25 @@
18
18
  />
19
19
  </div>
20
20
 
21
- <div v-if="showDropdown" class="cursor-pointer flex items-center gap-1 block px-4 py-2 text-sm
22
- text-black dark:text-darkSidebarTextHover
23
- bg-black bg-opacity-10
24
- hover:bg-html dark:hover:bg-darkSidebarItemHover dark:hover:text-darkSidebarTextActive
25
- w-full text-select-none pl-5 select-none"
26
- v-for="option in options.filter((opt) => opt.value !== selectedOption.value)"
27
- @click="doChangeLang(option.value)"
28
- >
29
- <span class="mr-1">
30
- <span class="flag-icon"
31
- :class="`flag-icon-${getCountryCodeFromLangCode(option.value)}`"
32
- ></span>
33
- </span>
34
- <span>{{ option.label }}</span>
35
-
21
+ <div v-if="showDropdown" >
22
+
23
+ <div class="cursor-pointer flex items-center gap-1 block px-4 py-1 text-sm
24
+ text-black dark:text-darkSidebarTextHover
25
+ bg-black bg-opacity-10
26
+ hover:brightness-110
27
+ hover:bg-lightPrimaryContrast dark:hover:bg-darkPrimaryContrasts
28
+ w-full text-select-none pl-5 select-none"
29
+ v-for="option in options.filter((opt) => opt.value !== selectedOption.value)"
30
+ @click="doChangeLang(option.value)"
31
+ >
32
+ <span class="mr-1">
33
+ <span class="flag-icon"
34
+ :class="`flag-icon-${getCountryCodeFromLangCode(option.value)}`"
35
+ ></span>
36
+ </span>
37
+ <span>{{ option.label }}</span>
38
+
39
+ </div>
36
40
  </div>
37
41
 
38
42
 
package/dist/index.js CHANGED
@@ -292,7 +292,6 @@ export default class I18N extends AdminForthPlugin {
292
292
  }
293
293
  throw e;
294
294
  }
295
- process.env.HEAVY_DEBUG && console.log('🪲bulkTranslate done', translatedCount);
296
295
  this.updateUntranslatedMenuBadge();
297
296
  return {
298
297
  ok: true,
@@ -360,10 +359,8 @@ ${JSON.stringify(strings.reduce((acc, s) => {
360
359
  }, {}), null, 2)}
361
360
  \`\`\`
362
361
  `;
363
- // process.env.HEAVY_DEBUG && console.log('🧠 llm prompt', prompt);
364
362
  // call OpenAI
365
363
  const resp = yield this.options.completeAdapter.complete(prompt, [], 300);
366
- // process.env.HEAVY_DEBUG && console.log('🧠 llm resp', resp);
367
364
  if (resp.error) {
368
365
  throw new AiTranslateError(resp.error);
369
366
  }
@@ -432,20 +429,14 @@ ${JSON.stringify(strings.reduce((acc, s) => {
432
429
  const updateStrings = {};
433
430
  const langsInvolved = new Set(Object.keys(needToTranslateByLang));
434
431
  let totalTranslated = [];
435
- process.env.HEAVY_DEBUG && console.log(' 🐛starting Promise.all Object.entries(needToTranslateByLang)');
436
432
  yield Promise.all(Object.entries(needToTranslateByLang).map((_b) => __awaiter(this, [_b], void 0, function* ([lang, strings]) {
437
433
  // first translate without plurals
438
434
  const stringsWithoutPlurals = strings.filter(s => !s.en_string.includes('|'));
439
- process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} noplurals started ${stringsWithoutPlurals.length}`);
440
435
  const noPluralKeys = yield this.translateToLang(lang, stringsWithoutPlurals, false, translations, updateStrings);
441
- process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} noplurals finished`);
442
436
  const stringsWithPlurals = strings.filter(s => s.en_string.includes('|'));
443
- process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} plurals started ${stringsWithPlurals.length}`);
444
437
  const pluralKeys = yield this.translateToLang(lang, stringsWithPlurals, true, translations, updateStrings);
445
- process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} plurals finished`);
446
438
  totalTranslated = totalTranslated.concat(noPluralKeys, pluralKeys);
447
439
  })));
448
- process.env.HEAVY_DEBUG && console.log('✅ updateStrings were formed', (new Set(totalTranslated)));
449
440
  yield Promise.all(Object.entries(updateStrings).map((_c) => __awaiter(this, [_c], void 0, function* ([_, { updates, strId }]) {
450
441
  // because this will translate all languages, we can set completedLangs to all languages
451
442
  const futureCompletedFieldValue = this.fullCompleatedFieldValue;
package/index.ts CHANGED
@@ -335,7 +335,6 @@ export default class I18N extends AdminForthPlugin {
335
335
  }
336
336
  throw e;
337
337
  }
338
- process.env.HEAVY_DEBUG && console.log('🪲bulkTranslate done', translatedCount);
339
338
  this.updateUntranslatedMenuBadge();
340
339
  return {
341
340
  ok: true,
@@ -414,8 +413,6 @@ JSON.stringify(strings.reduce((acc: object, s: { en_string: string }): object =>
414
413
  \`\`\`
415
414
  `;
416
415
 
417
- // process.env.HEAVY_DEBUG && console.log('🧠 llm prompt', prompt);
418
-
419
416
  // call OpenAI
420
417
  const resp = await this.options.completeAdapter.complete(
421
418
  prompt,
@@ -423,8 +420,6 @@ JSON.stringify(strings.reduce((acc: object, s: { en_string: string }): object =>
423
420
  300,
424
421
  );
425
422
 
426
- // process.env.HEAVY_DEBUG && console.log('🧠 llm resp', resp);
427
-
428
423
  if (resp.error) {
429
424
  throw new AiTranslateError(resp.error);
430
425
  }
@@ -518,31 +513,24 @@ JSON.stringify(strings.reduce((acc: object, s: { en_string: string }): object =>
518
513
  const langsInvolved = new Set(Object.keys(needToTranslateByLang));
519
514
 
520
515
  let totalTranslated = [];
521
- process.env.HEAVY_DEBUG && console.log(' 🐛starting Promise.all Object.entries(needToTranslateByLang)');
522
516
 
523
517
  await Promise.all(
524
518
  Object.entries(needToTranslateByLang).map(
525
519
  async ([lang, strings]: [LanguageCode, { en_string: string, category: string }[]]) => {
526
520
  // first translate without plurals
527
521
  const stringsWithoutPlurals = strings.filter(s => !s.en_string.includes('|'));
528
- process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} noplurals started ${stringsWithoutPlurals.length}`);
529
522
  const noPluralKeys = await this.translateToLang(lang, stringsWithoutPlurals, false, translations, updateStrings);
530
- process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} noplurals finished`);
531
523
 
532
524
 
533
525
  const stringsWithPlurals = strings.filter(s => s.en_string.includes('|'));
534
526
 
535
- process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} plurals started ${stringsWithPlurals.length}`);
536
527
  const pluralKeys = await this.translateToLang(lang, stringsWithPlurals, true, translations, updateStrings);
537
- process.env.HEAVY_DEBUG && console.log(`🔗 ${lang} plurals finished`);
538
528
 
539
529
  totalTranslated = totalTranslated.concat(noPluralKeys, pluralKeys);
540
530
  }
541
531
  )
542
532
  );
543
533
 
544
- process.env.HEAVY_DEBUG && console.log('✅ updateStrings were formed', (new Set(totalTranslated)));
545
-
546
534
  await Promise.all(
547
535
  Object.entries(updateStrings).map(
548
536
  async ([_, { updates, strId }]: [string, { updates: any, category: string, strId: string }]) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/i18n",
3
- "version": "1.0.18-next.10",
3
+ "version": "1.0.18-next.12",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",