@taon-dev/i18n 21.0.23 → 21.0.25

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.
Files changed (121) hide show
  1. package/VERIFIED-BUILD-DATA.jsonc +4 -4
  2. package/bin/start.js +36 -36
  3. package/browser/README.md +24 -24
  4. package/browser/fesm2022/i18n-browser.mjs +199 -16
  5. package/browser/fesm2022/i18n-browser.mjs.map +1 -1
  6. package/browser/package.json +1 -1
  7. package/browser/types/i18n-browser.d.ts +33 -12
  8. package/browser-prod/README.md +24 -24
  9. package/browser-prod/fesm2022/i18n-browser-prod.mjs +197 -16
  10. package/browser-prod/fesm2022/i18n-browser-prod.mjs.map +1 -1
  11. package/browser-prod/package.json +1 -1
  12. package/browser-prod/types/i18n-browser-prod.d.ts +34 -13
  13. package/browser-prod.split-namespaces.json +5 -1
  14. package/html/assets/generated/pwa/html-pwa.html +53 -53
  15. package/lib/build-info._auto-generated_.d.ts +1 -1
  16. package/lib/build-info._auto-generated_.js +1 -1
  17. package/lib/i18n/lib.translation.d.ts +4 -0
  18. package/lib/i18n/lib.translation.js +5 -0
  19. package/lib/i18n/lib.translation.js.map +1 -0
  20. package/lib/i18n/translation.ts.en-US.i18n.data.d.ts +17 -0
  21. package/lib/i18n/translation.ts.en-US.i18n.data.js +23 -0
  22. package/lib/i18n/translation.ts.en-US.i18n.data.js.map +1 -0
  23. package/lib/i18n/translation.ts.pl-PL.i18n.data.d.ts +17 -0
  24. package/lib/i18n/translation.ts.pl-PL.i18n.data.js +23 -0
  25. package/lib/i18n/translation.ts.pl-PL.i18n.data.js.map +1 -0
  26. package/lib/index._auto-generated_.d.ts +2 -1
  27. package/lib/index._auto-generated_.js +1 -0
  28. package/lib/index._auto-generated_.js.map +1 -1
  29. package/lib/package.json +1 -1
  30. package/lib/translate.service.d.ts +0 -6
  31. package/lib/translation-manager.d.ts +2 -1
  32. package/lib/translation-manager.js +16 -3
  33. package/lib/translation-manager.js.map +1 -1
  34. package/lib/translation.d.ts +1 -1
  35. package/lib/translation.js +22 -15
  36. package/lib/translation.js.map +1 -1
  37. package/lib/utils-i18n-extract-gettext-translate-from-html.js +2 -2
  38. package/lib/utils-i18n-extract-gettext-translate-from-html.js.map +1 -1
  39. package/lib/utils-i18n-extract-gettext-translate-from-html.test.js +42 -0
  40. package/lib/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -1
  41. package/lib/utils-i18n-html.d.ts +5 -1
  42. package/lib/utils-i18n-html.js +127 -4
  43. package/lib/utils-i18n-html.js.map +1 -1
  44. package/lib/utils-i18n-html.test.js +35 -0
  45. package/lib/utils-i18n-html.test.js.map +1 -1
  46. package/lib-esm/app.electron.d.ts +1 -1
  47. package/lib-esm/app.electron.js +1 -1
  48. package/lib-esm/app.hosts.d.ts +3 -3
  49. package/lib-esm/app.hosts.js +8 -8
  50. package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
  51. package/lib-esm/lib/build-info._auto-generated_.js +1 -1
  52. package/lib-esm/lib/i18n/lib.translation.d.ts +4 -0
  53. package/lib-esm/lib/i18n/lib.translation.js +4 -0
  54. package/lib-esm/lib/i18n/lib.translation.js.map +1 -0
  55. package/lib-esm/lib/i18n/translation.ts.en-US.i18n.data.d.ts +17 -0
  56. package/lib-esm/lib/i18n/translation.ts.en-US.i18n.data.js +21 -0
  57. package/lib-esm/lib/i18n/translation.ts.en-US.i18n.data.js.map +1 -0
  58. package/lib-esm/lib/i18n/translation.ts.pl-PL.i18n.data.d.ts +17 -0
  59. package/lib-esm/lib/i18n/translation.ts.pl-PL.i18n.data.js +21 -0
  60. package/lib-esm/lib/i18n/translation.ts.pl-PL.i18n.data.js.map +1 -0
  61. package/lib-esm/lib/index._auto-generated_.d.ts +1 -0
  62. package/lib-esm/lib/index._auto-generated_.js +1 -0
  63. package/lib-esm/lib/index._auto-generated_.js.map +1 -1
  64. package/lib-esm/lib/translation-manager.d.ts +2 -1
  65. package/lib-esm/lib/translation-manager.js +16 -3
  66. package/lib-esm/lib/translation-manager.js.map +1 -1
  67. package/lib-esm/lib/translation.d.ts +3 -3
  68. package/lib-esm/lib/translation.js +22 -15
  69. package/lib-esm/lib/translation.js.map +1 -1
  70. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.js +1 -1
  71. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.js.map +1 -1
  72. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.js +42 -0
  73. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -1
  74. package/lib-esm/lib/utils-i18n-html.d.ts +5 -1
  75. package/lib-esm/lib/utils-i18n-html.js +126 -3
  76. package/lib-esm/lib/utils-i18n-html.js.map +1 -1
  77. package/lib-esm/lib/utils-i18n-html.test.js +35 -0
  78. package/lib-esm/lib/utils-i18n-html.test.js.map +1 -1
  79. package/lib-prod/build-info._auto-generated_.d.ts +1 -1
  80. package/lib-prod/build-info._auto-generated_.js +1 -1
  81. package/lib-prod/i18n/lib.translation.d.ts +4 -0
  82. package/lib-prod/i18n/lib.translation.js +4 -0
  83. package/lib-prod/i18n/lib.translation.js.map +1 -0
  84. package/lib-prod/i18n/translation.ts.en-US.i18n.data.d.ts +17 -0
  85. package/lib-prod/i18n/translation.ts.en-US.i18n.data.js +21 -0
  86. package/lib-prod/i18n/translation.ts.en-US.i18n.data.js.map +1 -0
  87. package/lib-prod/i18n/translation.ts.pl-PL.i18n.data.d.ts +17 -0
  88. package/lib-prod/i18n/translation.ts.pl-PL.i18n.data.js +21 -0
  89. package/lib-prod/i18n/translation.ts.pl-PL.i18n.data.js.map +1 -0
  90. package/lib-prod/index._auto-generated_.d.ts +1 -0
  91. package/lib-prod/index._auto-generated_.js +1 -0
  92. package/lib-prod/index._auto-generated_.js.map +1 -1
  93. package/lib-prod/package.json +1 -1
  94. package/lib-prod/translation-manager.d.ts +2 -1
  95. package/lib-prod/translation-manager.js +17 -4
  96. package/lib-prod/translation-manager.js.map +1 -1
  97. package/lib-prod/translation.d.ts +3 -3
  98. package/lib-prod/translation.js +22 -15
  99. package/lib-prod/translation.js.map +1 -1
  100. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.js +1 -1
  101. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.js.map +1 -1
  102. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.js +42 -0
  103. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -1
  104. package/lib-prod/utils-i18n-html.d.ts +5 -1
  105. package/lib-prod/utils-i18n-html.js +123 -2
  106. package/lib-prod/utils-i18n-html.js.map +1 -1
  107. package/lib-prod/utils-i18n-html.test.js +35 -0
  108. package/lib-prod/utils-i18n-html.test.js.map +1 -1
  109. package/lib-prod.split-namespaces.json +5 -1
  110. package/package.json +1 -1
  111. package/websql/README.md +24 -24
  112. package/websql/fesm2022/i18n-websql.mjs +199 -16
  113. package/websql/fesm2022/i18n-websql.mjs.map +1 -1
  114. package/websql/package.json +1 -1
  115. package/websql/types/i18n-websql.d.ts +33 -12
  116. package/websql-prod/README.md +24 -24
  117. package/websql-prod/fesm2022/i18n-websql-prod.mjs +197 -16
  118. package/websql-prod/fesm2022/i18n-websql-prod.mjs.map +1 -1
  119. package/websql-prod/package.json +1 -1
  120. package/websql-prod/types/i18n-websql-prod.d.ts +34 -13
  121. package/websql-prod.split-namespaces.json +5 -1
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { inject, ChangeDetectorRef, signal, ElementRef, DestroyRef, Input, Directive, Pipe, Injectable } from '@angular/core';
3
3
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
4
4
  import { BehaviorSubject, tap, map } from 'rxjs';
