@taon-dev/i18n 21.0.48 → 21.0.50

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 (145) hide show
  1. package/VERIFIED-BUILD-DATA.jsonc +3 -3
  2. package/browser/fesm2022/i18n-browser.mjs +1 -1
  3. package/browser/fesm2022/i18n-browser.mjs.map +1 -1
  4. package/browser/package.json +1 -1
  5. package/browser/types/i18n-browser.d.ts +1 -1
  6. package/browser-prod/fesm2022/i18n-browser-prod.mjs +1 -1
  7. package/browser-prod/fesm2022/i18n-browser-prod.mjs.map +1 -1
  8. package/browser-prod/package.json +1 -1
  9. package/browser-prod/types/i18n-browser-prod.d.ts +1 -1
  10. package/full-dts/build-info._auto-generated_.d.ts +1 -1
  11. package/lib/build-info._auto-generated_.d.ts +1 -1
  12. package/lib/build-info._auto-generated_.js +1 -1
  13. package/lib/package.json +1 -1
  14. package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
  15. package/lib-esm/lib/build-info._auto-generated_.js +1 -1
  16. package/lib-prod/build-info._auto-generated_.d.ts +1 -1
  17. package/lib-prod/build-info._auto-generated_.js +1 -1
  18. package/lib-prod/package.json +1 -1
  19. package/package.json +1 -1
  20. package/ts-source/browser-code/build-info._auto-generated_.ts +18 -0
  21. package/ts-source/browser-code/i18n/lib.translation.ts +17 -0
  22. package/ts-source/browser-code/i18n/translation.ts.en-US.i18n.data.ts +38 -0
  23. package/ts-source/browser-code/i18n/translation.ts.en-US.po +17 -0
  24. package/ts-source/browser-code/i18n/translation.ts.pl-PL.i18n.data.ts +38 -0
  25. package/ts-source/browser-code/i18n/translation.ts.pl-PL.po +17 -0
  26. package/ts-source/browser-code/index._auto-generated_.ts +25 -0
  27. package/ts-source/browser-code/index.scss +12 -0
  28. package/ts-source/browser-code/index.ts +15 -0
  29. package/ts-source/browser-code/lib-info.md +8 -0
  30. package/ts-source/browser-code/local-translation.ts +131 -0
  31. package/ts-source/browser-code/migrations/migrations-info.md +6 -0
  32. package/ts-source/browser-code/start-cli.ts +17 -0
  33. package/ts-source/browser-code/translate.directive.ts +64 -0
  34. package/ts-source/browser-code/translate.pipe.ts +37 -0
  35. package/ts-source/browser-code/translate.service.ts +25 -0
  36. package/ts-source/browser-code/translation-manager.ts +106 -0
  37. package/ts-source/browser-code/translation.models.ts +32 -0
  38. package/ts-source/browser-code/translation.ts +184 -0
  39. package/ts-source/browser-code/utils-i18n-extract-gettext-translate-from-html.ts +92 -0
  40. package/ts-source/browser-code/utils-i18n-html.ts +84 -0
  41. package/ts-source/browser-code/utils-po-file.ts +75 -0
  42. package/ts-source/browser-code-prod/build-info._auto-generated_.split-namespaces.json +4 -0
  43. package/ts-source/browser-code-prod/build-info._auto-generated_.ts +18 -0
  44. package/ts-source/browser-code-prod/i18n/lib.translation.split-namespaces.json +4 -0
  45. package/ts-source/browser-code-prod/i18n/lib.translation.ts +17 -0
  46. package/ts-source/browser-code-prod/i18n/translation.ts.en-US.i18n.data.ts +38 -0
  47. package/ts-source/browser-code-prod/i18n/translation.ts.en-US.po +17 -0
  48. package/ts-source/browser-code-prod/i18n/translation.ts.pl-PL.i18n.data.ts +38 -0
  49. package/ts-source/browser-code-prod/i18n/translation.ts.pl-PL.po +17 -0
  50. package/ts-source/browser-code-prod/index._auto-generated_.split-namespaces.json +4 -0
  51. package/ts-source/browser-code-prod/index._auto-generated_.ts +25 -0
  52. package/ts-source/browser-code-prod/index.scss +12 -0
  53. package/ts-source/browser-code-prod/index.split-namespaces.json +4 -0
  54. package/ts-source/browser-code-prod/index.ts +15 -0
  55. package/ts-source/browser-code-prod/lib-info.md +8 -0
  56. package/ts-source/browser-code-prod/local-translation.split-namespaces.json +4 -0
  57. package/ts-source/browser-code-prod/local-translation.ts +131 -0
  58. package/ts-source/browser-code-prod/migrations/migrations-info.md +6 -0
  59. package/ts-source/browser-code-prod/start-cli.split-namespaces.json +4 -0
  60. package/ts-source/browser-code-prod/start-cli.ts +17 -0
  61. package/ts-source/browser-code-prod/translate.directive.split-namespaces.json +4 -0
  62. package/ts-source/browser-code-prod/translate.directive.ts +64 -0
  63. package/ts-source/browser-code-prod/translate.pipe.split-namespaces.json +4 -0
  64. package/ts-source/browser-code-prod/translate.pipe.ts +37 -0
  65. package/ts-source/browser-code-prod/translate.service.split-namespaces.json +4 -0
  66. package/ts-source/browser-code-prod/translate.service.ts +25 -0
  67. package/ts-source/browser-code-prod/translation-manager.split-namespaces.json +4 -0
  68. package/ts-source/browser-code-prod/translation-manager.ts +106 -0
  69. package/ts-source/browser-code-prod/translation.models.split-namespaces.json +4 -0
  70. package/ts-source/browser-code-prod/translation.models.ts +32 -0
  71. package/ts-source/browser-code-prod/translation.split-namespaces.json +4 -0
  72. package/ts-source/browser-code-prod/translation.ts +184 -0
  73. package/ts-source/browser-code-prod/utils-i18n-extract-gettext-translate-from-html.split-namespaces.json +10 -0
  74. package/ts-source/browser-code-prod/utils-i18n-extract-gettext-translate-from-html.ts +90 -0
  75. package/ts-source/browser-code-prod/utils-i18n-html.split-namespaces.json +16 -0
  76. package/ts-source/browser-code-prod/utils-i18n-html.ts +82 -0
  77. package/ts-source/browser-code-prod/utils-po-file.split-namespaces.json +18 -0
  78. package/ts-source/browser-code-prod/utils-po-file.ts +73 -0
  79. package/ts-source/websql-code/build-info._auto-generated_.ts +18 -0
  80. package/ts-source/websql-code/i18n/lib.translation.ts +17 -0
  81. package/ts-source/websql-code/i18n/translation.ts.en-US.i18n.data.ts +38 -0
  82. package/ts-source/websql-code/i18n/translation.ts.en-US.po +17 -0
  83. package/ts-source/websql-code/i18n/translation.ts.pl-PL.i18n.data.ts +38 -0
  84. package/ts-source/websql-code/i18n/translation.ts.pl-PL.po +17 -0
  85. package/ts-source/websql-code/index._auto-generated_.ts +25 -0
  86. package/ts-source/websql-code/index.scss +12 -0
  87. package/ts-source/websql-code/index.ts +15 -0
  88. package/ts-source/websql-code/lib-info.md +8 -0
  89. package/ts-source/websql-code/local-translation.ts +131 -0
  90. package/ts-source/websql-code/migrations/migrations-info.md +6 -0
  91. package/ts-source/websql-code/start-cli.ts +17 -0
  92. package/ts-source/websql-code/translate.directive.ts +64 -0
  93. package/ts-source/websql-code/translate.pipe.ts +37 -0
  94. package/ts-source/websql-code/translate.service.ts +25 -0
  95. package/ts-source/websql-code/translation-manager.ts +106 -0
  96. package/ts-source/websql-code/translation.models.ts +32 -0
  97. package/ts-source/websql-code/translation.ts +184 -0
  98. package/ts-source/websql-code/utils-i18n-extract-gettext-translate-from-html.ts +92 -0
  99. package/ts-source/websql-code/utils-i18n-html.ts +84 -0
  100. package/ts-source/websql-code/utils-po-file.ts +75 -0
  101. package/ts-source/websql-code-prod/build-info._auto-generated_.split-namespaces.json +4 -0
  102. package/ts-source/websql-code-prod/build-info._auto-generated_.ts +18 -0
  103. package/ts-source/websql-code-prod/i18n/lib.translation.split-namespaces.json +4 -0
  104. package/ts-source/websql-code-prod/i18n/lib.translation.ts +17 -0
  105. package/ts-source/websql-code-prod/i18n/translation.ts.en-US.i18n.data.ts +38 -0
  106. package/ts-source/websql-code-prod/i18n/translation.ts.en-US.po +17 -0
  107. package/ts-source/websql-code-prod/i18n/translation.ts.pl-PL.i18n.data.ts +38 -0
  108. package/ts-source/websql-code-prod/i18n/translation.ts.pl-PL.po +17 -0
  109. package/ts-source/websql-code-prod/index._auto-generated_.split-namespaces.json +4 -0
  110. package/ts-source/websql-code-prod/index._auto-generated_.ts +25 -0
  111. package/ts-source/websql-code-prod/index.scss +12 -0
  112. package/ts-source/websql-code-prod/index.split-namespaces.json +4 -0
  113. package/ts-source/websql-code-prod/index.ts +15 -0
  114. package/ts-source/websql-code-prod/lib-info.md +8 -0
  115. package/ts-source/websql-code-prod/local-translation.split-namespaces.json +4 -0
  116. package/ts-source/websql-code-prod/local-translation.ts +131 -0
  117. package/ts-source/websql-code-prod/migrations/migrations-info.md +6 -0
  118. package/ts-source/websql-code-prod/start-cli.split-namespaces.json +4 -0
  119. package/ts-source/websql-code-prod/start-cli.ts +17 -0
  120. package/ts-source/websql-code-prod/translate.directive.split-namespaces.json +4 -0
  121. package/ts-source/websql-code-prod/translate.directive.ts +64 -0
  122. package/ts-source/websql-code-prod/translate.pipe.split-namespaces.json +4 -0
  123. package/ts-source/websql-code-prod/translate.pipe.ts +37 -0
  124. package/ts-source/websql-code-prod/translate.service.split-namespaces.json +4 -0
  125. package/ts-source/websql-code-prod/translate.service.ts +25 -0
  126. package/ts-source/websql-code-prod/translation-manager.split-namespaces.json +4 -0
  127. package/ts-source/websql-code-prod/translation-manager.ts +106 -0
  128. package/ts-source/websql-code-prod/translation.models.split-namespaces.json +4 -0
  129. package/ts-source/websql-code-prod/translation.models.ts +32 -0
  130. package/ts-source/websql-code-prod/translation.split-namespaces.json +4 -0
  131. package/ts-source/websql-code-prod/translation.ts +184 -0
  132. package/ts-source/websql-code-prod/utils-i18n-extract-gettext-translate-from-html.split-namespaces.json +10 -0
  133. package/ts-source/websql-code-prod/utils-i18n-extract-gettext-translate-from-html.ts +90 -0
  134. package/ts-source/websql-code-prod/utils-i18n-html.split-namespaces.json +16 -0
  135. package/ts-source/websql-code-prod/utils-i18n-html.ts +82 -0
  136. package/ts-source/websql-code-prod/utils-po-file.split-namespaces.json +18 -0
  137. package/ts-source/websql-code-prod/utils-po-file.ts +73 -0
  138. package/websql/fesm2022/i18n-websql.mjs +1 -1
  139. package/websql/fesm2022/i18n-websql.mjs.map +1 -1
  140. package/websql/package.json +1 -1
  141. package/websql/types/i18n-websql.d.ts +1 -1
  142. package/websql-prod/fesm2022/i18n-websql-prod.mjs +1 -1
  143. package/websql-prod/fesm2022/i18n-websql-prod.mjs.map +1 -1
  144. package/websql-prod/package.json +1 -1
  145. package/websql-prod/types/i18n-websql-prod.d.ts +1 -1
