@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.
- package/VERIFIED-BUILD-DATA.jsonc +3 -3
- package/bin/start.js +1 -1
- package/browser/fesm2022/i18n-browser.mjs +1441 -406
- package/browser/fesm2022/i18n-browser.mjs.map +1 -1
- package/browser/package.json +1 -1
- package/browser/types/i18n-browser.d.ts +146 -305
- package/browser-prod/fesm2022/i18n-browser-prod.mjs +1429 -405
- package/browser-prod/fesm2022/i18n-browser-prod.mjs.map +1 -1
- package/browser-prod/package.json +1 -1
- package/browser-prod/types/i18n-browser-prod.d.ts +140 -305
- package/browser-prod.split-namespaces.json +26 -2
- package/html/app/main-page/main-page.container.html +4 -0
- package/html/assets/generated/pwa/html-pwa.html +53 -53
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/index._auto-generated_.d.ts +9 -14
- package/lib/index._auto-generated_.js +9 -14
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/start-cli.js +6 -4
- package/lib/start-cli.js.map +1 -1
- package/lib/translate.directive.d.ts +15 -0
- package/lib/translate.pipe.d.ts +10 -0
- package/lib/translate.service.d.ts +13 -0
- package/lib/translation-manager.d.ts +33 -0
- package/lib/translation-manager.js +119 -0
- package/lib/translation-manager.js.map +1 -0
- package/lib/translation.d.ts +44 -0
- package/lib/translation.js +253 -0
- package/lib/translation.js.map +1 -0
- package/lib/translation.models.d.ts +25 -0
- package/lib/{features/types.js → translation.models.js} +1 -1
- package/lib/translation.models.js.map +1 -0
- package/lib/utils-i18n-extract-gettext-translate-from-html.d.ts +4 -0
- package/lib/utils-i18n-extract-gettext-translate-from-html.js +465 -0
- package/lib/utils-i18n-extract-gettext-translate-from-html.js.map +1 -0
- package/lib/utils-i18n-extract-gettext-translate-from-html.test.d.ts +1 -0
- package/lib/utils-i18n-extract-gettext-translate-from-html.test.js +282 -0
- package/lib/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -0
- package/lib/utils-i18n-html.d.ts +5 -0
- package/lib/utils-i18n-html.js +120 -0
- package/lib/utils-i18n-html.js.map +1 -0
- package/lib/utils-i18n-html.test.d.ts +1 -0
- package/lib/utils-i18n-html.test.js +82 -0
- package/lib/utils-i18n-html.test.js.map +1 -0
- package/lib/utils-po-file.d.ts +8 -0
- package/lib/utils-po-file.js +245 -0
- package/lib/utils-po-file.js.map +1 -0
- package/lib/utils-po-file.test.d.ts +1 -0
- package/lib/utils-po-file.test.js +239 -0
- package/lib/utils-po-file.test.js.map +1 -0
- package/lib-esm/app/main-page/main-page.active.context.d.ts +19 -0
- package/lib-esm/app/main-page/main-page.active.context.js +19 -0
- package/lib-esm/app/main-page/main-page.active.context.js.map +1 -0
- package/lib-esm/app.electron.d.ts +1 -1
- package/lib-esm/app.electron.js +1 -1
- package/lib-esm/app.hosts.d.ts +54 -2
- package/lib-esm/app.hosts.js +64 -4
- package/lib-esm/app.hosts.js.map +1 -1
- package/lib-esm/app.js +9 -9
- package/lib-esm/app.js.map +1 -1
- package/lib-esm/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib-esm/lib/build-info._auto-generated_.js +1 -1
- package/lib-esm/lib/build-info._auto-generated_.js.map +1 -1
- package/lib-esm/lib/index._auto-generated_.d.ts +6 -14
- package/lib-esm/lib/index._auto-generated_.js +9 -14
- package/lib-esm/lib/index._auto-generated_.js.map +1 -1
- package/lib-esm/lib/start-cli.js +6 -4
- package/lib-esm/lib/start-cli.js.map +1 -1
- package/lib-esm/lib/translation-manager.d.ts +33 -0
- package/lib-esm/lib/translation-manager.js +115 -0
- package/lib-esm/lib/translation-manager.js.map +1 -0
- package/lib-esm/lib/translation.d.ts +43 -0
- package/lib-esm/lib/translation.js +249 -0
- package/lib-esm/lib/translation.js.map +1 -0
- package/lib-esm/lib/translation.models.d.ts +25 -0
- package/lib-esm/lib/translation.models.js +2 -0
- package/lib-esm/lib/translation.models.js.map +1 -0
- package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.d.ts +4 -0
- package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.js +462 -0
- package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.js.map +1 -0
- package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.d.ts +1 -0
- package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.js +280 -0
- package/lib-esm/lib/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -0
- package/lib-esm/lib/utils-i18n-html.d.ts +5 -0
- package/lib-esm/lib/utils-i18n-html.js +117 -0
- package/lib-esm/lib/utils-i18n-html.js.map +1 -0
- package/lib-esm/lib/utils-i18n-html.test.d.ts +1 -0
- package/lib-esm/lib/utils-i18n-html.test.js +80 -0
- package/lib-esm/lib/utils-i18n-html.test.js.map +1 -0
- package/lib-esm/lib/utils-po-file.d.ts +8 -0
- package/lib-esm/lib/utils-po-file.js +242 -0
- package/lib-esm/lib/utils-po-file.js.map +1 -0
- package/lib-esm/lib/utils-po-file.test.d.ts +1 -0
- package/lib-esm/lib/utils-po-file.test.js +237 -0
- package/lib-esm/lib/utils-po-file.test.js.map +1 -0
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/build-info._auto-generated_.js.map +1 -1
- package/lib-prod/index._auto-generated_.d.ts +6 -14
- package/lib-prod/index._auto-generated_.js +9 -14
- package/lib-prod/index._auto-generated_.js.map +1 -1
- package/lib-prod/package.json +1 -1
- package/lib-prod/start-cli.js +6 -4
- package/lib-prod/start-cli.js.map +1 -1
- package/lib-prod/translation-manager.d.ts +33 -0
- package/lib-prod/translation-manager.js +115 -0
- package/lib-prod/translation-manager.js.map +1 -0
- package/lib-prod/translation.d.ts +43 -0
- package/lib-prod/translation.js +249 -0
- package/lib-prod/translation.js.map +1 -0
- package/lib-prod/translation.models.d.ts +25 -0
- package/lib-prod/translation.models.js +2 -0
- package/lib-prod/translation.models.js.map +1 -0
- package/lib-prod/utils-i18n-extract-gettext-translate-from-html.d.ts +2 -0
- package/lib-prod/utils-i18n-extract-gettext-translate-from-html.js +460 -0
- package/lib-prod/utils-i18n-extract-gettext-translate-from-html.js.map +1 -0
- package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.d.ts +1 -0
- package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.js +280 -0
- package/lib-prod/utils-i18n-extract-gettext-translate-from-html.test.js.map +1 -0
- package/lib-prod/utils-i18n-html.d.ts +3 -0
- package/lib-prod/utils-i18n-html.js +114 -0
- package/lib-prod/utils-i18n-html.js.map +1 -0
- package/lib-prod/utils-i18n-html.test.d.ts +1 -0
- package/lib-prod/utils-i18n-html.test.js +80 -0
- package/lib-prod/utils-i18n-html.test.js.map +1 -0
- package/lib-prod/utils-po-file.d.ts +6 -0
- package/lib-prod/utils-po-file.js +236 -0
- package/lib-prod/utils-po-file.js.map +1 -0
- package/lib-prod/utils-po-file.test.d.ts +1 -0
- package/lib-prod/utils-po-file.test.js +237 -0
- package/lib-prod/utils-po-file.test.js.map +1 -0
- package/lib-prod.split-namespaces.json +26 -2
- package/package.json +4 -2
- package/scss/app/main-page/main-page.container.scss +3 -0
- package/websql/fesm2022/i18n-websql.mjs +1441 -406
- package/websql/fesm2022/i18n-websql.mjs.map +1 -1
- package/websql/package.json +1 -1
- package/websql/types/i18n-websql.d.ts +146 -305
- package/websql-prod/fesm2022/i18n-websql-prod.mjs +1429 -405
- package/websql-prod/fesm2022/i18n-websql-prod.mjs.map +1 -1
- package/websql-prod/package.json +1 -1
- package/websql-prod/types/i18n-websql-prod.d.ts +140 -305
- package/websql-prod.split-namespaces.json +26 -2
- package/lib/features/index.d.ts +0 -4
- package/lib/features/index.js +0 -21
- package/lib/features/index.js.map +0 -1
- package/lib/features/types.d.ts +0 -4
- package/lib/features/types.js.map +0 -1
- package/lib/features/withLanguageLocalStorageSync.d.ts +0 -9
- package/lib/features/withLanguageLocalStorageSync.js +0 -39
- package/lib/features/withLanguageLocalStorageSync.js.map +0 -1
- package/lib/features/withNavigatorLanguage.d.ts +0 -6
- package/lib/features/withNavigatorLanguage.js +0 -29
- package/lib/features/withNavigatorLanguage.js.map +0 -1
- package/lib/features/withPreloadScopes.d.ts +0 -8
- package/lib/features/withPreloadScopes.js +0 -25
- package/lib/features/withPreloadScopes.js.map +0 -1
- package/lib/features/withServerSideLanguage.d.ts +0 -6
- package/lib/features/withServerSideLanguage.js +0 -29
- package/lib/features/withServerSideLanguage.js.map +0 -1
- package/lib/features/withTranslatedTitle.d.ts +0 -34
- package/lib/features/withTranslatedTitle.js +0 -69
- package/lib/features/withTranslatedTitle.js.map +0 -1
- package/lib/internals.d.ts +0 -2
- package/lib/internals.js +0 -6
- package/lib/internals.js.map +0 -1
- package/lib/transignal-config.d.ts +0 -34
- package/lib/transignal-config.js +0 -42
- package/lib/transignal-config.js.map +0 -1
- package/lib/transignal-param-handlers.d.ts +0 -11
- package/lib/transignal-param-handlers.js +0 -31
- package/lib/transignal-param-handlers.js.map +0 -1
- package/lib/transignal-service.d.ts +0 -32
- package/lib/transignal-service.js +0 -206
- package/lib/transignal-service.js.map +0 -1
- package/lib/transignal-testing.d.ts +0 -8
- package/lib/transignal-testing.js +0 -14
- package/lib/transignal-testing.js.map +0 -1
- package/lib/types.d.ts +0 -124
- package/lib/types.js +0 -3
- package/lib/types.js.map +0 -1
- package/lib/utility-types.d.ts +0 -29
- package/lib/utility-types.js +0 -3
- package/lib/utility-types.js.map +0 -1
- package/lib/utils.d.ts +0 -15
- package/lib/utils.js +0 -20
- package/lib/utils.js.map +0 -1
- package/lib-esm/lib/features/index.d.ts +0 -4
- package/lib-esm/lib/features/index.js +0 -5
- package/lib-esm/lib/features/index.js.map +0 -1
- package/lib-esm/lib/features/types.d.ts +0 -4
- package/lib-esm/lib/features/types.js +0 -2
- package/lib-esm/lib/features/types.js.map +0 -1
- package/lib-esm/lib/features/withLanguageLocalStorageSync.d.ts +0 -9
- package/lib-esm/lib/features/withLanguageLocalStorageSync.js +0 -35
- package/lib-esm/lib/features/withLanguageLocalStorageSync.js.map +0 -1
- package/lib-esm/lib/features/withNavigatorLanguage.d.ts +0 -6
- package/lib-esm/lib/features/withNavigatorLanguage.js +0 -25
- package/lib-esm/lib/features/withNavigatorLanguage.js.map +0 -1
- package/lib-esm/lib/features/withPreloadScopes.d.ts +0 -8
- package/lib-esm/lib/features/withPreloadScopes.js +0 -21
- package/lib-esm/lib/features/withPreloadScopes.js.map +0 -1
- package/lib-esm/lib/features/withServerSideLanguage.d.ts +0 -6
- package/lib-esm/lib/features/withServerSideLanguage.js +0 -25
- package/lib-esm/lib/features/withServerSideLanguage.js.map +0 -1
- package/lib-esm/lib/features/withTranslatedTitle.d.ts +0 -34
- package/lib-esm/lib/features/withTranslatedTitle.js +0 -65
- package/lib-esm/lib/features/withTranslatedTitle.js.map +0 -1
- package/lib-esm/lib/internals.d.ts +0 -2
- package/lib-esm/lib/internals.js +0 -3
- package/lib-esm/lib/internals.js.map +0 -1
- package/lib-esm/lib/transignal-config.d.ts +0 -34
- package/lib-esm/lib/transignal-config.js +0 -36
- package/lib-esm/lib/transignal-config.js.map +0 -1
- package/lib-esm/lib/transignal-param-handlers.d.ts +0 -11
- package/lib-esm/lib/transignal-param-handlers.js +0 -25
- package/lib-esm/lib/transignal-param-handlers.js.map +0 -1
- package/lib-esm/lib/transignal-service.d.ts +0 -32
- package/lib-esm/lib/transignal-service.js +0 -197
- package/lib-esm/lib/transignal-service.js.map +0 -1
- package/lib-esm/lib/transignal-testing.d.ts +0 -8
- package/lib-esm/lib/transignal-testing.js +0 -10
- package/lib-esm/lib/transignal-testing.js.map +0 -1
- package/lib-esm/lib/types.d.ts +0 -124
- package/lib-esm/lib/types.js +0 -2
- package/lib-esm/lib/types.js.map +0 -1
- package/lib-esm/lib/utility-types.d.ts +0 -29
- package/lib-esm/lib/utility-types.js +0 -2
- package/lib-esm/lib/utility-types.js.map +0 -1
- package/lib-esm/lib/utils.d.ts +0 -15
- package/lib-esm/lib/utils.js +0 -15
- package/lib-esm/lib/utils.js.map +0 -1
- package/lib-prod/features/index.d.ts +0 -4
- package/lib-prod/features/index.js +0 -5
- package/lib-prod/features/index.js.map +0 -1
- package/lib-prod/features/types.d.ts +0 -4
- package/lib-prod/features/types.js +0 -2
- package/lib-prod/features/types.js.map +0 -1
- package/lib-prod/features/withLanguageLocalStorageSync.d.ts +0 -9
- package/lib-prod/features/withLanguageLocalStorageSync.js +0 -35
- package/lib-prod/features/withLanguageLocalStorageSync.js.map +0 -1
- package/lib-prod/features/withNavigatorLanguage.d.ts +0 -6
- package/lib-prod/features/withNavigatorLanguage.js +0 -25
- package/lib-prod/features/withNavigatorLanguage.js.map +0 -1
- package/lib-prod/features/withPreloadScopes.d.ts +0 -8
- package/lib-prod/features/withPreloadScopes.js +0 -21
- package/lib-prod/features/withPreloadScopes.js.map +0 -1
- package/lib-prod/features/withServerSideLanguage.d.ts +0 -6
- package/lib-prod/features/withServerSideLanguage.js +0 -25
- package/lib-prod/features/withServerSideLanguage.js.map +0 -1
- package/lib-prod/features/withTranslatedTitle.d.ts +0 -34
- package/lib-prod/features/withTranslatedTitle.js +0 -65
- package/lib-prod/features/withTranslatedTitle.js.map +0 -1
- package/lib-prod/internals.d.ts +0 -2
- package/lib-prod/internals.js +0 -3
- package/lib-prod/internals.js.map +0 -1
- package/lib-prod/transignal-config.d.ts +0 -34
- package/lib-prod/transignal-config.js +0 -36
- package/lib-prod/transignal-config.js.map +0 -1
- package/lib-prod/transignal-param-handlers.d.ts +0 -11
- package/lib-prod/transignal-param-handlers.js +0 -25
- package/lib-prod/transignal-param-handlers.js.map +0 -1
- package/lib-prod/transignal-service.d.ts +0 -32
- package/lib-prod/transignal-service.js +0 -197
- package/lib-prod/transignal-service.js.map +0 -1
- package/lib-prod/transignal-testing.d.ts +0 -8
- package/lib-prod/transignal-testing.js +0 -10
- package/lib-prod/transignal-testing.js.map +0 -1
- package/lib-prod/types.d.ts +0 -124
- package/lib-prod/types.js +0 -2
- package/lib-prod/types.js.map +0 -1
- package/lib-prod/utility-types.d.ts +0 -29
- package/lib-prod/utility-types.js +0 -2
- package/lib-prod/utility-types.js.map +0 -1
- package/lib-prod/utils.d.ts +0 -15
- package/lib-prod/utils.js +0 -15
- package/lib-prod/utils.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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, GlobalStorage, _ } from 'tnp-core/websql';
|
|
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 = '
|
|
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 $
|
|
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,1469 @@ async function startCli(argsv, filename) {
|
|
|
77
76
|
return (void 0);
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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.
|
|
112
|
-
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
87
|
+
this.instances = new Set();
|
|
88
|
+
//#region current global language
|
|
89
|
+
this.defaultLangLocale = (() => {
|
|
90
|
+
//#region @browser
|
|
91
|
+
return (localStorage.getItem(globalTaonLanguageLocalKeyLocalStor) ||
|
|
92
|
+
UtilsI18n.detectLocale());
|
|
93
|
+
//#endregion
|
|
94
|
+
return UtilsI18n.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 = _.cloneDeep(UtilsI18n.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
|
-
*
|
|
124
|
+
* TODO
|
|
122
125
|
*/
|
|
123
|
-
this.
|
|
126
|
+
this.loadingLangsSubjectSrc = new BehaviorSubject(false);
|
|
124
127
|
/**
|
|
125
|
-
*
|
|
128
|
+
* TODO
|
|
126
129
|
*/
|
|
127
|
-
this.
|
|
130
|
+
this.isLoadingLangs$ = this.loadingLangsSubjectSrc.asObservable();
|
|
131
|
+
//#endregion
|
|
132
|
+
this.pernamentLanguage = null;
|
|
133
|
+
// console.log(`[i18] Default lang: ${this.defaultLangLocale}`);
|
|
134
|
+
}
|
|
135
|
+
get currentGlobalLanguage() {
|
|
136
|
+
return this._currentGlobalLanguage;
|
|
128
137
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
|
|
135
|
-
this.
|
|
136
|
-
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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:${_.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
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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:${_.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
|
-
|
|
234
|
-
|
|
326
|
+
catch (err) {
|
|
327
|
+
console.log(`[taon-i18n] Error loading language file ${fileRelativePath} `, err);
|
|
235
328
|
}
|
|
236
|
-
|
|
237
|
-
|
|
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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (
|
|
244
|
-
|
|
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 (
|
|
247
|
-
return
|
|
345
|
+
if (!force && this.loadedLang === this.localFileLang) {
|
|
346
|
+
return;
|
|
248
347
|
}
|
|
249
|
-
if (
|
|
250
|
-
return
|
|
251
|
-
prev[objKey] = this.replaceParams(objVal, params);
|
|
252
|
-
return prev;
|
|
253
|
-
}, {});
|
|
348
|
+
if (!force && this.loading) {
|
|
349
|
+
return this.loading;
|
|
254
350
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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
|
|
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
|
-
|
|
298
|
-
|
|
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
|
-
|
|
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
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
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
|
+
);
|
|
448
416
|
|
|
449
|
-
|
|
450
|
-
constructor
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
this.
|
|
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
|
|
425
|
+
|
|
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
|
+
});
|
|
462
443
|
}
|
|
444
|
+
ngOnChanges() {
|
|
445
|
+
if (!this.initialized)
|
|
446
|
+
return;
|
|
447
|
+
// this.t.debug && console.log(`On Chnags for "${this.originalText}"`)
|
|
448
|
+
this.render();
|
|
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
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
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
|
+
var UtilsI18nExtractGettextTranslateFromHtml;
|
|
531
|
+
(function (UtilsI18nExtractGettextTranslateFromHtml) {
|
|
532
|
+
function extractGettextTranslateFromHtml(html, fileName = 'template.html') {
|
|
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
|
+
/* */
|
|
626
|
+
return (void 0);
|
|
627
|
+
}
|
|
628
|
+
UtilsI18nExtractGettextTranslateFromHtml.extractGettextTranslateFromHtml = extractGettextTranslateFromHtml;
|
|
629
|
+
function extractGettextCallsFromSource(html) {
|
|
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
|
+
/* */
|
|
656
|
+
/* */
|
|
657
|
+
return (void 0);
|
|
658
|
+
}
|
|
659
|
+
function extractGettextCallsFromHtmlExpression(source) {
|
|
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
|
+
/* */
|
|
695
|
+
/* */
|
|
696
|
+
return (void 0);
|
|
697
|
+
}
|
|
698
|
+
function readBalancedParenthesesContent(source, openParenIndex) {
|
|
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
|
+
/* */
|
|
746
|
+
/* */
|
|
747
|
+
return (void 0);
|
|
748
|
+
}
|
|
749
|
+
function readStaticStringArg(arg) {
|
|
750
|
+
/* */
|
|
751
|
+
/* */
|
|
752
|
+
/* */
|
|
753
|
+
/* */
|
|
754
|
+
/* */
|
|
755
|
+
/* */
|
|
756
|
+
/* */
|
|
757
|
+
/* */
|
|
758
|
+
/* */
|
|
759
|
+
/* */
|
|
760
|
+
/* */
|
|
761
|
+
/* */
|
|
762
|
+
/* */
|
|
763
|
+
/* */
|
|
764
|
+
/* */
|
|
765
|
+
/* */
|
|
766
|
+
return (void 0);
|
|
767
|
+
}
|
|
768
|
+
function extractTranslateParamsFromSource(source) {
|
|
769
|
+
/* */
|
|
770
|
+
/* */
|
|
771
|
+
/* */
|
|
772
|
+
/* */
|
|
773
|
+
/* */
|
|
774
|
+
/* */
|
|
775
|
+
return (void 0);
|
|
776
|
+
}
|
|
777
|
+
function extractObjectLiteralParams(raw) {
|
|
778
|
+
/* */
|
|
779
|
+
/* */
|
|
780
|
+
/* */
|
|
781
|
+
/* */
|
|
782
|
+
/* */
|
|
783
|
+
/* */
|
|
784
|
+
/* */
|
|
785
|
+
/* */
|
|
786
|
+
/* */
|
|
787
|
+
/* */
|
|
788
|
+
/* */
|
|
789
|
+
/* */
|
|
790
|
+
/* */
|
|
791
|
+
/* */
|
|
792
|
+
/* */
|
|
793
|
+
/* */
|
|
794
|
+
/* */
|
|
795
|
+
/* */
|
|
796
|
+
/* */
|
|
797
|
+
/* */
|
|
798
|
+
/* */
|
|
799
|
+
/* */
|
|
800
|
+
/* */
|
|
801
|
+
return (void 0);
|
|
802
|
+
}
|
|
803
|
+
function splitTopLevel(input, separator) {
|
|
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
|
+
/* */
|
|
839
|
+
/* */
|
|
840
|
+
return (void 0);
|
|
841
|
+
}
|
|
842
|
+
function extractTranslatePipeStringsFromSource(source) {
|
|
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
|
+
/* */
|
|
868
|
+
/* */
|
|
869
|
+
return (void 0);
|
|
870
|
+
}
|
|
871
|
+
function extractStringLiterals(source) {
|
|
872
|
+
/* */
|
|
873
|
+
/* */
|
|
874
|
+
/* */
|
|
875
|
+
/* */
|
|
876
|
+
/* */
|
|
877
|
+
/* */
|
|
878
|
+
/* */
|
|
879
|
+
/* */
|
|
880
|
+
/* */
|
|
881
|
+
return (void 0);
|
|
882
|
+
}
|
|
883
|
+
function getNodeAttributes(node) {
|
|
884
|
+
/* */
|
|
885
|
+
/* */
|
|
886
|
+
/* */
|
|
887
|
+
/* */
|
|
888
|
+
/* */
|
|
889
|
+
return (void 0);
|
|
890
|
+
}
|
|
891
|
+
function getNodeInputs(node) {
|
|
892
|
+
/* */
|
|
893
|
+
/* */
|
|
894
|
+
/* */
|
|
895
|
+
/* */
|
|
896
|
+
/* */
|
|
897
|
+
return (void 0);
|
|
898
|
+
}
|
|
899
|
+
function isText(node) {
|
|
900
|
+
/* */
|
|
901
|
+
/* */
|
|
902
|
+
/* */
|
|
903
|
+
/* */
|
|
904
|
+
return (void 0);
|
|
905
|
+
}
|
|
906
|
+
function isBoundText(node) {
|
|
907
|
+
/* */
|
|
908
|
+
/* */
|
|
909
|
+
return (void 0);
|
|
910
|
+
}
|
|
911
|
+
function collectText(nodes) {
|
|
912
|
+
/* */
|
|
913
|
+
/* */
|
|
914
|
+
/* */
|
|
915
|
+
/* */
|
|
916
|
+
/* */
|
|
917
|
+
/* */
|
|
918
|
+
/* */
|
|
919
|
+
/* */
|
|
920
|
+
/* */
|
|
921
|
+
/* */
|
|
922
|
+
/* */
|
|
923
|
+
/* */
|
|
924
|
+
/* */
|
|
925
|
+
/* */
|
|
926
|
+
/* */
|
|
927
|
+
/* */
|
|
928
|
+
/* */
|
|
929
|
+
/* */
|
|
930
|
+
/* */
|
|
931
|
+
/* */
|
|
932
|
+
return (void 0);
|
|
933
|
+
}
|
|
934
|
+
function extractTranslateDirectiveFromSource(html) {
|
|
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
|
+
/* */
|
|
962
|
+
/* */
|
|
963
|
+
return (void 0);
|
|
964
|
+
}
|
|
965
|
+
function stripHtml(html) {
|
|
966
|
+
/* */
|
|
967
|
+
/* */
|
|
968
|
+
return (void 0);
|
|
969
|
+
}
|
|
970
|
+
function extractTranslateParams(inputs) {
|
|
971
|
+
/* */
|
|
972
|
+
/* */
|
|
973
|
+
/* */
|
|
974
|
+
/* */
|
|
975
|
+
/* */
|
|
976
|
+
/* */
|
|
977
|
+
/* */
|
|
978
|
+
/* */
|
|
979
|
+
return (void 0);
|
|
980
|
+
}
|
|
981
|
+
function extractObjectLiteralFromAst(ast) {
|
|
982
|
+
/* */
|
|
983
|
+
/* */
|
|
984
|
+
/* */
|
|
985
|
+
/* */
|
|
986
|
+
/* */
|
|
987
|
+
/* */
|
|
988
|
+
/* */
|
|
989
|
+
/* */
|
|
990
|
+
/* */
|
|
991
|
+
/* */
|
|
992
|
+
/* */
|
|
993
|
+
/* */
|
|
994
|
+
/* */
|
|
995
|
+
/* */
|
|
996
|
+
/* */
|
|
997
|
+
return (void 0);
|
|
998
|
+
}
|
|
999
|
+
function extractTranslatePipeStrings(ast) {
|
|
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
|
+
/* */
|
|
1025
|
+
/* */
|
|
1026
|
+
return (void 0);
|
|
1027
|
+
}
|
|
1028
|
+
function extractStaticStringsFromExpression(ast) {
|
|
1029
|
+
/* */
|
|
1030
|
+
/* */
|
|
1031
|
+
/* */
|
|
1032
|
+
/* */
|
|
1033
|
+
/* */
|
|
1034
|
+
/* */
|
|
1035
|
+
/* */
|
|
1036
|
+
/* */
|
|
1037
|
+
/* */
|
|
1038
|
+
/* */
|
|
1039
|
+
/* */
|
|
1040
|
+
/* */
|
|
1041
|
+
/* */
|
|
1042
|
+
/* */
|
|
1043
|
+
/* */
|
|
1044
|
+
/* */
|
|
1045
|
+
/* */
|
|
1046
|
+
/* */
|
|
1047
|
+
/* */
|
|
1048
|
+
/* */
|
|
1049
|
+
/* */
|
|
1050
|
+
/* */
|
|
1051
|
+
return (void 0);
|
|
1052
|
+
}
|
|
1053
|
+
function astToSource(ast) {
|
|
1054
|
+
/* */
|
|
1055
|
+
/* */
|
|
1056
|
+
/* */
|
|
1057
|
+
/* */
|
|
1058
|
+
/* */
|
|
1059
|
+
/* */
|
|
1060
|
+
/* */
|
|
1061
|
+
/* */
|
|
1062
|
+
/* */
|
|
1063
|
+
/* */
|
|
1064
|
+
/* */
|
|
1065
|
+
/* */
|
|
1066
|
+
/* */
|
|
1067
|
+
/* */
|
|
1068
|
+
/* */
|
|
1069
|
+
/* */
|
|
1070
|
+
/* */
|
|
1071
|
+
/* */
|
|
1072
|
+
/* */
|
|
1073
|
+
/* */
|
|
1074
|
+
/* */
|
|
1075
|
+
/* */
|
|
1076
|
+
/* */
|
|
1077
|
+
return (void 0);
|
|
1078
|
+
}
|
|
1079
|
+
function normalizeHtmlText(text) {
|
|
1080
|
+
/* */
|
|
1081
|
+
/* */
|
|
1082
|
+
return (void 0);
|
|
1083
|
+
}
|
|
1084
|
+
function uniqueMessages(messages) {
|
|
1085
|
+
/* */
|
|
1086
|
+
/* */
|
|
1087
|
+
/* */
|
|
1088
|
+
/* */
|
|
1089
|
+
/* */
|
|
1090
|
+
/* */
|
|
1091
|
+
/* */
|
|
1092
|
+
/* */
|
|
1093
|
+
/* */
|
|
1094
|
+
/* */
|
|
1095
|
+
/* */
|
|
1096
|
+
/* */
|
|
1097
|
+
/* */
|
|
1098
|
+
/* */
|
|
1099
|
+
/* */
|
|
1100
|
+
return (void 0);
|
|
1101
|
+
}
|
|
1102
|
+
//#endregion
|
|
1103
|
+
})(UtilsI18nExtractGettextTranslateFromHtml || (UtilsI18nExtractGettextTranslateFromHtml = {}));
|
|
1104
|
+
|
|
1105
|
+
//#endregion
|
|
1106
|
+
var UtilsI18nHtml;
|
|
1107
|
+
(function (UtilsI18nHtml) {
|
|
1108
|
+
function extractGettextTranslateFromHtml(html, fileName = 'template.html') {
|
|
1109
|
+
return UtilsI18nExtractGettextTranslateFromHtml.extractGettextTranslateFromHtml(html, fileName);
|
|
1110
|
+
}
|
|
1111
|
+
UtilsI18nHtml.extractGettextTranslateFromHtml = extractGettextTranslateFromHtml;
|
|
1112
|
+
function replaceTranslatePipieDirectiveTContext(html) {
|
|
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
|
+
/* */
|
|
1166
|
+
/* */
|
|
1167
|
+
/* */
|
|
1168
|
+
/* */
|
|
1169
|
+
return (void 0);
|
|
1170
|
+
}
|
|
1171
|
+
UtilsI18nHtml.replaceTranslatePipieDirectiveTContext = replaceTranslatePipieDirectiveTContext;
|
|
1172
|
+
function findTranslateDirectiveEditsFromSource(html) {
|
|
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
|
+
/* */
|
|
1198
|
+
/* */
|
|
1199
|
+
/* */
|
|
1200
|
+
/* */
|
|
1201
|
+
/* */
|
|
1202
|
+
return (void 0);
|
|
1203
|
+
}
|
|
1204
|
+
function hasTranslateDirective(node) {
|
|
1205
|
+
/* */
|
|
1206
|
+
/* */
|
|
1207
|
+
/* */
|
|
1208
|
+
/* */
|
|
1209
|
+
return (void 0);
|
|
1210
|
+
}
|
|
1211
|
+
function hasTranslateTInput(node) {
|
|
1212
|
+
/* */
|
|
1213
|
+
/* */
|
|
1214
|
+
/* */
|
|
1215
|
+
/* */
|
|
1216
|
+
/* */
|
|
1217
|
+
/* */
|
|
1218
|
+
/* */
|
|
1219
|
+
/* */
|
|
1220
|
+
return (void 0);
|
|
1221
|
+
}
|
|
1222
|
+
function findOpenTagInsertPosition(html, start, length) {
|
|
1223
|
+
/* */
|
|
1224
|
+
/* */
|
|
1225
|
+
/* */
|
|
1226
|
+
/* */
|
|
1227
|
+
/* */
|
|
1228
|
+
/* */
|
|
1229
|
+
/* */
|
|
1230
|
+
/* */
|
|
1231
|
+
/* */
|
|
1232
|
+
/* */
|
|
1233
|
+
/* */
|
|
1234
|
+
/* */
|
|
1235
|
+
/* */
|
|
1236
|
+
/* */
|
|
1237
|
+
return (void 0);
|
|
1238
|
+
}
|
|
1239
|
+
function applyEdits(input, edits) {
|
|
1240
|
+
/* */
|
|
1241
|
+
/* */
|
|
1242
|
+
/* */
|
|
1243
|
+
/* */
|
|
1244
|
+
/* */
|
|
1245
|
+
/* */
|
|
1246
|
+
return (void 0);
|
|
1247
|
+
}
|
|
1248
|
+
})(UtilsI18nHtml || (UtilsI18nHtml = {}));
|
|
1249
|
+
|
|
1250
|
+
var UtilsPoFile;
|
|
1251
|
+
(function (UtilsPoFile) {
|
|
1252
|
+
//#region generate po files
|
|
1253
|
+
function generatePoFiles(files, locales, destinationAbsFolderPath) {
|
|
1254
|
+
/* */
|
|
1255
|
+
/* */
|
|
1256
|
+
/* */
|
|
1257
|
+
/* */
|
|
1258
|
+
/* */
|
|
1259
|
+
/* */
|
|
1260
|
+
/* */
|
|
1261
|
+
/* */
|
|
1262
|
+
/* */
|
|
1263
|
+
return (void 0);
|
|
1264
|
+
}
|
|
1265
|
+
UtilsPoFile.generatePoFiles = generatePoFiles;
|
|
1266
|
+
//#endregion
|
|
1267
|
+
//#region generate po file content
|
|
1268
|
+
function generatePoFileContent(files, locale) {
|
|
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
|
+
/* */
|
|
1319
|
+
/* */
|
|
1320
|
+
/* */
|
|
1321
|
+
/* */
|
|
1322
|
+
/* */
|
|
1323
|
+
/* */
|
|
1324
|
+
/* */
|
|
1325
|
+
return (void 0);
|
|
1326
|
+
}
|
|
1327
|
+
UtilsPoFile.generatePoFileContent = generatePoFileContent;
|
|
1328
|
+
//#endregion
|
|
1329
|
+
//#region extract po to json
|
|
1330
|
+
function extractPoToJson(poFileContent) {
|
|
1331
|
+
/* */
|
|
1332
|
+
/* */
|
|
1333
|
+
/* */
|
|
1334
|
+
/* */
|
|
1335
|
+
/* */
|
|
1336
|
+
/* */
|
|
1337
|
+
/* */
|
|
1338
|
+
/* */
|
|
1339
|
+
/* */
|
|
1340
|
+
/* */
|
|
1341
|
+
/* */
|
|
1342
|
+
/* */
|
|
1343
|
+
/* */
|
|
1344
|
+
/* */
|
|
1345
|
+
/* */
|
|
1346
|
+
/* */
|
|
1347
|
+
/* */
|
|
1348
|
+
/* */
|
|
1349
|
+
/* */
|
|
1350
|
+
/* */
|
|
1351
|
+
/* */
|
|
1352
|
+
/* */
|
|
1353
|
+
/* */
|
|
1354
|
+
/* */
|
|
1355
|
+
/* */
|
|
1356
|
+
/* */
|
|
1357
|
+
/* */
|
|
1358
|
+
/* */
|
|
1359
|
+
/* */
|
|
1360
|
+
/* */
|
|
1361
|
+
/* */
|
|
1362
|
+
return (void 0);
|
|
1363
|
+
}
|
|
1364
|
+
UtilsPoFile.extractPoToJson = extractPoToJson;
|
|
1365
|
+
//#endregion
|
|
1366
|
+
//#region generate translation override interface
|
|
1367
|
+
function generateTranslationOverrideInterface(file, interfaceName, locale) {
|
|
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
|
+
/* */
|
|
1399
|
+
/* */
|
|
1400
|
+
/* */
|
|
1401
|
+
/* */
|
|
1402
|
+
/* */
|
|
1403
|
+
/* */
|
|
1404
|
+
/* */
|
|
1405
|
+
/* */
|
|
1406
|
+
/* */
|
|
1407
|
+
return (void 0);
|
|
1408
|
+
}
|
|
1409
|
+
UtilsPoFile.generateTranslationOverrideInterface = generateTranslationOverrideInterface;
|
|
1410
|
+
function escapeTs(value) {
|
|
1411
|
+
return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
1412
|
+
}
|
|
1413
|
+
//#endregion
|
|
1414
|
+
//#region merge gettext file
|
|
1415
|
+
function mergeGettextFile(jsonContent1FromTsHtml, json2ContentFromPoFileModifedByUser) {
|
|
1416
|
+
/* */
|
|
1417
|
+
/* */
|
|
1418
|
+
/* */
|
|
1419
|
+
/* */
|
|
1420
|
+
/* */
|
|
1421
|
+
/* */
|
|
1422
|
+
/* */
|
|
1423
|
+
/* */
|
|
1424
|
+
/* */
|
|
1425
|
+
/* */
|
|
1426
|
+
/* */
|
|
1427
|
+
/* */
|
|
1428
|
+
/* */
|
|
1429
|
+
/* */
|
|
1430
|
+
/* */
|
|
1431
|
+
/* */
|
|
1432
|
+
/* */
|
|
1433
|
+
/* */
|
|
1434
|
+
/* */
|
|
1435
|
+
/* */
|
|
1436
|
+
/* */
|
|
1437
|
+
return (void 0);
|
|
1438
|
+
}
|
|
1439
|
+
UtilsPoFile.mergeGettextFile = mergeGettextFile;
|
|
1440
|
+
//#endregion
|
|
1441
|
+
//#region models & helpers
|
|
1442
|
+
function getGettextTagKey(tag) {
|
|
1443
|
+
return `${tag.context ?? ''}\u0004${tag.gettextString}`;
|
|
1444
|
+
}
|
|
1445
|
+
function parsePoEntries(po) {
|
|
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
|
+
/* */
|
|
1499
|
+
/* */
|
|
1500
|
+
/* */
|
|
1501
|
+
/* */
|
|
1502
|
+
/* */
|
|
1503
|
+
/* */
|
|
1504
|
+
/* */
|
|
1505
|
+
/* */
|
|
1506
|
+
/* */
|
|
1507
|
+
/* */
|
|
1508
|
+
/* */
|
|
1509
|
+
return (void 0);
|
|
1510
|
+
}
|
|
1511
|
+
function parsePoRef(ref) {
|
|
1512
|
+
/* */
|
|
1513
|
+
/* */
|
|
1514
|
+
/* */
|
|
1515
|
+
/* */
|
|
1516
|
+
/* */
|
|
1517
|
+
/* */
|
|
1518
|
+
/* */
|
|
1519
|
+
/* */
|
|
1520
|
+
return (void 0);
|
|
1521
|
+
}
|
|
1522
|
+
function escapePoString(value) {
|
|
1523
|
+
return value
|
|
1524
|
+
.replace(/\\/g, '\\\\')
|
|
1525
|
+
.replace(/"/g, '\\"')
|
|
1526
|
+
.replace(/\n/g, '\\n');
|
|
1527
|
+
}
|
|
1528
|
+
function readPoQuoted(value) {
|
|
1529
|
+
const match = value.match(/^"([\s\S]*)"$/);
|
|
1530
|
+
if (!match)
|
|
1531
|
+
return '';
|
|
1532
|
+
return unescapePoString(match[1]);
|
|
1533
|
+
}
|
|
1534
|
+
function unescapePoString(value) {
|
|
1535
|
+
return value
|
|
1536
|
+
.replace(/\\n/g, '\n')
|
|
1537
|
+
.replace(/\\"/g, '"')
|
|
1538
|
+
.replace(/\\\\/g, '\\');
|
|
1539
|
+
}
|
|
1540
|
+
//#endregion
|
|
1541
|
+
})(UtilsPoFile || (UtilsPoFile = {}));
|
|
507
1542
|
|
|
508
1543
|
// @ts-nocheck
|
|
509
1544
|
// This file is auto-generated during init process. Do not modify.
|
|
@@ -517,5 +1552,5 @@ var index = {};
|
|
|
517
1552
|
* Generated bundle index. Do not edit.
|
|
518
1553
|
*/
|
|
519
1554
|
|
|
520
|
-
export { APP_ID, BUILD_BASE_HREF, BUILD_FRAMEWORK_CLI_NAME, CURRENT_PACKAGE_TAON_VERSION, CURRENT_PACKAGE_VERSION,
|
|
1555
|
+
export { APP_ID, BUILD_BASE_HREF, BUILD_FRAMEWORK_CLI_NAME, CURRENT_PACKAGE_TAON_VERSION, CURRENT_PACKAGE_VERSION, PROJECT_NPM_NAME, TranslateDirective, TranslatePipe, TranslateService, Translation, TranslationManager, UtilsI18nExtractGettextTranslateFromHtml, UtilsI18nHtml, UtilsPoFile, startCli };
|
|
521
1556
|
//# sourceMappingURL=i18n-websql.mjs.map
|