5
- import { UtilsI18n__NS__detectLocale, UtilsI18n__NS__defaultLangLocale, GlobalStorage, ___NS__cloneDeep, UtilsI18n__NS__LangOptionArr, ___NS__isObject } from 'tnp-core/browser-prod';
5
+ import { GlobalStorage, ___NS__isNil, UtilsI18n__NS__detectLocale, UtilsI18n__NS__defaultLangLocale, ___NS__cloneDeep, UtilsI18n__NS__LangOptionArr, ___NS__isObject } from 'tnp-core/browser-prod';
6
6
 
7
7
  // THIS FILE IS GENERATED - DO NOT MODIFY
8
8
  /**
@@ -28,7 +28,7 @@ const CURRENT_PACKAGE_TAON_VERSION = 'v21';
28
28
  /**
29
29
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
30
30
  */
31
- const CURRENT_PACKAGE_VERSION = '21.0.23';
31
+ const CURRENT_PACKAGE_VERSION = '21.0.25';
32
32
  // THIS FILE IS GENERATED - DO NOT MODIFY
33
33
 
34
34
  //#region tnp-helpers cli template
@@ -81,14 +81,24 @@ async function startCli(argsv, filename) {
81
81
  //#region constants
82
82
  const globalStorageKeyMainLanguage = 'taon-gettext-main-language';
83
83
  const globalTaonLanguageLocalKeyLocalStor = 'taon-language-local';
84
+ const TranslationManagerGlobalStorKey = 'TranslationManagerGlobalStorKey';
84
85
  //#endregion
85
86
  class TranslationManager {
87
+ // public instances = new Set<Translation>();
88
+ get instances() {
89
+ let set = GlobalStorage.get(TranslationManagerGlobalStorKey);
90
+ if (___NS__isNil(set)) {
91
+ GlobalStorage.set(TranslationManagerGlobalStorKey, new Set());
92
+ }
93
+ set = GlobalStorage.get(TranslationManagerGlobalStorKey);
94
+ return set;
95
+ }
86
96
  constructor() {
87
- this.instances = new Set();
88
97
  //#region current global language
89
98
  this.defaultLangLocale = (() => {
90
99
  //#region @browser
91
100
  return (localStorage.getItem(globalTaonLanguageLocalKeyLocalStor) ||
101
+ TranslationManager.globalDefautlLanguageOverride ||
92
102
  UtilsI18n__NS__detectLocale());
93
103
  //#endregion
94
104
  return UtilsI18n__NS__defaultLangLocale;
@@ -171,9 +181,12 @@ class TranslationManager {
171
181
  async changeGlobalLang(lang) {
172
182
  this.loadingLangsSubjectSrc.next(true);
173
183
  this.currentGlobalLanguage = lang;
184
+ //#region @browser
174
185
  localStorage.setItem(globalTaonLanguageLocalKeyLocalStor, lang);
186
+ //#endregion
187
+ // console.log('instances ', this.instances);
175
188
  try {
176
- await Promise.all([...this.instances].map(c => c.useGlobalFileLang(lang)));
189
+ await Promise.all([...this.instances].map(c => c.useGlobalFileLang()));
177
190
  }
178
191
  catch (error) {
179
192
  console.error(error);
@@ -223,17 +236,22 @@ class Translation {
223
236
  gettext: (text, params, context) => this.createObservable(text, params, context),
224
237
  };
225
238
  if (!Translation.manager.instances.has(this)) {
239
+ // console.log(`Adding for ${fileRelativePath} `)
226
240
  Translation.manager.instances.add(this);
227
241
  }
242
+ else {
243
+ // console.log(`NOT ADDING for ${fileRelativePath} `)
244
+ }
245
+ // console.log(...Translation.manager.instances)
228
246
  }
229
247
  //#endregion
230
248
  //#region for
231
249
  for(_classThis) {
232
- //#region @browser
233
- if (this.useGlobalFileLang) {
250
+ if (this.useGlobalLangFile) {
234
251
  this.localFileLang = Translation.manager.currentGlobalLanguage;
235
252
  // console.log(`Update on t.for() ${this.localFileLang}`)
236
253
  }
254
+ //#region @browser
237
255
  try {
238
256
  this.cdr = inject(ChangeDetectorRef);
239
257
  }
@@ -256,7 +274,7 @@ class Translation {
256
274
  }
257
275
  //#endregion
258
276
  //#region use global file lang
259
- async useGlobalFileLang(lang) {
277
+ async useGlobalFileLang() {
260
278
  this.useGlobalLangFile = true;
261
279
  await this.ensureLoaded(true);
262
280
  //#region @browser
@@ -266,6 +284,7 @@ class Translation {
266
284
  //#endregion
267
285
  //#region signal
268
286
  createSignal(text, params, context = '') {
287
+ //#region @browser
269
288
  const s = signal(this.gettext(text, params, context), ...(ngDevMode ? [{ debugName: "s" }] : []));
270
289
  this.bindings.add({
271
290
  text,
@@ -274,6 +293,8 @@ class Translation {
274
293
  update: value => s.set(value),
275
294
  });
276
295
  return s;
296
+ //#endregion
297
+ return void 0;
277
298
  }
278
299
  //#endregion
279
300
  //#region $ obserable
@@ -392,7 +413,7 @@ class Translation {
392
413
  /*
393
414
  // import {Translation} from 'taon'
394
415
 
395
- const t = Translation.for('src/lib/translation.ts', {}); // in runtime replaced with proper stuff
416
+ const t = Translation.for('src/lib/translation.ts', {"src/lib/translation.ts":{"en-US":async () => (await import('./i18n/translation.ts.en-US.i18n.data')).default,"pl-PL":async () => (await import('./i18n/translation.ts.pl-PL.i18n.data')).default}} as any); // in runtime replaced with proper stuff
396
417
 
397
418
  t.gettext('asdasd');
398
419
 
@@ -509,12 +530,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImpor
509
530
  class TranslateService {
510
531
  constructor() {
511
532
  this.manager = TranslationManager.Instance;
512
- /**
513
- * TODO
514
- */
515
- this.isLoadingLangs$ = this.manager.isLoadingLangs$;
516
- this.availableLangs$ = this.manager.availableLangs$;
517
- this.currentGlobalLanguage$ = this.manager.currentGlobalLanguage$;
518
533
  }
519
534
  setOneLanguagePernament(lang) {
520
535
  this.manager.setOneLanguagePernament(lang);
@@ -1110,7 +1125,170 @@ function uniqueMessages(messages) {
1110
1125
  function UtilsI18nHtml__NS__extractGettextTranslateFromHtml(html, fileName = 'template.html') {
1111
1126
  return UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml(html, fileName);
1112
1127
  }
1113
- function UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext(html) {
1128
+ function UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext(html, options) {
1129
+ /* */
1130
+ /* */
1131
+ /* */
1132
+ /* */
1133
+ /* */
1134
+ /* */
1135
+ return (void 0);
1136
+ }
1137
+ function UtilsI18nHtml__NS__isAngularTsWithInlineHtml(content) {
1138
+ /* */
1139
+ /* */
1140
+ /* */
1141
+ /* */
1142
+ /* */
1143
+ /* */
1144
+ /* */
1145
+ /* */
1146
+ /* */
1147
+ /* */
1148
+ return (void 0);
1149
+ }
1150
+ function replaceInAngularInlineTemplates(content) {
1151
+ /* */
1152
+ /* */
1153
+ /* */
1154
+ /* */
1155
+ /* */
1156
+ /* */
1157
+ /* */
1158
+ /* */
1159
+ /* */
1160
+ /* */
1161
+ /* */
1162
+ /* */
1163
+ /* */
1164
+ /* */
1165
+ /* */
1166
+ /* */
1167
+ /* */
1168
+ /* */
1169
+ /* */
1170
+ /* */
1171
+ /* */
1172
+ /* */
1173
+ /* */
1174
+ /* */
1175
+ return (void 0);
1176
+ }
1177
+ function getAngularInlineTemplateRanges(content) {
1178
+ /* */
1179
+ /* */
1180
+ /* */
1181
+ /* */
1182
+ /* */
1183
+ /* */
1184
+ /* */
1185
+ /* */
1186
+ /* */
1187
+ /* */
1188
+ /* */
1189
+ /* */
1190
+ /* */
1191
+ /* */
1192
+ /* */
1193
+ /* */
1194
+ /* */
1195
+ /* */
1196
+ /* */
1197
+ /* */
1198
+ /* */
1199
+ /* */
1200
+ /* */
1201
+ /* */
1202
+ /* */
1203
+ /* */
1204
+ /* */
1205
+ /* */
1206
+ /* */
1207
+ /* */
1208
+ /* */
1209
+ /* */
1210
+ /* */
1211
+ /* */
1212
+ /* */
1213
+ /* */
1214
+ /* */
1215
+ /* */
1216
+ /* */
1217
+ /* */
1218
+ return (void 0);
1219
+ }
1220
+ function hasComponentDecorator(node) {
1221
+ /* */
1222
+ /* */
1223
+ return (void 0);
1224
+ }
1225
+ function getComponentDecorator(node) {
1226
+ /* */
1227
+ /* */
1228
+ /* */
1229
+ /* */
1230
+ /* */
1231
+ /* */
1232
+ /* */
1233
+ /* */
1234
+ /* */
1235
+ /* */
1236
+ /* */
1237
+ /* */
1238
+ /* */
1239
+ /* */
1240
+ return (void 0);
1241
+ }
1242
+ function getComponentTemplateInitializer(decorator) {
1243
+ /* */
1244
+ /* */
1245
+ /* */
1246
+ /* */
1247
+ /* */
1248
+ /* */
1249
+ /* */
1250
+ /* */
1251
+ /* */
1252
+ /* */
1253
+ /* */
1254
+ /* */
1255
+ /* */
1256
+ /* */
1257
+ /* */
1258
+ /* */
1259
+ /* */
1260
+ /* */
1261
+ /* */
1262
+ /* */
1263
+ /* */
1264
+ /* */
1265
+ /* */
1266
+ /* */
1267
+ /* */
1268
+ /* */
1269
+ return (void 0);
1270
+ }
1271
+ function getStringLikeInnerRange(content, node) {
1272
+ /* */
1273
+ /* */
1274
+ /* */
1275
+ /* */
1276
+ /* */
1277
+ /* */
1278
+ /* */
1279
+ /* */
1280
+ /* */
1281
+ /* */
1282
+ /* */
1283
+ /* */
1284
+ /* */
1285
+ /* */
1286
+ /* */
1287
+ /* */
1288
+ /* */
1289
+ return (void 0);
1290
+ }
1291
+ function UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContextInHtml(html) {
1114
1292
  /* */
1115
1293
  /* */
1116
1294
  /* */
@@ -1540,6 +1718,9 @@ function unescapePoString(value) {
1540
1718
  //#endregion
1541
1719
  //end of namespace UtilsPoFile
1542
1720
 
1721
+ ;
1722
+ // THIS FILE IS GENERATED - DO NOT MODIFY
1723
+
1543
1724
  // @ts-nocheck
1544
1725
  // This file is auto-generated during init process. Do not modify.
1545
1726
  // This disable this auto generate file.
@@ -1552,5 +1733,5 @@ var index = {};
1552
1733
  * Generated bundle index. Do not edit.
1553
1734
  */
1554
1735
 
1555
- export { APP_ID, BUILD_BASE_HREF, BUILD_FRAMEWORK_CLI_NAME, CURRENT_PACKAGE_TAON_VERSION, CURRENT_PACKAGE_VERSION, PROJECT_NPM_NAME, TranslateDirective, TranslatePipe, TranslateService, Translation, TranslationManager, UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml, UtilsI18nHtml__NS__extractGettextTranslateFromHtml, UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext, UtilsPoFile__NS__extractPoToJson, UtilsPoFile__NS__generatePoFileContent, UtilsPoFile__NS__generatePoFiles, UtilsPoFile__NS__generateTranslationOverrideInterface, UtilsPoFile__NS__mergeGettextFile, startCli };
1736
+ export { APP_ID, BUILD_BASE_HREF, BUILD_FRAMEWORK_CLI_NAME, CURRENT_PACKAGE_TAON_VERSION, CURRENT_PACKAGE_VERSION, PROJECT_NPM_NAME, TranslateDirective, TranslatePipe, TranslateService, Translation, TranslationManager, UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml, UtilsI18nHtml__NS__extractGettextTranslateFromHtml, UtilsI18nHtml__NS__isAngularTsWithInlineHtml, UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext, UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContextInHtml, UtilsPoFile__NS__extractPoToJson, UtilsPoFile__NS__generatePoFileContent, UtilsPoFile__NS__generatePoFiles, UtilsPoFile__NS__generateTranslationOverrideInterface, UtilsPoFile__NS__mergeGettextFile, startCli };
1556
1737
  //# sourceMappingURL=i18n-browser-prod.mjs.map