@@ -0,0 +1,17 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside @taon-dev/i18n project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { LocalTranslationService } from './local-translation';
14
+ export async function startCli(argsv: string[], filename: string): Promise<void> {
15
+ return (void 0);
16
+ }
17
+ export default startCli;
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,64 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside @taon-dev/i18n project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { AfterViewInit, DestroyRef, Directive, ElementRef, inject, Input, OnChanges, } from '@angular/core';
14
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
15
+ import { Translation } from './translation';
16
+ @Directive({
17
+ selector: '[translate]',
18
+ standalone: true,
19
+ })
20
+ export class TranslateDirective implements AfterViewInit, OnChanges {
21
+ private static readonly selector = '[translate]';
22
+ @Input('translate-t')
23
+ t!: Translation;
24
+ @Input('translate-params')
25
+ params?: Record<string, unknown>;
26
+ @Input('translate-context')
27
+ translateContext?: string;
28
+ private initialized = false;
29
+ private readonly element = inject(ElementRef<HTMLElement>);
30
+ private readonly destroyRef = inject(DestroyRef);
31
+ private originalText = '';
32
+ ngAfterViewInit(): void {
33
+ const nativeElement = this.element.nativeElement;
34
+ this.validateContent();
35
+ this.originalText = nativeElement.textContent?.trim() ?? '';
36
+ this.initialized = true;
37
+ this.render();
38
+ this.t.isLoadingLang$
39
+ .pipe(takeUntilDestroyed(this.destroyRef))
40
+ .subscribe(() => {
41
+ this.render();
42
+ });
43
+ }
44
+ ngOnChanges(): void {
45
+ if (!this.initialized) {
46
+ return;
47
+ }
48
+ this.render();
49
+ }
50
+ private validateContent(): void {
51
+ const element = this.element.nativeElement;
52
+ if (element.children.length > 0) {
53
+ console.error(`[@taon-dev/i18n] ${TranslateDirective.selector} should only be used ` +
54
+ `with plain text. HTML/content elements detected inside:`, element);
55
+ }
56
+ }
57
+ private render(): void {
58
+ if (!this.t) {
59
+ throw (`Directive ${TranslateDirective.selector} applied on component ` +
60
+ `without implemented Translatable interface`);
61
+ }
62
+ this.element.nativeElement.textContent = this.t.translate(this.originalText, this.params, this.translateContext);
63
+ }
64
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,37 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside @taon-dev/i18n project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { ChangeDetectorRef, inject, OnDestroy, Pipe, PipeTransform, } from '@angular/core';
14
+ import { Subscription } from 'rxjs';
15
+ import { Translation } from './translation';
16
+ import { TranslationManager } from './translation-manager';
17
+ @Pipe({
18
+ name: 'translate',
19
+ standalone: true,
20
+ pure: false,
21
+ })
22
+ export class TranslatePipe implements PipeTransform, OnDestroy {
23
+ private readonly cdr = inject(ChangeDetectorRef);
24
+ private tranlsationManager = TranslationManager.Instance;
25
+ private readonly sub: Subscription;
26
+ constructor() {
27
+ this.sub = this.tranlsationManager.isLoadingLangs$.subscribe(() => {
28
+ this.cdr.markForCheck();
29
+ });
30
+ }
31
+ transform(text: string, t: Translation, params?: Record<string, unknown>, context?: string): string {
32
+ return t?.gettext(text, params, context) ?? text;
33
+ }
34
+ ngOnDestroy(): void {
35
+ this.sub.unsubscribe();
36
+ }
37
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,25 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside @taon-dev/i18n project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { Injectable } from '@angular/core';
14
+ import { UtilsI18n__NS__CommonLocaleCode, UtilsI18n__NS__CommonLocaleCodeEnum, UtilsI18n__NS__commonLocales, UtilsI18n__NS__defaultLangLocale, UtilsI18n__NS__detectLocale, UtilsI18n__NS__GettextExtracted, UtilsI18n__NS__GettextFile, UtilsI18n__NS__LangOption, UtilsI18n__NS__LangOptionArr } from 'tnp-core/websql-prod';
15
+ import { TranslationManager } from './translation-manager';
16
+ @Injectable({ providedIn: 'root' })
17
+ export class TranslateService {
18
+ public manager = TranslationManager.Instance;
19
+ public setOneLanguagePernament(lang: UtilsI18n__NS__CommonLocaleCode): void {
20
+ this.manager.setOneLanguagePernament(lang);
21
+ }
22
+ async changeGlobalLang(lang: UtilsI18n__NS__CommonLocaleCode): Promise<void> {
23
+ await this.manager.changeGlobalLang(lang);
24
+ }
25
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,106 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside @taon-dev/i18n project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { BehaviorSubject, filter, map, tap } from 'rxjs';
14
+ import { GlobalStorage, ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLeafObject, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith, UtilsI18n__NS__CommonLocaleCode, UtilsI18n__NS__CommonLocaleCodeEnum, UtilsI18n__NS__commonLocales, UtilsI18n__NS__defaultLangLocale, UtilsI18n__NS__detectLocale, UtilsI18n__NS__GettextExtracted, UtilsI18n__NS__GettextFile, UtilsI18n__NS__LangOption, UtilsI18n__NS__LangOptionArr } from 'tnp-core/websql-prod';
15
+ import type { Translation } from './translation';
16
+ const globalStorageKeyMainLanguage = 'taon-gettext-main-language';
17
+ const globalTaonLanguageLocalKeyLocalStor = 'taon-language-local';
18
+ const TranslationManagerGlobalStorKey = 'TranslationManagerGlobalStorKey';
19
+ export class TranslationManager {
20
+ static globalDefautlLanguageOverride: UtilsI18n__NS__CommonLocaleCode;
21
+ public get instances(): Set<Translation> {
22
+ let set = GlobalStorage.get(TranslationManagerGlobalStorKey) as Set<Translation>;
23
+ if (___NS__isNil(set)) {
24
+ GlobalStorage.set(TranslationManagerGlobalStorKey, new Set<Translation>());
25
+ }
26
+ set = GlobalStorage.get(TranslationManagerGlobalStorKey) as Set<Translation>;
27
+ return set;
28
+ }
29
+ constructor() {
30
+ }
31
+ private defaultLangLocale: UtilsI18n__NS__CommonLocaleCode = (() => {
32
+ return ((localStorage.getItem(globalTaonLanguageLocalKeyLocalStor) as UtilsI18n__NS__CommonLocaleCode) ||
33
+ TranslationManager.globalDefautlLanguageOverride ||
34
+ (UtilsI18n__NS__detectLocale() as UtilsI18n__NS__CommonLocaleCode));
35
+ return UtilsI18n__NS__defaultLangLocale;
36
+ })();
37
+ private _currentGlobalLanguage = this
38
+ .defaultLangLocale as UtilsI18n__NS__CommonLocaleCode;
39
+ public get currentGlobalLanguage(): UtilsI18n__NS__CommonLocaleCode {
40
+ return this._currentGlobalLanguage;
41
+ }
42
+ public set currentGlobalLanguage(v: UtilsI18n__NS__CommonLocaleCode) {
43
+ this._currentGlobalLanguage = v;
44
+ this.currentGlobalLanguageSrc.next(v);
45
+ }
46
+ private currentGlobalLanguageSrc = new BehaviorSubject(this.currentGlobalLanguage);
47
+ public readonly currentGlobalLanguage$ = this.currentGlobalLanguageSrc
48
+ .asObservable()
49
+ .pipe(tap(currentGlobalLanguage => {
50
+ GlobalStorage.set<UtilsI18n__NS__CommonLocaleCode>(globalStorageKeyMainLanguage, currentGlobalLanguage);
51
+ }));
52
+ public availableLangs = ___NS__cloneDeep(UtilsI18n__NS__LangOptionArr);
53
+ private availableLangsSrc = new BehaviorSubject(this.availableLangs);
54
+ public readonly availableLangs$ = this.availableLangsSrc.asObservable().pipe(map(f => {
55
+ if (this.visibleLanguages.length > 0) {
56
+ return f.filter(a => this.visibleLanguages.includes(a.code));
57
+ }
58
+ return f;
59
+ }));
60
+ public _visibleLanguages: UtilsI18n__NS__CommonLocaleCode[] = [];
61
+ public get visibleLanguages(): UtilsI18n__NS__CommonLocaleCode[] {
62
+ return this._visibleLanguages;
63
+ }
64
+ public set visibleLanguages(v: UtilsI18n__NS__CommonLocaleCode[]) {
65
+ if (this.pernamentLanguage) {
66
+ v = v.filter(a => [this.pernamentLanguage].includes(a));
67
+ }
68
+ this._visibleLanguages = v;
69
+ this.visibleLanguagesSrc.next(v);
70
+ this.availableLangsSrc.next(this.availableLangs);
71
+ }
72
+ private visibleLanguagesSrc = new BehaviorSubject(this.visibleLanguages);
73
+ public readonly visibleLanguages$ = this.visibleLanguagesSrc.asObservable();
74
+ private loadingLangsSubjectSrc = new BehaviorSubject(false);
75
+ public readonly isLoadingLangs$ = this.loadingLangsSubjectSrc.asObservable();
76
+ private static _instance: TranslationManager;
77
+ static get Instance(): TranslationManager {
78
+ if (!this._instance) {
79
+ this._instance = new TranslationManager();
80
+ }
81
+ return this._instance;
82
+ }
83
+ public readonly pernamentLanguage: UtilsI18n__NS__CommonLocaleCode | null = null;
84
+ public setOneLanguagePernament(lang: UtilsI18n__NS__CommonLocaleCode): void {
85
+ console.info(`Setting pernament language to ${lang}`);
86
+ if (this.pernamentLanguage) {
87
+ console.log('You are trying to set again pernament language');
88
+ return;
89
+ }
90
+ this.visibleLanguages = [lang];
91
+ this.pernamentLanguage = lang;
92
+ void this.changeGlobalLang(lang);
93
+ }
94
+ async changeGlobalLang(lang: UtilsI18n__NS__CommonLocaleCode): Promise<void> {
95
+ this.loadingLangsSubjectSrc.next(true);
96
+ this.currentGlobalLanguage = lang;
97
+ localStorage.setItem(globalTaonLanguageLocalKeyLocalStor, lang);
98
+ try {
99
+ await Promise.all([...this.instances].map(c => c.useGlobalFileLang()));
100
+ }
101
+ catch (error) {
102
+ console.error(error);
103
+ }
104
+ this.loadingLangsSubjectSrc.next(false);
105
+ }
106
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,32 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside @taon-dev/i18n project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { UtilsI18n__NS__CommonLocaleCode, UtilsI18n__NS__CommonLocaleCodeEnum, UtilsI18n__NS__commonLocales, UtilsI18n__NS__defaultLangLocale, UtilsI18n__NS__detectLocale, UtilsI18n__NS__GettextExtracted, UtilsI18n__NS__GettextFile, UtilsI18n__NS__LangOption, UtilsI18n__NS__LangOptionArr } from 'tnp-core/websql-prod';
14
+ import type { Translation } from './translation';
15
+ export type TranslationLookup = Record<string, string>;
16
+ export type TranslationParams = Record<string, unknown> | null;
17
+ type FileRelativeLocation = string;
18
+ export type TaonTranslationsMapImport = Record<FileRelativeLocation, {
19
+ [lang in UtilsI18n__NS__CommonLocaleCode]?: () => Promise<UtilsI18n__NS__GettextFile>;
20
+ }>;
21
+ export type TaonTranslationsMap = Record<FileRelativeLocation, {
22
+ [lang in UtilsI18n__NS__CommonLocaleCode]?: UtilsI18n__NS__GettextFile;
23
+ }>;
24
+ export interface TranslationBinding {
25
+ text: string;
26
+ params?: TranslationParams;
27
+ context?: string;
28
+ update(value: string): void;
29
+ }
30
+ export interface Translatable {
31
+ t: Translation;
32
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "namespacesMapObj": {},
3
+ "namespacesReplace": {}
4
+ }
@@ -0,0 +1,184 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside @taon-dev/i18n project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { ChangeDetectorRef, inject, signal, WritableSignal, } from '@angular/core';
14
+ import type { WritableSignal as WritableSignalType, } from '@angular/core';
15
+ import { BehaviorSubject, Observable } from 'rxjs';
16
+ import { GlobalStorage, ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLeafObject, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith, UtilsI18n__NS__CommonLocaleCode, UtilsI18n__NS__CommonLocaleCodeEnum, UtilsI18n__NS__commonLocales, UtilsI18n__NS__defaultLangLocale, UtilsI18n__NS__detectLocale, UtilsI18n__NS__GettextExtracted, UtilsI18n__NS__GettextFile, UtilsI18n__NS__LangOption, UtilsI18n__NS__LangOptionArr } from 'tnp-core/websql-prod';
17
+ import { TranslationManager } from './translation-manager';
18
+ import { TaonTranslationsMapImport, TranslationBinding, TranslationLookup, TranslationParams, } from './translation.models';
19
+ import type { UtilsPoFile__NS__extractPoToJson, UtilsPoFile__NS__generatePoFileContent, UtilsPoFile__NS__generatePoFiles, UtilsPoFile__NS__generateTranslationOverrideInterface, UtilsPoFile__NS__mergeGettextFile } from './utils-po-file';
20
+ export class Translation {
21
+ static manager = TranslationManager.Instance;
22
+ static for(fileRelativePath: string, langImportMap: TaonTranslationsMapImport, opt?: {
23
+ debug?: boolean;
24
+ }): Translation {
25
+ opt = opt || {};
26
+ return new Translation(fileRelativePath, Translation.manager.currentGlobalLanguage, langImportMap, !!opt.debug);
27
+ }
28
+ public cdr?: ChangeDetectorRef;
29
+ private lookup: TranslationLookup = {};
30
+ private readonly loadingSubjectSrc = new BehaviorSubject(false);
31
+ public readonly isLoadingLang$ = this.loadingSubjectSrc.asObservable();
32
+ private loading?: Promise<void>;
33
+ private loadedLang?: UtilsI18n__NS__CommonLocaleCode;
34
+ private readonly bindings = new Set<TranslationBinding>();
35
+ private useGlobalLangFile = true;
36
+ private constructor(protected fileRelativePath: string, protected localFileLang: UtilsI18n__NS__CommonLocaleCode, protected langImportMap: TaonTranslationsMapImport, public debug = false) {
37
+ if (!Translation.manager.instances.has(this)) {
38
+ Translation.manager.instances.add(this);
39
+ }
40
+ else {
41
+ }
42
+ }
43
+ for(_classThis: object): Translation {
44
+ if (this.useGlobalLangFile) {
45
+ this.localFileLang = Translation.manager.currentGlobalLanguage;
46
+ }
47
+ try {
48
+ this.cdr = inject(ChangeDetectorRef);
49
+ }
50
+ catch {
51
+ }
52
+ void this.ensureLoaded();
53
+ return this;
54
+ }
55
+ async changeFileLang(lang: UtilsI18n__NS__CommonLocaleCode): Promise<void> {
56
+ this.useGlobalLangFile = false;
57
+ this.localFileLang = lang;
58
+ await this.ensureLoaded(true);
59
+ this.cdr?.markForCheck();
60
+ }
61
+ async useGlobalFileLang(): Promise<void> {
62
+ this.useGlobalLangFile = true;
63
+ await this.ensureLoaded(true);
64
+ this.cdr?.markForCheck();
65
+ }
66
+ gettext = (text: string, params?: TranslationParams, context = ''): string => {
67
+ const key = this.key(text, context);
68
+ const translated = this.lookup[key] ?? text;
69
+ this.debug &&
70
+ console.log(`Translate (with load): "${text}" to "${translated}", key="${key}" params:${___NS__isObject(params) ? JSON.stringify(params) : params} ` +
71
+ `localFileLang: ${this.localFileLang}`, this);
72
+ return this.interpolate(translated, params);
73
+ };
74
+ private createSignal(text: string, params?: TranslationParams, context = ''): WritableSignalType<string> {
75
+ const s = signal<string>(this.gettext(text, params, context));
76
+ this.bindings.add({
77
+ text,
78
+ params,
79
+ context,
80
+ update: value => s.set(value),
81
+ });
82
+ return s;
83
+ return void 0;
84
+ }
85
+ readonly signal = {
86
+ gettext: (text: string, params?: TranslationParams, context?: string) => this.createSignal(text, params, context),
87
+ };
88
+ private createObservable(text: string, params?: TranslationParams, context = ''): Observable<string> {
89
+ const subject = new BehaviorSubject<string>(this.gettext(text, params, context));
90
+ this.bindings.add({
91
+ text,
92
+ params,
93
+ context,
94
+ update: value => subject.next(value),
95
+ });
96
+ return subject.asObservable();
97
+ }
98
+ readonly $ = {
99
+ gettext: (text: string, params?: TranslationParams, context?: string) => this.createObservable(text, params, context),
100
+ };
101
+ private refreshBindings(): void {
102
+ for (const binding of this.bindings) {
103
+ binding.update(this.gettextWithoutEnsureLoaded(binding.text, binding.params, binding.context ?? ''));
104
+ }
105
+ }
106
+ translate(text: string, params?: TranslationParams, context = ''): string {
107
+ return this.gettextWithoutEnsureLoaded(text, params, context);
108
+ }
109
+ private gettextWithoutEnsureLoaded(text: string, params?: TranslationParams, context = ''): string {
110
+ const key = this.key(text, context);
111
+ const translated = this.lookup[key] ?? text;
112
+ this.debug &&
113
+ console.log(`Translate (no load): "${text}" to "${translated}", key="${key}" params:${___NS__isObject(params) ? JSON.stringify(params) : params} ` +
114
+ `localFileLang: ${this.localFileLang}`, this);
115
+ return this.interpolate(translated, params);
116
+ }
117
+ private async load(): Promise<void> {
118
+ this.loadingSubjectSrc.next(true);
119
+ const files: UtilsI18n__NS__GettextFile[] = [];
120
+ const filesForTArr = Object.keys(this.langImportMap);
121
+ for (const fileRelativePath of filesForTArr) {
122
+ try {
123
+ const loader = this.langImportMap[fileRelativePath]?.[this.localFileLang];
124
+ if (!loader) {
125
+ continue;
126
+ }
127
+ const modOrFile = await loader();
128
+ const file = (modOrFile as any).default ?? modOrFile;
129
+ files.push(file);
130
+ }
131
+ catch (err) {
132
+ console.log(`[taon-i18n] Error loading language file ${fileRelativePath} `, err);
133
+ }
134
+ }
135
+ this.loadedLang = this.localFileLang;
136
+ this.lookup = this.createLookup(files);
137
+ this.debug && console.log(`${this.localFileLang}`, files, this.lookup);
138
+ this.refreshBindings();
139
+ this.cdr?.markForCheck();
140
+ this.loadingSubjectSrc.next(false);
141
+ }
142
+ private async ensureLoaded(force = false): Promise<void> {
143
+ if (this.useGlobalLangFile) {
144
+ this.localFileLang = Translation.manager.currentGlobalLanguage;
145
+ }
146
+ if (!force && this.loadedLang === this.localFileLang) {
147
+ return;
148
+ }
149
+ if (!force && this.loading) {
150
+ return this.loading;
151
+ }
152
+ this.loading = this.load();
153
+ try {
154
+ await this.loading;
155
+ }
156
+ finally {
157
+ this.loading = undefined;
158
+ }
159
+ }
160
+ private createLookup(files: UtilsI18n__NS__GettextFile[]): TranslationLookup {
161
+ const lookup: TranslationLookup = {};
162
+ for (const file of files) {
163
+ for (const tag of file.tags ?? []) {
164
+ if (!tag.translation)
165
+ continue;
166
+ lookup[this.key(tag.gettextString, tag.context ?? '')] =
167
+ tag.translation;
168
+ }
169
+ }
170
+ return lookup;
171
+ }
172
+ private key(text: string, context = ''): string {
173
+ return `${context}\u0004${text}`;
174
+ }
175
+ private interpolate(text: string, params?: Record<string, unknown>): string {
176
+ if (!params)
177
+ return text;
178
+ const result = text.replace(/\[\[\s*([a-zA-Z0-9_$]+)\s*\]\]/g, (_, key) => {
179
+ const value = params[key];
180
+ return value === undefined || value === null ? '' : String(value);
181
+ });
182
+ return result;
183
+ }
184
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "namespacesMapObj": {
3
+ "UtilsI18nExtractGettextTranslateFromHtml.extractGettextTranslateFromHtml": "UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml"
4
+ },
5
+ "namespacesReplace": {
6
+ "UtilsI18nExtractGettextTranslateFromHtml": [
7
+ "UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml"
8
+ ]
9
+ }
10
+ }
@@ -0,0 +1,90 @@
1
+ // @ts-nocheck
2
+ /* ============================================================================
3
+
4
+ - TAON READONLY SOURCE
5
+ - DO NOT MODIFY THIS FILE.
6
+ - Changes may be overwritten.
7
+ - Use command: taon build:lib:watch
8
+ inside @taon-dev/i18n project repository
9
+ for watch development of third party modules like this.
10
+
11
+ * ========================================================================== */
12
+
13
+ import { AST, Binary, BindingPipe, Conditional, Interpolation, LiteralPrimitive, parseTemplate, TmplAstBoundAttribute, TmplAstBoundText, TmplAstElement, TmplAstNode, TmplAstTemplate, TmplAstText, } from '@angular/compiler/cjs';
14
+ import { UtilsI18n__NS__CommonLocaleCode, UtilsI18n__NS__CommonLocaleCodeEnum, UtilsI18n__NS__commonLocales, UtilsI18n__NS__defaultLangLocale, UtilsI18n__NS__detectLocale, UtilsI18n__NS__GettextExtracted, UtilsI18n__NS__GettextFile, UtilsI18n__NS__LangOption, UtilsI18n__NS__LangOptionArr } from 'tnp-core/websql-prod';
15
+ export function UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml(html: string, fileName = 'template.html'): UtilsI18n__NS__GettextExtracted[] {
16
+ return (void 0);
17
+ return void 0 as any;
18
+ }
19
+ function extractGettextCallsFromSource(html: string): UtilsI18n__NS__GettextExtracted[] {
20
+ return (void 0);
21
+ }
22
+ function extractGettextCallsFromHtmlExpression(source: string): Array<{
23
+ gettextString: string;
24
+ context?: string;
25
+ }> {
26
+ return (void 0);
27
+ }
28
+ function readBalancedParenthesesContent(source: string, openParenIndex: number): string | null {
29
+ return (void 0);
30
+ }
31
+ function readStaticStringArg(arg: string | undefined): string | undefined {
32
+ return (void 0);
33
+ }
34
+ function extractTranslateParamsFromSource(source: string): Record<string, string> | null {
35
+ return (void 0);
36
+ }
37
+ function extractObjectLiteralParams(raw: string): Record<string, string> | null {
38
+ return (void 0);
39
+ }
40
+ function splitTopLevel(input: string, separator: string): string[] {
41
+ return (void 0);
42
+ }
43
+ function extractTranslatePipeStringsFromSource(source: string): string[] {
44
+ return (void 0);
45
+ }
46
+ function extractStringLiterals(source: string): string[] {
47
+ return (void 0);
48
+ }
49
+ function getNodeAttributes(node: any): any[] {
50
+ return (void 0);
51
+ }
52
+ function getNodeInputs(node: any): TmplAstBoundAttribute[] {
53
+ return (void 0);
54
+ }
55
+ function isText(node: any): boolean {
56
+ return (void 0);
57
+ }
58
+ function isBoundText(node: any): boolean {
59
+ return (void 0);
60
+ }
61
+ function collectText(nodes: any[]): string {
62
+ return (void 0);
63
+ }
64
+ function extractTranslateDirectiveFromSource(html: string): UtilsI18n__NS__GettextExtracted[] {
65
+ return (void 0);
66
+ }
67
+ function stripHtml(html: string): string {
68
+ return (void 0);
69
+ }
70
+ function extractTranslateParams(inputs: TmplAstBoundAttribute[]): Record<string, string> | null {
71
+ return (void 0);
72
+ }
73
+ function extractObjectLiteralFromAst(ast: any): Record<string, string> | null {
74
+ return (void 0);
75
+ }
76
+ function extractTranslatePipeStrings(ast: AST | any): string[] {
77
+ return (void 0);
78
+ }
79
+ function extractStaticStringsFromExpression(ast: any): string[] {
80
+ return (void 0);
81
+ }
82
+ function astToSource(ast: any): string {
83
+ return (void 0);
84
+ }
85
+ function normalizeHtmlText(text: string): string {
86
+ return (void 0);
87
+ }
88
+ function uniqueMessages(messages: UtilsI18n__NS__GettextExtracted[]): UtilsI18n__NS__GettextExtracted[] {
89
+ return (void 0);
90
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "namespacesMapObj": {
3
+ "UtilsI18nHtml.extractGettextTranslateFromHtml": "UtilsI18nHtml__NS__extractGettextTranslateFromHtml",
4
+ "UtilsI18nHtml.replaceTranslatePipieDirectiveTContext": "UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext",
5
+ "UtilsI18nHtml.isAngularTsWithInlineHtml": "UtilsI18nHtml__NS__isAngularTsWithInlineHtml",
6
+ "UtilsI18nHtml.replaceTranslatePipieDirectiveTContextInHtml": "UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContextInHtml"
7
+ },
8
+ "namespacesReplace": {
9
+ "UtilsI18nHtml": [
10
+ "UtilsI18nHtml__NS__extractGettextTranslateFromHtml",
11
+ "UtilsI18nHtml__NS__isAngularTsWithInlineHtml",
12
+ "UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext",
13
+ "UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContextInHtml"
14
+ ]
15
+ }
16
+ }