@taon-dev/i18n 0.0.1 → 21.0.7

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 (279) hide show
  1. package/VERIFIED-BUILD-DATA.jsonc +3 -3
  2. package/bin/start.js +1 -1
  3. package/browser/fesm2022/i18n-browser.mjs +1441 -406
  4. package/browser/fesm2022/i18n-browser.mjs.map +1 -1
  5. package/browser/package.json +1 -1
  6. package/browser/types/i18n-browser.d.ts +146 -305
  7. package/browser-prod/fesm2022/i18n-browser-prod.mjs +1429 -405
  8. package/browser-prod/fesm2022/i18n-browser-prod.mjs.map +1 -1
  9. package/browser-prod/package.json +1 -1
  10. package/browser-prod/types/i18n-browser-prod.d.ts +140 -305
  11. package/browser-prod.split-namespaces.json +26 -2
  12. package/html/app/main-page/main-page.container.html +4 -0
  13. package/html/assets/generated/pwa/html-pwa.html +53 -53
  14. package/lib/build-info._auto-generated_.d.ts +1 -1
  15. package/lib/build-info._auto-generated_.js +1 -1
  16. package/lib/build-info._auto-generated_.js.map +1 -1
  17. package/lib/index._auto-generated_.d.ts +9 -14
  18. package/lib/index._auto-generated_.js +9 -14
  19. package/lib/index._auto-generated_.js.map +1 -1
  20. package/lib/package.json +1 -1
  21. package/lib/start-cli.js +6 -4
  22. package/lib/start-cli.js.map +1 -1
  23. package/lib/translate.directive.d.ts +15 -0
  24. package/lib/translate.pipe.d.ts +10 -0
  25. package/lib/translate.service.d.ts +13 -0
  26. package/lib/translation-manager.d.ts +33 -0
  27. package/lib/translation-manager.js +119 -0
  28. package/lib/translation-manager.js.map +1 -0
  29. package/lib/translation.d.ts +44 -0
  30. package/lib/translation.js +253 -0
  31. package/lib/translation.js.map +1 -0
  32. package/lib/translation.models.d.ts +25 -0
  33. package/lib/{features/types.js → translation.models.js} +1 -1
  34. package/lib/translation.models.js.map +1 -0
  35. package/lib/utils-i18n-extract-gettext-translate-from-html.d.ts +4 -0
  36. package/lib/utils-i18n-extract-gettext-translate-from-html.js +465 -0
  37. package/lib/utils-i18n-extract-gettext-translate-from-html.js.map +1 -0
  38. package/lib/utils-i18n-extract-gettext-translate-from-html.test.d.ts +1 -0
  39. package/lib/utils-i18n-extract-gettext-translate-from-html.test.js +282 -0
  40. package/lib/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -0
  41. package/lib/utils-i18n-html.d.ts +5 -0
  42. package/lib/utils-i18n-html.js +120 -0
  43. package/lib/utils-i18n-html.js.map +1 -0
  44. package/lib/utils-i18n-html.test.d.ts +1 -0
  45. package/lib/utils-i18n-html.test.js +82 -0
  46. package/lib/utils-i18n-html.test.js.map +1 -0
  47. package/lib/utils-po-file.d.ts +8 -0
  48. package/lib/utils-po-file.js +245 -0
  49. package/lib/utils-po-file.js.map +1 -0
  50. package/lib/utils-po-file.test.d.ts +1 -0
  51. package/lib/utils-po-file.test.js +239 -0
  52. package/lib/utils-po-file.test.js.map +1 -0
  53. package/lib-esm/app/main-page/main-page.active.context.d.ts +19 -0
  54. package/lib-esm/app/main-page/main-page.active.context.js +19 -0
  55. package/lib-esm/app/main-page/main-page.active.context.js.map +1 -0
  56. package/lib-esm/app.electron.d.ts +1 -1
  57. package/lib-esm/app.electron.js +1 -1
  58. package/lib-esm/app.hosts.d.ts +54 -2
  59. package/lib-esm/app.hosts.js +64 -4
  60. package/lib-esm/app.hosts.js.map +1 -1
  61. package/lib-esm/app.js +9 -9
  62. package/lib-esm/app.js.map +1 -1
  63. package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
  64. package/lib-esm/lib/build-info._auto-generated_.js +1 -1
  65. package/lib-esm/lib/build-info._auto-generated_.js.map +1 -1
  66. package/lib-esm/lib/index._auto-generated_.d.ts +6 -14
  67. package/lib-esm/lib/index._auto-generated_.js +9 -14
  68. package/lib-esm/lib/index._auto-generated_.js.map +1 -1
  69. package/lib-esm/lib/start-cli.js +6 -4
  70. package/lib-esm/lib/start-cli.js.map +1 -1
  71. package/lib-esm/lib/translation-manager.d.ts +33 -0
  72. package/lib-esm/lib/translation-manager.js +115 -0
  73. package/lib-esm/lib/translation-manager.js.map +1 -0
  74. package/lib-esm/lib/translation.d.ts +43 -0
  75. package/lib-esm/lib/translation.js +249 -0
  76. package/lib-esm/lib/translation.js.map +1 -0
  77. package/lib-esm/lib/translation.models.d.ts +25 -0
  78. package/lib-esm/lib/translation.models.js +2 -0
  79. package/lib-esm/lib/translation.models.js.map +1 -0
  80. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.d.ts +4 -0
  81. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.js +462 -0
  82. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.js.map +1 -0
  83. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.d.ts +1 -0
  84. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.js +280 -0
  85. package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -0
  86. package/lib-esm/lib/utils-i18n-html.d.ts +5 -0
  87. package/lib-esm/lib/utils-i18n-html.js +117 -0
  88. package/lib-esm/lib/utils-i18n-html.js.map +1 -0
  89. package/lib-esm/lib/utils-i18n-html.test.d.ts +1 -0
  90. package/lib-esm/lib/utils-i18n-html.test.js +80 -0
  91. package/lib-esm/lib/utils-i18n-html.test.js.map +1 -0
  92. package/lib-esm/lib/utils-po-file.d.ts +8 -0
  93. package/lib-esm/lib/utils-po-file.js +242 -0
  94. package/lib-esm/lib/utils-po-file.js.map +1 -0
  95. package/lib-esm/lib/utils-po-file.test.d.ts +1 -0
  96. package/lib-esm/lib/utils-po-file.test.js +237 -0
  97. package/lib-esm/lib/utils-po-file.test.js.map +1 -0
  98. package/lib-prod/build-info._auto-generated_.d.ts +1 -1
  99. package/lib-prod/build-info._auto-generated_.js +1 -1
  100. package/lib-prod/build-info._auto-generated_.js.map +1 -1
  101. package/lib-prod/index._auto-generated_.d.ts +6 -14
  102. package/lib-prod/index._auto-generated_.js +9 -14
  103. package/lib-prod/index._auto-generated_.js.map +1 -1
  104. package/lib-prod/package.json +1 -1
  105. package/lib-prod/start-cli.js +6 -4
  106. package/lib-prod/start-cli.js.map +1 -1
  107. package/lib-prod/translation-manager.d.ts +33 -0
  108. package/lib-prod/translation-manager.js +115 -0
  109. package/lib-prod/translation-manager.js.map +1 -0
  110. package/lib-prod/translation.d.ts +43 -0
  111. package/lib-prod/translation.js +249 -0
  112. package/lib-prod/translation.js.map +1 -0
  113. package/lib-prod/translation.models.d.ts +25 -0
  114. package/lib-prod/translation.models.js +2 -0
  115. package/lib-prod/translation.models.js.map +1 -0
  116. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.d.ts +2 -0
  117. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.js +460 -0
  118. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.js.map +1 -0
  119. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.d.ts +1 -0
  120. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.js +280 -0
  121. package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -0
  122. package/lib-prod/utils-i18n-html.d.ts +3 -0
  123. package/lib-prod/utils-i18n-html.js +114 -0
  124. package/lib-prod/utils-i18n-html.js.map +1 -0
  125. package/lib-prod/utils-i18n-html.test.d.ts +1 -0
  126. package/lib-prod/utils-i18n-html.test.js +80 -0
  127. package/lib-prod/utils-i18n-html.test.js.map +1 -0
  128. package/lib-prod/utils-po-file.d.ts +6 -0
  129. package/lib-prod/utils-po-file.js +236 -0
  130. package/lib-prod/utils-po-file.js.map +1 -0
  131. package/lib-prod/utils-po-file.test.d.ts +1 -0
  132. package/lib-prod/utils-po-file.test.js +237 -0
  133. package/lib-prod/utils-po-file.test.js.map +1 -0
  134. package/lib-prod.split-namespaces.json +26 -2
  135. package/package.json +4 -2
  136. package/scss/app/main-page/main-page.container.scss +3 -0
  137. package/websql/fesm2022/i18n-websql.mjs +1441 -406
  138. package/websql/fesm2022/i18n-websql.mjs.map +1 -1
  139. package/websql/package.json +1 -1
  140. package/websql/types/i18n-websql.d.ts +146 -305
  141. package/websql-prod/fesm2022/i18n-websql-prod.mjs +1429 -405
  142. package/websql-prod/fesm2022/i18n-websql-prod.mjs.map +1 -1
  143. package/websql-prod/package.json +1 -1
  144. package/websql-prod/types/i18n-websql-prod.d.ts +140 -305
  145. package/websql-prod.split-namespaces.json +26 -2
  146. package/lib/features/index.d.ts +0 -4
  147. package/lib/features/index.js +0 -21
  148. package/lib/features/index.js.map +0 -1
  149. package/lib/features/types.d.ts +0 -4
  150. package/lib/features/types.js.map +0 -1
  151. package/lib/features/withLanguageLocalStorageSync.d.ts +0 -9
  152. package/lib/features/withLanguageLocalStorageSync.js +0 -39
  153. package/lib/features/withLanguageLocalStorageSync.js.map +0 -1
  154. package/lib/features/withNavigatorLanguage.d.ts +0 -6
  155. package/lib/features/withNavigatorLanguage.js +0 -29
  156. package/lib/features/withNavigatorLanguage.js.map +0 -1
  157. package/lib/features/withPreloadScopes.d.ts +0 -8
  158. package/lib/features/withPreloadScopes.js +0 -25
  159. package/lib/features/withPreloadScopes.js.map +0 -1
  160. package/lib/features/withServerSideLanguage.d.ts +0 -6
  161. package/lib/features/withServerSideLanguage.js +0 -29
  162. package/lib/features/withServerSideLanguage.js.map +0 -1
  163. package/lib/features/withTranslatedTitle.d.ts +0 -34
  164. package/lib/features/withTranslatedTitle.js +0 -69
  165. package/lib/features/withTranslatedTitle.js.map +0 -1
  166. package/lib/internals.d.ts +0 -2
  167. package/lib/internals.js +0 -6
  168. package/lib/internals.js.map +0 -1
  169. package/lib/transignal-config.d.ts +0 -34
  170. package/lib/transignal-config.js +0 -42
  171. package/lib/transignal-config.js.map +0 -1
  172. package/lib/transignal-param-handlers.d.ts +0 -11
  173. package/lib/transignal-param-handlers.js +0 -31
  174. package/lib/transignal-param-handlers.js.map +0 -1
  175. package/lib/transignal-service.d.ts +0 -32
  176. package/lib/transignal-service.js +0 -206
  177. package/lib/transignal-service.js.map +0 -1
  178. package/lib/transignal-testing.d.ts +0 -8
  179. package/lib/transignal-testing.js +0 -14
  180. package/lib/transignal-testing.js.map +0 -1
  181. package/lib/types.d.ts +0 -124
  182. package/lib/types.js +0 -3
  183. package/lib/types.js.map +0 -1
  184. package/lib/utility-types.d.ts +0 -29
  185. package/lib/utility-types.js +0 -3
  186. package/lib/utility-types.js.map +0 -1
  187. package/lib/utils.d.ts +0 -15
  188. package/lib/utils.js +0 -20
  189. package/lib/utils.js.map +0 -1
  190. package/lib-esm/lib/features/index.d.ts +0 -4
  191. package/lib-esm/lib/features/index.js +0 -5
  192. package/lib-esm/lib/features/index.js.map +0 -1
  193. package/lib-esm/lib/features/types.d.ts +0 -4
  194. package/lib-esm/lib/features/types.js +0 -2
  195. package/lib-esm/lib/features/types.js.map +0 -1
  196. package/lib-esm/lib/features/withLanguageLocalStorageSync.d.ts +0 -9
  197. package/lib-esm/lib/features/withLanguageLocalStorageSync.js +0 -35
  198. package/lib-esm/lib/features/withLanguageLocalStorageSync.js.map +0 -1
  199. package/lib-esm/lib/features/withNavigatorLanguage.d.ts +0 -6
  200. package/lib-esm/lib/features/withNavigatorLanguage.js +0 -25
  201. package/lib-esm/lib/features/withNavigatorLanguage.js.map +0 -1
  202. package/lib-esm/lib/features/withPreloadScopes.d.ts +0 -8
  203. package/lib-esm/lib/features/withPreloadScopes.js +0 -21
  204. package/lib-esm/lib/features/withPreloadScopes.js.map +0 -1
  205. package/lib-esm/lib/features/withServerSideLanguage.d.ts +0 -6
  206. package/lib-esm/lib/features/withServerSideLanguage.js +0 -25
  207. package/lib-esm/lib/features/withServerSideLanguage.js.map +0 -1
  208. package/lib-esm/lib/features/withTranslatedTitle.d.ts +0 -34
  209. package/lib-esm/lib/features/withTranslatedTitle.js +0 -65
  210. package/lib-esm/lib/features/withTranslatedTitle.js.map +0 -1
  211. package/lib-esm/lib/internals.d.ts +0 -2
  212. package/lib-esm/lib/internals.js +0 -3
  213. package/lib-esm/lib/internals.js.map +0 -1
  214. package/lib-esm/lib/transignal-config.d.ts +0 -34
  215. package/lib-esm/lib/transignal-config.js +0 -36
  216. package/lib-esm/lib/transignal-config.js.map +0 -1
  217. package/lib-esm/lib/transignal-param-handlers.d.ts +0 -11
  218. package/lib-esm/lib/transignal-param-handlers.js +0 -25
  219. package/lib-esm/lib/transignal-param-handlers.js.map +0 -1
  220. package/lib-esm/lib/transignal-service.d.ts +0 -32
  221. package/lib-esm/lib/transignal-service.js +0 -197
  222. package/lib-esm/lib/transignal-service.js.map +0 -1
  223. package/lib-esm/lib/transignal-testing.d.ts +0 -8
  224. package/lib-esm/lib/transignal-testing.js +0 -10
  225. package/lib-esm/lib/transignal-testing.js.map +0 -1
  226. package/lib-esm/lib/types.d.ts +0 -124
  227. package/lib-esm/lib/types.js +0 -2
  228. package/lib-esm/lib/types.js.map +0 -1
  229. package/lib-esm/lib/utility-types.d.ts +0 -29
  230. package/lib-esm/lib/utility-types.js +0 -2
  231. package/lib-esm/lib/utility-types.js.map +0 -1
  232. package/lib-esm/lib/utils.d.ts +0 -15
  233. package/lib-esm/lib/utils.js +0 -15
  234. package/lib-esm/lib/utils.js.map +0 -1
  235. package/lib-prod/features/index.d.ts +0 -4
  236. package/lib-prod/features/index.js +0 -5
  237. package/lib-prod/features/index.js.map +0 -1
  238. package/lib-prod/features/types.d.ts +0 -4
  239. package/lib-prod/features/types.js +0 -2
  240. package/lib-prod/features/types.js.map +0 -1
  241. package/lib-prod/features/withLanguageLocalStorageSync.d.ts +0 -9
  242. package/lib-prod/features/withLanguageLocalStorageSync.js +0 -35
  243. package/lib-prod/features/withLanguageLocalStorageSync.js.map +0 -1
  244. package/lib-prod/features/withNavigatorLanguage.d.ts +0 -6
  245. package/lib-prod/features/withNavigatorLanguage.js +0 -25
  246. package/lib-prod/features/withNavigatorLanguage.js.map +0 -1
  247. package/lib-prod/features/withPreloadScopes.d.ts +0 -8
  248. package/lib-prod/features/withPreloadScopes.js +0 -21
  249. package/lib-prod/features/withPreloadScopes.js.map +0 -1
  250. package/lib-prod/features/withServerSideLanguage.d.ts +0 -6
  251. package/lib-prod/features/withServerSideLanguage.js +0 -25
  252. package/lib-prod/features/withServerSideLanguage.js.map +0 -1
  253. package/lib-prod/features/withTranslatedTitle.d.ts +0 -34
  254. package/lib-prod/features/withTranslatedTitle.js +0 -65
  255. package/lib-prod/features/withTranslatedTitle.js.map +0 -1
  256. package/lib-prod/internals.d.ts +0 -2
  257. package/lib-prod/internals.js +0 -3
  258. package/lib-prod/internals.js.map +0 -1
  259. package/lib-prod/transignal-config.d.ts +0 -34
  260. package/lib-prod/transignal-config.js +0 -36
  261. package/lib-prod/transignal-config.js.map +0 -1
  262. package/lib-prod/transignal-param-handlers.d.ts +0 -11
  263. package/lib-prod/transignal-param-handlers.js +0 -25
  264. package/lib-prod/transignal-param-handlers.js.map +0 -1
  265. package/lib-prod/transignal-service.d.ts +0 -32
  266. package/lib-prod/transignal-service.js +0 -197
  267. package/lib-prod/transignal-service.js.map +0 -1
  268. package/lib-prod/transignal-testing.d.ts +0 -8
  269. package/lib-prod/transignal-testing.js +0 -10
  270. package/lib-prod/transignal-testing.js.map +0 -1
  271. package/lib-prod/types.d.ts +0 -124
  272. package/lib-prod/types.js +0 -2
  273. package/lib-prod/types.js.map +0 -1
  274. package/lib-prod/utility-types.d.ts +0 -29
  275. package/lib-prod/utility-types.js +0 -2
  276. package/lib-prod/utility-types.js.map +0 -1
  277. package/lib-prod/utils.d.ts +0 -15
  278. package/lib-prod/utils.js +0 -15
  279. package/lib-prod/utils.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, EnvironmentInjector, signal, computed, runInInjectionContext, untracked, resource, Injectable, InjectionToken, makeEnvironmentProviders, provideAppInitializer, PLATFORM_ID, effect, DOCUMENT } from '@angular/core';
3
- import { isPlatformBrowser, isPlatformServer } from '@angular/common';
4
- import { Title } from '@angular/platform-browser';
5
- import { TitleStrategy, Router } from '@angular/router';
2
+ import { inject, ChangeDetectorRef, signal, ElementRef, DestroyRef, Input, Directive, Pipe, Injectable } from '@angular/core';
3
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
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';
6
6
 
7
7
  // THIS FILE IS GENERATED - DO NOT MODIFY
8
8
  /**
@@ -28,16 +28,15 @@ 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 = '0.0.1';
31
+ const CURRENT_PACKAGE_VERSION = '21.0.7';
32
32
  // THIS FILE IS GENERATED - DO NOT MODIFY
33
33
 
34
- const INTERNAL_TRANSIGNAL_CONFIG = Symbol('INTERNAL_TRANSIGNAL_CONFIG');
35
- const TREE_SHAKED_TRANSLATIONS = Symbol('TREE_SHAKED_TRANSLATIONS');
36
-
37
34
  //#region tnp-helpers cli template
35
+ // import { CoreModels } from 'tnp-core/src';
38
36
  // import { Helpers, BaseCommandLineFeature } from 'tnp-helpers/src';
39
37
  // import { BaseProject, BaseStartConfig } from 'tnp-helpers/src'; // @backend
40
- // class $Version extends BaseCommandLineFeature<{}> {
38
+ // class $Global extends BaseCommandLineFeature<{}> {
39
+ // static [CoreModels.ClassNameStaticProperty] = '';
41
40
  // public _() {
42
41
  // console.log(`Hello world from cli`);
43
42
  // this._exit();
@@ -77,433 +76,1458 @@ async function startCli(argsv, filename) {
77
76
  return (void 0);
78
77
  }
79
78
 
80
- /**
81
- * Param handler which allows for specification of basic params: `{name}`
82
- *
83
- * @param translation Translated text
84
- * @param params Params provided to translation function
85
- */
86
- const simpleParamsHandler = (translation, params) => {
87
- if (!params)
88
- return translation;
89
- for (const [key, value] of Object.entries(params)) {
90
- translation = translation.replaceAll(`{${key}}`, simpleParamValueStringify(value));
91
- }
92
- return translation;
93
- };
94
- const noParamsHandler = translation => translation;
95
- const simpleParamValueStringify = (paramValue) => {
96
- if (typeof paramValue === 'string') {
97
- return paramValue;
98
- }
99
- if (paramValue == null) {
100
- return '';
101
- }
102
- return paramValue.toString();
103
- };
104
-
105
- /**
106
- * Main transignal service, used to process and cache translations
107
- * Can be injected directly or with use of transignal object created with {@link prepareTransignal} function (recommended)
108
- */
109
- class TransignalService {
79
+ //#region import
80
+ //#endregion
81
+ //#region constants
82
+ const globalStorageKeyMainLanguage = 'taon-gettext-main-language';
83
+ const globalTaonLanguageLocalKeyLocalStor = 'taon-language-local';
84
+ //#endregion
85
+ class TranslationManager {
110
86
  constructor() {
111
- this.injector = inject(EnvironmentInjector);
112
- this.config = injectTransignalConfig();
113
- this.paramsHandler = this.config.paramHandler ?? simpleParamsHandler;
114
- this.loadingFn = this.config.loadingFn ?? (() => '...');
115
- // eslint-disable-next-line no-console
116
- this.errorHandler = this.config.errorHandler ?? console.error; // TODO maybe add a link to error page in docs
117
- this.loadingCount = signal(0, ...(ngDevMode ? [{ debugName: "loadingCount" }] : []));
118
- this.scopeMap = new Map();
119
- this.languageMap = new Map();
87
+ this.instances = new Set();
88
+ //#region current global language
89
+ this.defaultLangLocale = (() => {
90
+ //#region @browser
91
+ return (localStorage.getItem(globalTaonLanguageLocalKeyLocalStor) ||
92
+ UtilsI18n__NS__detectLocale());
93
+ //#endregion
94
+ return UtilsI18n__NS__defaultLangLocale;
95
+ })();
96
+ this._currentGlobalLanguage = this
97
+ .defaultLangLocale;
98
+ this.currentGlobalLanguageSrc = new BehaviorSubject(this.currentGlobalLanguage);
99
+ this.currentGlobalLanguage$ = this.currentGlobalLanguageSrc
100
+ .asObservable()
101
+ .pipe(tap(currentGlobalLanguage => {
102
+ GlobalStorage.set(globalStorageKeyMainLanguage, currentGlobalLanguage);
103
+ // console.log(`Update from subject ${currentGlobalLanguage}`);
104
+ }));
105
+ //#endregion
106
+ //#region available langs
107
+ this.availableLangs = ___NS__cloneDeep(UtilsI18n__NS__LangOptionArr);
108
+ this.availableLangsSrc = new BehaviorSubject(this.availableLangs);
109
+ this.availableLangs$ = this.availableLangsSrc.asObservable().pipe(map(f => {
110
+ if (this.visibleLanguages.length > 0) {
111
+ // console.log('Filtering langs')
112
+ return f.filter(a => this.visibleLanguages.includes(a.code));
113
+ }
114
+ return f;
115
+ }));
116
+ //#endregion
117
+ //#region visible langs
118
+ this._visibleLanguages = [];
119
+ this.visibleLanguagesSrc = new BehaviorSubject(this.visibleLanguages);
120
+ this.visibleLanguages$ = this.visibleLanguagesSrc.asObservable();
121
+ //#endregion
122
+ //#region loading langs subject
120
123
  /**
121
- * Use to set or get active language
124
+ * TODO
122
125
  */
123
- this.activeLang = signal(this.config.defaultLang, ...(ngDevMode ? [{ debugName: "activeLang" }] : []));
126
+ this.loadingLangsSubjectSrc = new BehaviorSubject(false);
124
127
  /**
125
- * Use to determine whether service is currently loading translation files
128
+ * TODO
126
129
  */
127
- this.isLoading = computed(() => this.loadingCount() > 0, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
130
+ this.isLoadingLangs$ = this.loadingLangsSubjectSrc.asObservable();
131
+ //#endregion
132
+ this.pernamentLanguage = null;
133
+ // console.log(`[i18] Default lang: ${this.defaultLangLocale}`);
128
134
  }
129
- t(scope) {
130
- const existing = this.scopeMap.get(scope);
131
- if (existing) {
132
- return existing;
135
+ get currentGlobalLanguage() {
136
+ return this._currentGlobalLanguage;
137
+ }
138
+ set currentGlobalLanguage(v) {
139
+ this._currentGlobalLanguage = v;
140
+ this.currentGlobalLanguageSrc.next(v);
141
+ }
142
+ get visibleLanguages() {
143
+ return this._visibleLanguages;
144
+ }
145
+ set visibleLanguages(v) {
146
+ if (this.pernamentLanguage) {
147
+ v = v.filter(a => [this.pernamentLanguage].includes(a));
133
148
  }
134
- const scopeObj = this.initT(scope);
135
- this.scopeMap.set(scope, scopeObj);
136
- return scopeObj;
137
- }
138
- initT(scope) {
139
- const cache = new Map();
140
- const t = ((key, params) => {
141
- const lang = this.activeLang();
142
- const baseKey = `${lang}/${key}`;
143
- const memoKey = params ? `${baseKey}_${JSON.stringify(params)}` : baseKey;
144
- const alreadyComputed = cache.get(memoKey);
145
- if (alreadyComputed) {
146
- return alreadyComputed;
147
- }
148
- const { isLoading, error, value } = this.fetchLanguage(scope, lang);
149
- if (isLoading()) {
150
- return this.loadingFn?.(key);
151
- }
152
- if (error() || !value()) {
153
- this.errorHandler('missing_file', error());
154
- return '';
155
- }
156
- const result = this.replaceParams(this.resolveObjectPath(value(), key), params);
157
- cache.set(memoKey, result);
158
- return result;
159
- }); // needed as other props are assigned below
160
- t.arr = t;
161
- t.obj = t;
162
- t.prefix = this.preparePrefixFn(t, 1);
163
- t.plural = this.preparePluralFn(t);
164
- t.select = this.prepareSelectFn(t);
165
- return t;
166
- }
167
- preparePrefixFn(t, depth) {
168
- return (prefix) => {
169
- const prefixedT = (key, params) => t(`${prefix}.${key}`, params);
170
- prefixedT.arr = prefixedT;
171
- prefixedT.obj = prefixedT;
172
- prefixedT.plural = this.preparePluralFn(prefixedT);
173
- prefixedT.select = this.prepareSelectFn(prefixedT);
174
- prefixedT.prefix =
175
- this.config.maxPrefixDepth || 3 >= depth
176
- ? this.preparePrefixFn(prefixedT, depth + 1)
177
- : () => {
178
- this.errorHandler('prefix_too_deep');
179
- const t = () => '';
180
- t.arr = () => [];
181
- t.obj = () => ({});
182
- t.plural = () => '';
183
- return t;
184
- };
185
- return prefixedT;
186
- };
149
+ this._visibleLanguages = v;
150
+ this.visibleLanguagesSrc.next(v);
151
+ this.availableLangsSrc.next(this.availableLangs);
187
152
  }
188
- preparePluralFn(t) {
189
- return (key, count, params) => {
190
- const plurals = t(key, { count, ...params });
191
- if (typeof plurals === 'string') {
192
- if (plurals === this.loadingFn(key)) {
193
- return plurals;
194
- }
195
- this.errorHandler('invalid_plural', key, plurals);
196
- return plurals;
197
- }
198
- if (plurals[count]) {
199
- return plurals[count];
200
- }
201
- const valueLastDigit = +count.toFixed(0).at(-1);
202
- if (plurals.one && valueLastDigit === 1) {
203
- return plurals.one;
204
- }
205
- if (plurals.many && valueLastDigit >= 5) {
206
- return plurals.many;
207
- }
208
- if (plurals.few && valueLastDigit > 1 && valueLastDigit < 5) {
209
- return plurals.few;
210
- }
211
- if (plurals.other) {
212
- return plurals.other;
213
- }
214
- this.errorHandler('missing_plural', key, plurals, count);
215
- return '';
153
+ static get Instance() {
154
+ if (!this._instance) {
155
+ this._instance = new TranslationManager();
156
+ }
157
+ return this._instance;
158
+ }
159
+ setOneLanguagePernament(lang) {
160
+ console.info(`Setting pernament language to ${lang}`);
161
+ if (this.pernamentLanguage) {
162
+ console.log('You are trying to set again pernament language');
163
+ return;
164
+ }
165
+ this.visibleLanguages = [lang];
166
+ // @ts-ignore
167
+ this.pernamentLanguage = lang;
168
+ void this.changeGlobalLang(lang);
169
+ }
170
+ //#region change global lang
171
+ async changeGlobalLang(lang) {
172
+ this.loadingLangsSubjectSrc.next(true);
173
+ this.currentGlobalLanguage = lang;
174
+ localStorage.setItem(globalTaonLanguageLocalKeyLocalStor, lang);
175
+ try {
176
+ await Promise.all([...this.instances].map(c => c.useGlobalFileLang(lang)));
177
+ }
178
+ catch (error) {
179
+ console.error(error);
180
+ }
181
+ this.loadingLangsSubjectSrc.next(false);
182
+ // console.info('Done changing language');
183
+ }
184
+ }
185
+
186
+ //#region imports
187
+ //#endregion
188
+ //#region translation class
189
+ class Translation {
190
+ static { this.manager = TranslationManager.Instance; }
191
+ //#region static for
192
+ static for(fileRelativePath, langImportMap, opt) {
193
+ opt = opt || {};
194
+ return new Translation(fileRelativePath, Translation.manager.currentGlobalLanguage, langImportMap, !!opt.debug);
195
+ }
196
+ //#endregion
197
+ //#region constructor
198
+ constructor(fileRelativePath, localFileLang, langImportMap, debug = false) {
199
+ this.fileRelativePath = fileRelativePath;
200
+ this.localFileLang = localFileLang;
201
+ this.langImportMap = langImportMap;
202
+ this.debug = debug;
203
+ //#endregion
204
+ this.lookup = {};
205
+ this.loadingSubjectSrc = new BehaviorSubject(false);
206
+ this.isLoadingLang$ = this.loadingSubjectSrc.asObservable();
207
+ this.bindings = new Set();
208
+ this.useGlobalLangFile = true;
209
+ //#endregion
210
+ //#region gettext
211
+ this.gettext = (text, params, context = '') => {
212
+ const key = this.key(text, context);
213
+ const translated = this.lookup[key] ?? text;
214
+ this.debug &&
215
+ console.log(`Translate (with load): "${text}" to "${translated}", key="${key}" params:${___NS__isObject(params) ? JSON.stringify(params) : params} ` +
216
+ `localFileLang: ${this.localFileLang}`, this);
217
+ return this.interpolate(translated, params);
218
+ };
219
+ this.signal = {
220
+ gettext: (text, params, context) => this.createSignal(text, params, context),
216
221
  };
222
+ this.$ = {
223
+ gettext: (text, params, context) => this.createObservable(text, params, context),
224
+ };
225
+ if (!Translation.manager.instances.has(this)) {
226
+ Translation.manager.instances.add(this);
227
+ }
217
228
  }
218
- prepareSelectFn(t) {
219
- return (key, value, params) => {
220
- const selects = t(key, { value, ...params });
221
- if (typeof selects === 'string') {
222
- if (selects === this.loadingFn(key)) {
223
- return selects;
224
- }
225
- this.errorHandler('invalid_select', key, selects);
226
- return selects;
227
- }
228
- if (value !== null) {
229
- if (selects[value]) {
230
- return selects[value];
229
+ //#endregion
230
+ //#region for
231
+ for(_classThis) {
232
+ //#region @browser
233
+ if (this.useGlobalFileLang) {
234
+ this.localFileLang = Translation.manager.currentGlobalLanguage;
235
+ // console.log(`Update on t.for() ${this.localFileLang}`)
236
+ }
237
+ try {
238
+ this.cdr = inject(ChangeDetectorRef);
239
+ }
240
+ catch {
241
+ // non-angular class/backend-safe
242
+ }
243
+ //#endregion
244
+ void this.ensureLoaded();
245
+ return this;
246
+ }
247
+ //#endregion
248
+ //#region change file lang
249
+ async changeFileLang(lang) {
250
+ this.useGlobalLangFile = false;
251
+ this.localFileLang = lang;
252
+ await this.ensureLoaded(true);
253
+ //#region @browser
254
+ this.cdr?.markForCheck();
255
+ //#endregion
256
+ }
257
+ //#endregion
258
+ //#region use global file lang
259
+ async useGlobalFileLang(lang) {
260
+ this.useGlobalLangFile = true;
261
+ await this.ensureLoaded(true);
262
+ //#region @browser
263
+ this.cdr?.markForCheck();
264
+ //#endregion
265
+ }
266
+ //#endregion
267
+ //#region signal
268
+ createSignal(text, params, context = '') {
269
+ const s = signal(this.gettext(text, params, context), ...(ngDevMode ? [{ debugName: "s" }] : []));
270
+ this.bindings.add({
271
+ text,
272
+ params,
273
+ context,
274
+ update: value => s.set(value),
275
+ });
276
+ return s;
277
+ }
278
+ //#endregion
279
+ //#region $ obserable
280
+ createObservable(text, params, context = '') {
281
+ const subject = new BehaviorSubject(this.gettext(text, params, context));
282
+ this.bindings.add({
283
+ text,
284
+ params,
285
+ context,
286
+ update: value => subject.next(value),
287
+ });
288
+ return subject.asObservable();
289
+ }
290
+ //#endregion
291
+ //#region private methods / refresh bindings
292
+ refreshBindings() {
293
+ for (const binding of this.bindings) {
294
+ binding.update(this.gettextWithoutEnsureLoaded(binding.text, binding.params, binding.context ?? ''));
295
+ }
296
+ }
297
+ //#endregion
298
+ //#region private methods / gettextwithout ensure loadded
299
+ translate(text, params, context = '') {
300
+ return this.gettextWithoutEnsureLoaded(text, params, context);
301
+ }
302
+ gettextWithoutEnsureLoaded(text, params, context = '') {
303
+ const key = this.key(text, context);
304
+ const translated = this.lookup[key] ?? text;
305
+ this.debug &&
306
+ console.log(`Translate (no load): "${text}" to "${translated}", key="${key}" params:${___NS__isObject(params) ? JSON.stringify(params) : params} ` +
307
+ `localFileLang: ${this.localFileLang}`, this);
308
+ return this.interpolate(translated, params);
309
+ }
310
+ //#endregion
311
+ //#region private methods / load
312
+ async load() {
313
+ this.loadingSubjectSrc.next(true);
314
+ const files = [];
315
+ const filesForTArr = Object.keys(this.langImportMap);
316
+ for (const fileRelativePath of filesForTArr) {
317
+ try {
318
+ const loader = this.langImportMap[fileRelativePath]?.[this.localFileLang];
319
+ if (!loader) {
320
+ continue;
231
321
  }
322
+ const modOrFile = await loader();
323
+ const file = modOrFile.default ?? modOrFile;
324
+ files.push(file);
232
325
  }
233
- else if (selects['null']) {
234
- return selects['null'];
326
+ catch (err) {
327
+ console.log(`[taon-i18n] Error loading language file ${fileRelativePath} `, err);
235
328
  }
236
- this.errorHandler('missing_select', key, selects, value);
237
- return '';
238
- };
329
+ }
330
+ this.loadedLang = this.localFileLang;
331
+ this.lookup = this.createLookup(files);
332
+ this.debug && console.log(`${this.localFileLang}`, files, this.lookup);
333
+ this.refreshBindings();
334
+ //#region @browser
335
+ this.cdr?.markForCheck();
336
+ //#endregion
337
+ this.loadingSubjectSrc.next(false);
239
338
  }
240
- replaceParams(translation, params) {
241
- if (!translation)
242
- return translation;
243
- if (typeof translation === 'string') {
244
- return this.paramsHandler(translation, params);
339
+ //#endregion
340
+ //#region private methods / ensure loaded
341
+ async ensureLoaded(force = false) {
342
+ if (this.useGlobalLangFile) {
343
+ this.localFileLang = Translation.manager.currentGlobalLanguage;
245
344
  }
246
- if (Array.isArray(translation)) {
247
- return translation.map(val => this.replaceParams(val, params));
345
+ if (!force && this.loadedLang === this.localFileLang) {
346
+ return;
248
347
  }
249
- if (typeof translation === 'object') {
250
- return Object.entries(translation).reduce((prev, [objKey, objVal]) => {
251
- prev[objKey] = this.replaceParams(objVal, params);
252
- return prev;
253
- }, {});
348
+ if (!force && this.loading) {
349
+ return this.loading;
254
350
  }
255
- return translation;
256
- }
257
- fetchLanguage(scope, lang) {
258
- const cacheKey = `${scope}/${lang}`;
259
- const existing = this.languageMap.get(cacheKey);
260
- if (existing)
261
- return existing;
262
- const { translations, loader } = this.config;
263
- const translation = runInInjectionContext(this.injector, () => translations === TREE_SHAKED_TRANSLATIONS
264
- ? untracked(() => resource({
265
- loader: async () => {
266
- this.loadingCount.update(count => ++count);
267
- const file = await runInInjectionContext(this.injector, () => loader(scope, lang));
268
- this.loadingCount.update(count => --count);
269
- return file;
270
- },
271
- }))
272
- : {
273
- value: signal(translations[scope]),
274
- isLoading: signal(false),
275
- error: signal(undefined),
276
- });
277
- this.languageMap.set(cacheKey, translation);
278
- return translation;
279
- }
280
- resolveObjectPath(obj, path) {
281
- const keys = path.split('.');
282
- let current = obj;
283
- for (const key of keys) {
284
- if (current && typeof current === 'object') {
285
- current = current[key];
286
- }
287
- else {
288
- this.errorHandler('missing_key', { obj, path });
289
- return undefined;
351
+ this.loading = this.load();
352
+ try {
353
+ await this.loading;
354
+ }
355
+ finally {
356
+ this.loading = undefined;
357
+ }
358
+ }
359
+ //#endregion
360
+ //#region private methods / create lookup
361
+ createLookup(files) {
362
+ const lookup = {};
363
+ for (const file of files) {
364
+ for (const tag of file.tags ?? []) {
365
+ if (!tag.translation)
366
+ continue;
367
+ lookup[this.key(tag.gettextString, tag.context ?? '')] =
368
+ tag.translation;
290
369
  }
291
370
  }
292
- return current;
371
+ return lookup;
372
+ }
373
+ //#endregion
374
+ //#region private methods / key
375
+ key(text, context = '') {
376
+ return `${context}\u0004${text}`;
377
+ }
378
+ //#endregion
379
+ //#region private methods / interpolate
380
+ interpolate(text, params) {
381
+ if (!params)
382
+ return text;
383
+ const result = text.replace(/\[\[\s*([a-zA-Z0-9_$]+)\s*\]\]/g, (_, key) => {
384
+ const value = params[key];
385
+ return value === undefined || value === null ? '' : String(value);
386
+ });
387
+ return result;
293
388
  }
294
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TransignalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
295
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TransignalService }); }
296
389
  }
297
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TransignalService, decorators: [{
298
- type: Injectable
299
- }] });
390
+ //#endregion
391
+ //#region EXMAPLE
392
+ /*
393
+ // import {Translation} from 'taon'
300
394
 
301
- /**
302
- * Utility function to define a type of translations for type inference
303
- */
304
- const treeShakedTranslations = () => TREE_SHAKED_TRANSLATIONS;
305
- const TRANSIGNAL_CONFIG = new InjectionToken('TRANSIGNAL_CONFIG');
306
- /**
307
- * Use to inject transignal config
308
- */
309
- const injectTransignalConfig = () => inject(TRANSIGNAL_CONFIG);
310
- /**
311
- * Prepares type-safe transignal object
312
- * @param config Transignal configruation {@link TransignalConfig}
313
- * @param features Extra tree-shakeable features
314
- * - {@link withPreloadScopes} - preloads selected scopes
315
- * - {@link withServerSideLanguage} - sets language based on `document.lang` in SSR environment
316
- * - {@link withNavigatorLanguage} - sets language based on `navigator.language` in browser environment
317
- * - {@link withLanguageLocalStorageSync} - syncs language with localStorage
318
- * - {@link withTranslatedTitle} - enables translation of page title
319
- */
320
- const prepareTransignal = (config, ...features) => {
321
- const service = () => inject(TransignalService);
322
- return {
323
- [INTERNAL_TRANSIGNAL_CONFIG]: { config, features },
324
- provide: () => makeEnvironmentProviders([
325
- { provide: TRANSIGNAL_CONFIG, useValue: config },
326
- TransignalService,
327
- features.map(feature => feature.providers),
328
- ]),
329
- service,
330
- t: (scope) => service().t(scope),
331
- };
332
- };
395
+ const t = Translation.for('src/lib/translation.ts', {}); // in runtime replaced with proper stuff
333
396
 
334
- /**
335
- * Provides unit-test version of transignal that loads translation instantly without loading
336
- *
337
- * @param transignal existing transignal instance
338
- * @param translations real translations in a selected language
339
- */
340
- const provideTransignalTesting = (transignal, translations) => prepareTransignal({ ...transignal[INTERNAL_TRANSIGNAL_CONFIG].config, translations }, ...transignal[INTERNAL_TRANSIGNAL_CONFIG].features).provide();
397
+ t.gettext('asdasd');
341
398
 
342
- /**
343
- * Utility to create a plural translation that can differ between languages and includes variants of translations for different plurals
344
- * Can be used with {@link TranslateObj.plural}
345
- * Translations may use automatic param: `{count}`
346
- * @param translation plural translation object
347
- */
348
- const plural = (translation) => translation;
349
- /**
350
- * Utility to create a select translation
351
- * Can be used with {@link TranslateObj.select}
352
- * Translations may use automatic param: `{value}`
353
- * @param translation select translation object
354
- */
355
- const select = (translation) => translation;
399
+ class AnyAngularOrTaonClass {
400
+ t = t.for(this); // probably only usefull for cdr in angular
356
401
 
357
- /**
358
- * Saves user selected language in selected storage e.g. localStorage
359
- * Works only in browser environment
360
- *
361
- * @param key Key under which it should save the language in storage
362
- * @param storage Storage to be used e.g. localStorage or sessionStorage
363
- */
364
- const withLanguageLocalStorageSync = (key = 'LANG', storage = 'localStorage') => {
365
- return {
366
- providers: [
367
- provideAppInitializer(() => {
368
- if (isPlatformBrowser(inject(PLATFORM_ID))) {
369
- const transignalService = inject(TransignalService);
370
- const store = window[storage];
371
- const savedLanguage = store.getItem(key);
372
- if (savedLanguage) {
373
- const { availableLangs } = injectTransignalConfig();
374
- if (availableLangs.includes(savedLanguage)) {
375
- transignalService.activeLang.set(savedLanguage);
376
- }
377
- }
378
- effect(() => {
379
- const updatedLang = transignalService.activeLang();
380
- store.setItem(key, updatedLang);
381
- });
382
- }
383
- }),
384
- ],
385
- };
386
- };
402
+ isLoading$ = t.isLoadingLang$; // maybe needed sometime
387
403
 
388
- /**
389
- * Sets active language depending on `navigator.language`, which represents user defined browser settings
390
- * Works only in browser environment
391
- */
392
- const withNavigatorLanguage = () => {
393
- return {
394
- providers: [
395
- provideAppInitializer(() => {
396
- if (isPlatformBrowser(inject(PLATFORM_ID))) {
397
- const transignalService = inject(TransignalService);
398
- const { availableLangs } = injectTransignalConfig();
399
- const preferredLanguage = navigator.languages.map(language => language.split('-')[0].toLowerCase()).find(language => availableLangs.includes(language));
400
- if (preferredLanguage) {
401
- transignalService.activeLang.set(preferredLanguage);
402
- }
403
- }
404
- }),
405
- ],
406
- };
407
- };
404
+ refreshableSignalLabel$ = t.signal.gettext(t.gettext('welcome'));
408
405
 
409
- /**
410
- * Preloads selected scopes in default language
411
- * Use after language init by {@link withServerSideLanguage} or {@link withNavigatorLanguage}
412
- * @param scopes Scopes which should be preloaded
413
- */
414
- const withPreloadScopes = (scopes) => {
415
- return {
416
- providers: [
417
- provideAppInitializer(() => {
418
- const transignalService = inject(TransignalService);
419
- effect(() => {
420
- const _activeLang = transignalService.activeLang();
421
- scopes.forEach(scope => transignalService.t(scope)(''));
422
- });
423
- }),
424
- ],
425
- };
426
- };
406
+ refreshableRxjsLabel$ = t.$.gettext('amazing better place'); // probably even better
427
407
 
428
- /**
429
- * Sets active language depending on `document.lang` attribute which should be set by the server.ts depending on `Accept-language` header
430
- * Works only in SSR environment
431
- */
432
- const withServerSideLanguage = () => {
433
- return {
434
- providers: [
435
- provideAppInitializer(() => {
436
- if (isPlatformServer(inject(PLATFORM_ID))) {
437
- const transignalService = inject(TransignalService);
438
- const { documentElement } = inject(DOCUMENT);
439
- const { availableLangs } = injectTransignalConfig();
440
- if (availableLangs.includes(documentElement.lang)) {
441
- transignalService.activeLang.set(documentElement.lang);
442
- }
443
- }
444
- }),
445
- ],
446
- };
447
- };
408
+ asdsa = this.t.gettext(
409
+ // just sugar syntax
410
+ 'This is mamazing',
411
+ {
412
+ asdasd: 'asd',
413
+ },
414
+ 'asdas',
415
+ );
416
+
417
+ ngOnInit(): void {
418
+ //Called after the constructor, initializing input properties, and the first call to ngOnChanges.
419
+ //Add 'implements OnInit' to the class.
420
+ const lable = t.gettext('hello');
421
+ }
422
+ }
423
+ */
424
+ //#endregion
448
425
 
449
- class TransignalTitleStrategy extends TitleStrategy {
450
- constructor(t) {
451
- super();
452
- this.t = t;
453
- this.title = inject(Title);
454
- this.injector = inject(EnvironmentInjector);
426
+ class TranslateDirective {
427
+ constructor() {
428
+ this.initialized = false;
429
+ this.element = inject((ElementRef));
430
+ this.destroyRef = inject(DestroyRef);
431
+ this.originalText = '';
432
+ }
433
+ ngOnInit() {
434
+ this.originalText = this.element.nativeElement.textContent?.trim() ?? '';
435
+ this.initialized = true;
436
+ this.render();
437
+ this.t.isLoadingLang$
438
+ .pipe(takeUntilDestroyed(this.destroyRef))
439
+ .subscribe(() => {
440
+ // this.t.debug && console.log(`Rerender "${this.originalText}"`)
441
+ this.render();
442
+ });
455
443
  }
456
- updateTitle(routerState) {
457
- this.effectRef?.destroy();
458
- const router = this.injector.get(Router);
459
- const title = this.buildTitle(routerState) || 'default';
460
- const translation = computed(() => this.t(title, router.getCurrentNavigation()?.extras.state), ...(ngDevMode ? [{ debugName: "translation" }] : []));
461
- this.effectRef = runInInjectionContext(this.injector, () => effect(() => this.title.setTitle(translation()), { manualCleanup: true }));
444
+ ngOnChanges() {
445
+ if (!this.initialized)
446
+ return;
447
+ // this.t.debug && console.log(`On Chnags for "${this.originalText}"`)
448
+ this.render();
462
449
  }
450
+ ngOnDestroy() { }
451
+ render() {
452
+ // console.log('render', this);
453
+ this.element.nativeElement.textContent = this.t.translate(this.originalText, this.params, this.translateContext);
454
+ //#region @browser
455
+ // this.t.cdr?.markForCheck();
456
+ //#endregion
457
+ }
458
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
459
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.9", type: TranslateDirective, isStandalone: true, selector: "[translate]", inputs: { t: ["translate-t", "t"], params: ["translate-params", "params"], translateContext: ["translate-context", "translateContext"] }, usesOnChanges: true, ngImport: i0 }); }
463
460
  }
464
- /**
465
- * Enables translation of title param in route definition with use of prepared {@link TitleStrategy}
466
- * Automatically translates `title` param form route definition, sets website title and updates on language changes
467
- * Also it is possible to use parameters from `navigation.extras.state`
468
- *
469
- * @example
470
- * ```typescript
471
- * // src/app/app.routes.ts
472
- * export const routes = [
473
- * { path: 'base', title: 'base', children: [
474
- * { path: 'child', title: 'child' },
475
- * ],
476
- * { path: 'aux', outlet: 'popup', title: 'popupTitle' }
477
- * ];
478
- *
479
- * // src/app/transignal.ts
480
- * export const transignal = prepareTransignal(<config>, withTranslatedTitle('global'));
481
- *
482
- * // src/app/i18n/global/en.ts
483
- * export default {
484
- * title: {
485
- * base: 'Base title',
486
- * child: 'Child title'
487
- * popupTitle: 'Popup title'
488
- * }
489
- * };
490
- * ```
491
- *
492
- * @param scope scope under which there are title translations
493
- * @param translationKey translation key under which there are translations, `title` by default
494
- */
495
- const withTranslatedTitle = (scope, translationKey = 'title') => {
496
- return {
497
- providers: [
498
- makeEnvironmentProviders([
499
- {
500
- provide: TitleStrategy,
501
- useFactory: (service = inject(TransignalService)) => new TransignalTitleStrategy(service.t(scope).prefix(translationKey)),
502
- },
503
- ]),
504
- ],
505
- };
506
- };
461
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslateDirective, decorators: [{
462
+ type: Directive,
463
+ args: [{
464
+ selector: '[translate]',
465
+ standalone: true,
466
+ }]
467
+ }], propDecorators: { t: [{
468
+ type: Input,
469
+ args: ['translate-t']
470
+ }], params: [{
471
+ type: Input,
472
+ args: ['translate-params']
473
+ }], translateContext: [{
474
+ type: Input,
475
+ args: ['translate-context']
476
+ }] } });
477
+
478
+ class TranslatePipe {
479
+ constructor() {
480
+ this.cdr = inject(ChangeDetectorRef);
481
+ this.tranlsationManager = TranslationManager.Instance;
482
+ this.sub = this.tranlsationManager.isLoadingLangs$.subscribe(() => {
483
+ this.cdr.markForCheck();
484
+ });
485
+ }
486
+ transform(text, t, params, context) {
487
+ return t?.gettext(text, params, context) ?? text;
488
+ }
489
+ ngOnDestroy() {
490
+ this.sub.unsubscribe();
491
+ }
492
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
493
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.9", ngImport: i0, type: TranslatePipe, isStandalone: true, name: "translate", pure: false }); }
494
+ }
495
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslatePipe, decorators: [{
496
+ type: Pipe,
497
+ args: [{
498
+ name: 'translate',
499
+ standalone: true,
500
+ pure: false,
501
+ }]
502
+ }], ctorParameters: () => [] });
503
+
504
+ class TranslateService {
505
+ constructor() {
506
+ this.manager = TranslationManager.Instance;
507
+ /**
508
+ * TODO
509
+ */
510
+ this.isLoadingLangs$ = this.manager.isLoadingLangs$;
511
+ this.availableLangs$ = this.manager.availableLangs$;
512
+ this.currentGlobalLanguage$ = this.manager.currentGlobalLanguage$;
513
+ }
514
+ setOneLanguagePernament(lang) {
515
+ this.manager.setOneLanguagePernament(lang);
516
+ }
517
+ //#region change global lang
518
+ async changeGlobalLang(lang) {
519
+ await this.manager.changeGlobalLang(lang);
520
+ }
521
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
522
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslateService, providedIn: 'root' }); }
523
+ }
524
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslateService, decorators: [{
525
+ type: Injectable,
526
+ args: [{ providedIn: 'root' }]
527
+ }] });
528
+
529
+ //#endregion
530
+ //namespace UtilsI18nExtractGettextTranslateFromHtml
531
+ function UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml(html, fileName = 'template.html') {
532
+ /* */
533
+ /* */
534
+ /* */
535
+ /* */
536
+ /* */
537
+ /* */
538
+ /* */
539
+ /* */
540
+ /* */
541
+ /* */
542
+ /* */
543
+ /* */
544
+ /* */
545
+ /* */
546
+ /* */
547
+ /* */
548
+ /* */
549
+ /* */
550
+ /* */
551
+ /* */
552
+ /* */
553
+ /* */
554
+ /* */
555
+ /* */
556
+ /* */
557
+ /* */
558
+ /* */
559
+ /* */
560
+ /* */
561
+ /* */
562
+ /* */
563
+ /* */
564
+ /* */
565
+ /* */
566
+ /* */
567
+ /* */
568
+ /* */
569
+ /* */
570
+ /* */
571
+ /* */
572
+ /* */
573
+ /* */
574
+ /* */
575
+ /* */
576
+ /* */
577
+ /* */
578
+ /* */
579
+ /* */
580
+ /* */
581
+ /* */
582
+ /* */
583
+ /* */
584
+ /* */
585
+ /* */
586
+ /* */
587
+ /* */
588
+ /* */
589
+ /* */
590
+ /* */
591
+ /* */
592
+ /* */
593
+ /* */
594
+ /* */
595
+ /* */
596
+ /* */
597
+ /* */
598
+ /* */
599
+ /* */
600
+ /* */
601
+ /* */
602
+ /* */
603
+ /* */
604
+ /* */
605
+ /* */
606
+ /* */
607
+ /* */
608
+ /* */
609
+ /* */
610
+ /* */
611
+ /* */
612
+ /* */
613
+ /* */
614
+ /* */
615
+ /* */
616
+ /* */
617
+ /* */
618
+ /* */
619
+ /* */
620
+ /* */
621
+ /* */
622
+ /* */
623
+ /* */
624
+ /* */
625
+ return (void 0);
626
+ }
627
+ function extractGettextCallsFromSource(html) {
628
+ /* */
629
+ /* */
630
+ /* */
631
+ /* */
632
+ /* */
633
+ /* */
634
+ /* */
635
+ /* */
636
+ /* */
637
+ /* */
638
+ /* */
639
+ /* */
640
+ /* */
641
+ /* */
642
+ /* */
643
+ /* */
644
+ /* */
645
+ /* */
646
+ /* */
647
+ /* */
648
+ /* */
649
+ /* */
650
+ /* */
651
+ /* */
652
+ /* */
653
+ /* */
654
+ /* */
655
+ return (void 0);
656
+ }
657
+ function extractGettextCallsFromHtmlExpression(source) {
658
+ /* */
659
+ /* */
660
+ /* */
661
+ /* */
662
+ /* */
663
+ /* */
664
+ /* */
665
+ /* */
666
+ /* */
667
+ /* */
668
+ /* */
669
+ /* */
670
+ /* */
671
+ /* */
672
+ /* */
673
+ /* */
674
+ /* */
675
+ /* */
676
+ /* */
677
+ /* */
678
+ /* */
679
+ /* */
680
+ /* */
681
+ /* */
682
+ /* */
683
+ /* */
684
+ /* */
685
+ /* */
686
+ /* */
687
+ /* */
688
+ /* */
689
+ /* */
690
+ /* */
691
+ /* */
692
+ /* */
693
+ /* */
694
+ return (void 0);
695
+ }
696
+ function readBalancedParenthesesContent(source, openParenIndex) {
697
+ /* */
698
+ /* */
699
+ /* */
700
+ /* */
701
+ /* */
702
+ /* */
703
+ /* */
704
+ /* */
705
+ /* */
706
+ /* */
707
+ /* */
708
+ /* */
709
+ /* */
710
+ /* */
711
+ /* */
712
+ /* */
713
+ /* */
714
+ /* */
715
+ /* */
716
+ /* */
717
+ /* */
718
+ /* */
719
+ /* */
720
+ /* */
721
+ /* */
722
+ /* */
723
+ /* */
724
+ /* */
725
+ /* */
726
+ /* */
727
+ /* */
728
+ /* */
729
+ /* */
730
+ /* */
731
+ /* */
732
+ /* */
733
+ /* */
734
+ /* */
735
+ /* */
736
+ /* */
737
+ /* */
738
+ /* */
739
+ /* */
740
+ /* */
741
+ /* */
742
+ /* */
743
+ /* */
744
+ /* */
745
+ return (void 0);
746
+ }
747
+ function readStaticStringArg(arg) {
748
+ /* */
749
+ /* */
750
+ /* */
751
+ /* */
752
+ /* */
753
+ /* */
754
+ /* */
755
+ /* */
756
+ /* */
757
+ /* */
758
+ /* */
759
+ /* */
760
+ /* */
761
+ /* */
762
+ /* */
763
+ /* */
764
+ return (void 0);
765
+ }
766
+ function extractTranslateParamsFromSource(source) {
767
+ /* */
768
+ /* */
769
+ /* */
770
+ /* */
771
+ /* */
772
+ /* */
773
+ return (void 0);
774
+ }
775
+ function extractObjectLiteralParams(raw) {
776
+ /* */
777
+ /* */
778
+ /* */
779
+ /* */
780
+ /* */
781
+ /* */
782
+ /* */
783
+ /* */
784
+ /* */
785
+ /* */
786
+ /* */
787
+ /* */
788
+ /* */
789
+ /* */
790
+ /* */
791
+ /* */
792
+ /* */
793
+ /* */
794
+ /* */
795
+ /* */
796
+ /* */
797
+ /* */
798
+ /* */
799
+ return (void 0);
800
+ }
801
+ function splitTopLevel(input, separator) {
802
+ /* */
803
+ /* */
804
+ /* */
805
+ /* */
806
+ /* */
807
+ /* */
808
+ /* */
809
+ /* */
810
+ /* */
811
+ /* */
812
+ /* */
813
+ /* */
814
+ /* */
815
+ /* */
816
+ /* */
817
+ /* */
818
+ /* */
819
+ /* */
820
+ /* */
821
+ /* */
822
+ /* */
823
+ /* */
824
+ /* */
825
+ /* */
826
+ /* */
827
+ /* */
828
+ /* */
829
+ /* */
830
+ /* */
831
+ /* */
832
+ /* */
833
+ /* */
834
+ /* */
835
+ /* */
836
+ /* */
837
+ /* */
838
+ return (void 0);
839
+ }
840
+ function extractTranslatePipeStringsFromSource(source) {
841
+ /* */
842
+ /* */
843
+ /* */
844
+ /* */
845
+ /* */
846
+ /* */
847
+ /* */
848
+ /* */
849
+ /* */
850
+ /* */
851
+ /* */
852
+ /* */
853
+ /* */
854
+ /* */
855
+ /* */
856
+ /* */
857
+ /* */
858
+ /* */
859
+ /* */
860
+ /* */
861
+ /* */
862
+ /* */
863
+ /* */
864
+ /* */
865
+ /* */
866
+ /* */
867
+ return (void 0);
868
+ }
869
+ function extractStringLiterals(source) {
870
+ /* */
871
+ /* */
872
+ /* */
873
+ /* */
874
+ /* */
875
+ /* */
876
+ /* */
877
+ /* */
878
+ /* */
879
+ return (void 0);
880
+ }
881
+ function getNodeAttributes(node) {
882
+ /* */
883
+ /* */
884
+ /* */
885
+ /* */
886
+ /* */
887
+ return (void 0);
888
+ }
889
+ function getNodeInputs(node) {
890
+ /* */
891
+ /* */
892
+ /* */
893
+ /* */
894
+ /* */
895
+ return (void 0);
896
+ }
897
+ function isText(node) {
898
+ /* */
899
+ /* */
900
+ /* */
901
+ /* */
902
+ return (void 0);
903
+ }
904
+ function isBoundText(node) {
905
+ /* */
906
+ /* */
907
+ return (void 0);
908
+ }
909
+ function collectText(nodes) {
910
+ /* */
911
+ /* */
912
+ /* */
913
+ /* */
914
+ /* */
915
+ /* */
916
+ /* */
917
+ /* */
918
+ /* */
919
+ /* */
920
+ /* */
921
+ /* */
922
+ /* */
923
+ /* */
924
+ /* */
925
+ /* */
926
+ /* */
927
+ /* */
928
+ /* */
929
+ /* */
930
+ return (void 0);
931
+ }
932
+ function extractTranslateDirectiveFromSource(html) {
933
+ /* */
934
+ /* */
935
+ /* */
936
+ /* */
937
+ /* */
938
+ /* */
939
+ /* */
940
+ /* */
941
+ /* */
942
+ /* */
943
+ /* */
944
+ /* */
945
+ /* */
946
+ /* */
947
+ /* */
948
+ /* */
949
+ /* */
950
+ /* */
951
+ /* */
952
+ /* */
953
+ /* */
954
+ /* */
955
+ /* */
956
+ /* */
957
+ /* */
958
+ /* */
959
+ /* */
960
+ /* */
961
+ return (void 0);
962
+ }
963
+ function stripHtml(html) {
964
+ /* */
965
+ /* */
966
+ return (void 0);
967
+ }
968
+ function extractTranslateParams(inputs) {
969
+ /* */
970
+ /* */
971
+ /* */
972
+ /* */
973
+ /* */
974
+ /* */
975
+ /* */
976
+ /* */
977
+ return (void 0);
978
+ }
979
+ function extractObjectLiteralFromAst(ast) {
980
+ /* */
981
+ /* */
982
+ /* */
983
+ /* */
984
+ /* */
985
+ /* */
986
+ /* */
987
+ /* */
988
+ /* */
989
+ /* */
990
+ /* */
991
+ /* */
992
+ /* */
993
+ /* */
994
+ /* */
995
+ return (void 0);
996
+ }
997
+ function extractTranslatePipeStrings(ast) {
998
+ /* */
999
+ /* */
1000
+ /* */
1001
+ /* */
1002
+ /* */
1003
+ /* */
1004
+ /* */
1005
+ /* */
1006
+ /* */
1007
+ /* */
1008
+ /* */
1009
+ /* */
1010
+ /* */
1011
+ /* */
1012
+ /* */
1013
+ /* */
1014
+ /* */
1015
+ /* */
1016
+ /* */
1017
+ /* */
1018
+ /* */
1019
+ /* */
1020
+ /* */
1021
+ /* */
1022
+ /* */
1023
+ /* */
1024
+ return (void 0);
1025
+ }
1026
+ function extractStaticStringsFromExpression(ast) {
1027
+ /* */
1028
+ /* */
1029
+ /* */
1030
+ /* */
1031
+ /* */
1032
+ /* */
1033
+ /* */
1034
+ /* */
1035
+ /* */
1036
+ /* */
1037
+ /* */
1038
+ /* */
1039
+ /* */
1040
+ /* */
1041
+ /* */
1042
+ /* */
1043
+ /* */
1044
+ /* */
1045
+ /* */
1046
+ /* */
1047
+ /* */
1048
+ /* */
1049
+ return (void 0);
1050
+ }
1051
+ function astToSource(ast) {
1052
+ /* */
1053
+ /* */
1054
+ /* */
1055
+ /* */
1056
+ /* */
1057
+ /* */
1058
+ /* */
1059
+ /* */
1060
+ /* */
1061
+ /* */
1062
+ /* */
1063
+ /* */
1064
+ /* */
1065
+ /* */
1066
+ /* */
1067
+ /* */
1068
+ /* */
1069
+ /* */
1070
+ /* */
1071
+ /* */
1072
+ /* */
1073
+ /* */
1074
+ /* */
1075
+ return (void 0);
1076
+ }
1077
+ function normalizeHtmlText(text) {
1078
+ /* */
1079
+ /* */
1080
+ return (void 0);
1081
+ }
1082
+ function uniqueMessages(messages) {
1083
+ /* */
1084
+ /* */
1085
+ /* */
1086
+ /* */
1087
+ /* */
1088
+ /* */
1089
+ /* */
1090
+ /* */
1091
+ /* */
1092
+ /* */
1093
+ /* */
1094
+ /* */
1095
+ /* */
1096
+ /* */
1097
+ /* */
1098
+ return (void 0);
1099
+ }
1100
+ //#endregion
1101
+ //end of namespace UtilsI18nExtractGettextTranslateFromHtml
1102
+
1103
+ //#endregion
1104
+ //namespace UtilsI18nHtml
1105
+ function UtilsI18nHtml__NS__extractGettextTranslateFromHtml(html, fileName = 'template.html') {
1106
+ return UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml(html, fileName);
1107
+ }
1108
+ function UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext(html) {
1109
+ /* */
1110
+ /* */
1111
+ /* */
1112
+ /* */
1113
+ /* */
1114
+ /* */
1115
+ /* */
1116
+ /* */
1117
+ /* */
1118
+ /* */
1119
+ /* */
1120
+ /* */
1121
+ /* */
1122
+ /* */
1123
+ /* */
1124
+ /* */
1125
+ /* */
1126
+ /* */
1127
+ /* */
1128
+ /* */
1129
+ /* */
1130
+ /* */
1131
+ /* */
1132
+ /* */
1133
+ /* */
1134
+ /* */
1135
+ /* */
1136
+ /* */
1137
+ /* */
1138
+ /* */
1139
+ /* */
1140
+ /* */
1141
+ /* */
1142
+ /* */
1143
+ /* */
1144
+ /* */
1145
+ /* */
1146
+ /* */
1147
+ /* */
1148
+ /* */
1149
+ /* */
1150
+ /* */
1151
+ /* */
1152
+ /* */
1153
+ /* */
1154
+ /* */
1155
+ /* */
1156
+ /* */
1157
+ /* */
1158
+ /* */
1159
+ /* */
1160
+ /* */
1161
+ /* */
1162
+ /* */
1163
+ /* */
1164
+ /* */
1165
+ return (void 0);
1166
+ }
1167
+ function findTranslateDirectiveEditsFromSource(html) {
1168
+ /* */
1169
+ /* */
1170
+ /* */
1171
+ /* */
1172
+ /* */
1173
+ /* */
1174
+ /* */
1175
+ /* */
1176
+ /* */
1177
+ /* */
1178
+ /* */
1179
+ /* */
1180
+ /* */
1181
+ /* */
1182
+ /* */
1183
+ /* */
1184
+ /* */
1185
+ /* */
1186
+ /* */
1187
+ /* */
1188
+ /* */
1189
+ /* */
1190
+ /* */
1191
+ /* */
1192
+ /* */
1193
+ /* */
1194
+ /* */
1195
+ /* */
1196
+ /* */
1197
+ return (void 0);
1198
+ }
1199
+ function hasTranslateDirective(node) {
1200
+ /* */
1201
+ /* */
1202
+ /* */
1203
+ /* */
1204
+ return (void 0);
1205
+ }
1206
+ function hasTranslateTInput(node) {
1207
+ /* */
1208
+ /* */
1209
+ /* */
1210
+ /* */
1211
+ /* */
1212
+ /* */
1213
+ /* */
1214
+ /* */
1215
+ return (void 0);
1216
+ }
1217
+ function findOpenTagInsertPosition(html, start, length) {
1218
+ /* */
1219
+ /* */
1220
+ /* */
1221
+ /* */
1222
+ /* */
1223
+ /* */
1224
+ /* */
1225
+ /* */
1226
+ /* */
1227
+ /* */
1228
+ /* */
1229
+ /* */
1230
+ /* */
1231
+ /* */
1232
+ return (void 0);
1233
+ }
1234
+ function applyEdits(input, edits) {
1235
+ /* */
1236
+ /* */
1237
+ /* */
1238
+ /* */
1239
+ /* */
1240
+ /* */
1241
+ return (void 0);
1242
+ }
1243
+ //end of namespace UtilsI18nHtml
1244
+
1245
+ //namespace UtilsPoFile
1246
+ //#region generate po files
1247
+ function UtilsPoFile__NS__generatePoFiles(files, locales, destinationAbsFolderPath) {
1248
+ /* */
1249
+ /* */
1250
+ /* */
1251
+ /* */
1252
+ /* */
1253
+ /* */
1254
+ /* */
1255
+ /* */
1256
+ /* */
1257
+ return (void 0);
1258
+ }
1259
+ //#endregion
1260
+ //#region generate po file content
1261
+ function UtilsPoFile__NS__generatePoFileContent(files, locale) {
1262
+ /* */
1263
+ /* */
1264
+ /* */
1265
+ /* */
1266
+ /* */
1267
+ /* */
1268
+ /* */
1269
+ /* */
1270
+ /* */
1271
+ /* */
1272
+ /* */
1273
+ /* */
1274
+ /* */
1275
+ /* */
1276
+ /* */
1277
+ /* */
1278
+ /* */
1279
+ /* */
1280
+ /* */
1281
+ /* */
1282
+ /* */
1283
+ /* */
1284
+ /* */
1285
+ /* */
1286
+ /* */
1287
+ /* */
1288
+ /* */
1289
+ /* */
1290
+ /* */
1291
+ /* */
1292
+ /* */
1293
+ /* */
1294
+ /* */
1295
+ /* */
1296
+ /* */
1297
+ /* */
1298
+ /* */
1299
+ /* */
1300
+ /* */
1301
+ /* */
1302
+ /* */
1303
+ /* */
1304
+ /* */
1305
+ /* */
1306
+ /* */
1307
+ /* */
1308
+ /* */
1309
+ /* */
1310
+ /* */
1311
+ /* */
1312
+ /* */
1313
+ /* */
1314
+ /* */
1315
+ /* */
1316
+ /* */
1317
+ /* */
1318
+ return (void 0);
1319
+ }
1320
+ //#endregion
1321
+ //#region extract po to json
1322
+ function UtilsPoFile__NS__extractPoToJson(poFileContent) {
1323
+ /* */
1324
+ /* */
1325
+ /* */
1326
+ /* */
1327
+ /* */
1328
+ /* */
1329
+ /* */
1330
+ /* */
1331
+ /* */
1332
+ /* */
1333
+ /* */
1334
+ /* */
1335
+ /* */
1336
+ /* */
1337
+ /* */
1338
+ /* */
1339
+ /* */
1340
+ /* */
1341
+ /* */
1342
+ /* */
1343
+ /* */
1344
+ /* */
1345
+ /* */
1346
+ /* */
1347
+ /* */
1348
+ /* */
1349
+ /* */
1350
+ /* */
1351
+ /* */
1352
+ /* */
1353
+ /* */
1354
+ return (void 0);
1355
+ }
1356
+ //#endregion
1357
+ //#region generate translation override interface
1358
+ function UtilsPoFile__NS__generateTranslationOverrideInterface(file, interfaceName, locale) {
1359
+ /* */
1360
+ /* */
1361
+ /* */
1362
+ /* */
1363
+ /* */
1364
+ /* */
1365
+ /* */
1366
+ /* */
1367
+ /* */
1368
+ /* */
1369
+ /* */
1370
+ /* */
1371
+ /* */
1372
+ /* */
1373
+ /* */
1374
+ /* */
1375
+ /* */
1376
+ /* */
1377
+ /* */
1378
+ /* */
1379
+ /* */
1380
+ /* */
1381
+ /* */
1382
+ /* */
1383
+ /* */
1384
+ /* */
1385
+ /* */
1386
+ /* */
1387
+ /* */
1388
+ /* */
1389
+ /* */
1390
+ /* */
1391
+ /* */
1392
+ /* */
1393
+ /* */
1394
+ /* */
1395
+ /* */
1396
+ /* */
1397
+ /* */
1398
+ return (void 0);
1399
+ }
1400
+ function escapeTs(value) {
1401
+ return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
1402
+ }
1403
+ //#endregion
1404
+ //#region merge gettext file
1405
+ function UtilsPoFile__NS__mergeGettextFile(jsonContent1FromTsHtml, json2ContentFromPoFileModifedByUser) {
1406
+ /* */
1407
+ /* */
1408
+ /* */
1409
+ /* */
1410
+ /* */
1411
+ /* */
1412
+ /* */
1413
+ /* */
1414
+ /* */
1415
+ /* */
1416
+ /* */
1417
+ /* */
1418
+ /* */
1419
+ /* */
1420
+ /* */
1421
+ /* */
1422
+ /* */
1423
+ /* */
1424
+ /* */
1425
+ /* */
1426
+ /* */
1427
+ return (void 0);
1428
+ }
1429
+ //#endregion
1430
+ //#region models & helpers
1431
+ function getGettextTagKey(tag) {
1432
+ return `${tag.context ?? ''}\u0004${tag.gettextString}`;
1433
+ }
1434
+ function parsePoEntries(po) {
1435
+ /* */
1436
+ /* */
1437
+ /* */
1438
+ /* */
1439
+ /* */
1440
+ /* */
1441
+ /* */
1442
+ /* */
1443
+ /* */
1444
+ /* */
1445
+ /* */
1446
+ /* */
1447
+ /* */
1448
+ /* */
1449
+ /* */
1450
+ /* */
1451
+ /* */
1452
+ /* */
1453
+ /* */
1454
+ /* */
1455
+ /* */
1456
+ /* */
1457
+ /* */
1458
+ /* */
1459
+ /* */
1460
+ /* */
1461
+ /* */
1462
+ /* */
1463
+ /* */
1464
+ /* */
1465
+ /* */
1466
+ /* */
1467
+ /* */
1468
+ /* */
1469
+ /* */
1470
+ /* */
1471
+ /* */
1472
+ /* */
1473
+ /* */
1474
+ /* */
1475
+ /* */
1476
+ /* */
1477
+ /* */
1478
+ /* */
1479
+ /* */
1480
+ /* */
1481
+ /* */
1482
+ /* */
1483
+ /* */
1484
+ /* */
1485
+ /* */
1486
+ /* */
1487
+ /* */
1488
+ /* */
1489
+ /* */
1490
+ /* */
1491
+ /* */
1492
+ /* */
1493
+ /* */
1494
+ /* */
1495
+ /* */
1496
+ /* */
1497
+ /* */
1498
+ return (void 0);
1499
+ }
1500
+ function parsePoRef(ref) {
1501
+ /* */
1502
+ /* */
1503
+ /* */
1504
+ /* */
1505
+ /* */
1506
+ /* */
1507
+ /* */
1508
+ /* */
1509
+ return (void 0);
1510
+ }
1511
+ function escapePoString(value) {
1512
+ return value
1513
+ .replace(/\\/g, '\\\\')
1514
+ .replace(/"/g, '\\"')
1515
+ .replace(/\n/g, '\\n');
1516
+ }
1517
+ function readPoQuoted(value) {
1518
+ const match = value.match(/^"([\s\S]*)"$/);
1519
+ if (!match)
1520
+ return '';
1521
+ return unescapePoString(match[1]);
1522
+ }
1523
+ function unescapePoString(value) {
1524
+ return value
1525
+ .replace(/\\n/g, '\n')
1526
+ .replace(/\\"/g, '"')
1527
+ .replace(/\\\\/g, '\\');
1528
+ }
1529
+ //#endregion
1530
+ //end of namespace UtilsPoFile
507
1531
 
508
1532
  // @ts-nocheck
509
1533
  // This file is auto-generated during init process. Do not modify.
@@ -517,5 +1541,5 @@ var index = {};
517
1541
  * Generated bundle index. Do not edit.
518
1542
  */
519
1543
 
520
- export { APP_ID, BUILD_BASE_HREF, BUILD_FRAMEWORK_CLI_NAME, CURRENT_PACKAGE_TAON_VERSION, CURRENT_PACKAGE_VERSION, INTERNAL_TRANSIGNAL_CONFIG, PROJECT_NPM_NAME, TRANSIGNAL_CONFIG, TREE_SHAKED_TRANSLATIONS, TransignalService, injectTransignalConfig, noParamsHandler, plural, prepareTransignal, provideTransignalTesting, select, simpleParamValueStringify, simpleParamsHandler, startCli, treeShakedTranslations, withLanguageLocalStorageSync, withNavigatorLanguage, withPreloadScopes, withServerSideLanguage, withTranslatedTitle };
1544
+ 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 };
521
1545
  //# sourceMappingURL=i18n-browser-prod.mjs.map