@taon-dev/i18n 21.0.21 → 21.0.22
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 +5 -0
- package/assets/shared/shared_folder_info.txt +7 -0
- package/browser/README.md +24 -0
- package/browser/fesm2022/i18n-browser.mjs +1567 -0
- package/browser/fesm2022/i18n-browser.mjs.map +1 -0
- package/browser/package.json +20 -1
- package/browser/types/i18n-browser.d.ts +195 -0
- package/browser-prod/README.md +24 -0
- package/browser-prod/fesm2022/i18n-browser-prod.mjs +1556 -0
- package/browser-prod/fesm2022/i18n-browser-prod.mjs.map +1 -0
- package/browser-prod/package.json +20 -2
- package/browser-prod/types/i18n-browser-prod.d.ts +189 -0
- package/browser-prod.re-export.json +1 -0
- package/browser-prod.split-namespaces.json +28 -0
- package/cli.d.ts +1 -0
- package/cli.js +8 -0
- package/cli.js.map +1 -0
- package/html/app/main-page/main-page.container.html +4 -0
- package/html/assets/generated/pwa/html-pwa.html +60 -0
- package/html/imports.html +3 -0
- package/index.d.ts +3 -0
- package/index.js +20 -0
- package/index.js.map +1 -0
- package/lib/build-info._auto-generated_.d.ts +24 -0
- package/lib/build-info._auto-generated_.js +30 -0
- package/lib/build-info._auto-generated_.js.map +1 -0
- package/lib/env/env.angular-node-app.d.ts +67 -0
- package/lib/env/env.angular-node-app.js +141 -0
- package/lib/env/env.angular-node-app.js.map +1 -0
- package/lib/env/env.docs-webapp.d.ts +67 -0
- package/lib/env/env.docs-webapp.js +141 -0
- package/lib/env/env.docs-webapp.js.map +1 -0
- package/lib/env/env.electron-app.d.ts +67 -0
- package/lib/env/env.electron-app.js +141 -0
- package/lib/env/env.electron-app.js.map +1 -0
- package/lib/env/env.mobile-app.d.ts +67 -0
- package/lib/env/env.mobile-app.js +141 -0
- package/lib/env/env.mobile-app.js.map +1 -0
- package/lib/env/env.npm-lib-and-cli-tool.d.ts +67 -0
- package/lib/env/env.npm-lib-and-cli-tool.js +141 -0
- package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -0
- package/lib/env/env.vscode-plugin.d.ts +67 -0
- package/lib/env/env.vscode-plugin.js +141 -0
- package/lib/env/env.vscode-plugin.js.map +1 -0
- package/lib/env/index.d.ts +6 -0
- package/lib/env/index.js +23 -0
- package/lib/env/index.js.map +1 -0
- package/lib/index._auto-generated_.d.ts +11 -0
- package/lib/index._auto-generated_.js +33 -0
- package/lib/index._auto-generated_.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +20 -0
- package/lib/index.js.map +1 -0
- package/lib/package.json +1 -1
- package/lib/start-cli.d.ts +7 -0
- package/lib/start-cli.js +48 -0
- package/lib/start-cli.js.map +1 -0
- package/lib/translate.directive.d.ts +16 -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/translation.models.js +3 -0
- 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 +125 -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 +147 -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.d.ts +3 -0
- package/lib-esm/app.electron.d.ts +1 -0
- package/lib-esm/app.electron.js +2 -0
- package/lib-esm/app.electron.js.map +1 -0
- package/lib-esm/app.hosts.d.ts +147 -0
- package/lib-esm/app.hosts.js +217 -0
- package/lib-esm/app.hosts.js.map +1 -0
- package/lib-esm/app.js +460 -0
- package/lib-esm/app.js.map +1 -0
- package/lib-esm/app.vscode.d.ts +9 -0
- package/lib-esm/app.vscode.js +37 -0
- package/lib-esm/app.vscode.js.map +1 -0
- package/lib-esm/cli.d.ts +1 -0
- package/lib-esm/cli.js +4 -0
- package/lib-esm/cli.js.map +1 -0
- package/lib-esm/index.d.ts +3 -0
- package/lib-esm/index.js +4 -0
- package/lib-esm/index.js.map +1 -0
- package/lib-esm/lib/build-info._auto-generated_.d.ts +24 -0
- package/lib-esm/lib/build-info._auto-generated_.js +27 -0
- package/lib-esm/lib/build-info._auto-generated_.js.map +1 -0
- package/lib-esm/lib/env/env.angular-node-app.d.ts +67 -0
- package/lib-esm/lib/env/env.angular-node-app.js +137 -0
- package/lib-esm/lib/env/env.angular-node-app.js.map +1 -0
- package/lib-esm/lib/env/env.docs-webapp.d.ts +67 -0
- package/lib-esm/lib/env/env.docs-webapp.js +137 -0
- package/lib-esm/lib/env/env.docs-webapp.js.map +1 -0
- package/lib-esm/lib/env/env.electron-app.d.ts +67 -0
- package/lib-esm/lib/env/env.electron-app.js +137 -0
- package/lib-esm/lib/env/env.electron-app.js.map +1 -0
- package/lib-esm/lib/env/env.mobile-app.d.ts +67 -0
- package/lib-esm/lib/env/env.mobile-app.js +137 -0
- package/lib-esm/lib/env/env.mobile-app.js.map +1 -0
- package/lib-esm/lib/env/env.npm-lib-and-cli-tool.d.ts +67 -0
- package/lib-esm/lib/env/env.npm-lib-and-cli-tool.js +137 -0
- package/lib-esm/lib/env/env.npm-lib-and-cli-tool.js.map +1 -0
- package/lib-esm/lib/env/env.vscode-plugin.d.ts +67 -0
- package/lib-esm/lib/env/env.vscode-plugin.js +137 -0
- package/lib-esm/lib/env/env.vscode-plugin.js.map +1 -0
- package/lib-esm/lib/env/index.d.ts +6 -0
- package/lib-esm/lib/env/index.js +7 -0
- package/lib-esm/lib/env/index.js.map +1 -0
- package/lib-esm/lib/index._auto-generated_.d.ts +8 -0
- package/lib-esm/lib/index._auto-generated_.js +17 -0
- package/lib-esm/lib/index._auto-generated_.js.map +1 -0
- package/lib-esm/lib/index.d.ts +4 -0
- package/lib-esm/lib/index.js +4 -0
- package/lib-esm/lib/index.js.map +1 -0
- package/lib-esm/lib/start-cli.d.ts +7 -0
- package/lib-esm/lib/start-cli.js +45 -0
- package/lib-esm/lib/start-cli.js.map +1 -0
- 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 +122 -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 +145 -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 +24 -0
- package/lib-prod/build-info._auto-generated_.js +27 -0
- package/lib-prod/build-info._auto-generated_.js.map +1 -0
- package/lib-prod/env/env.angular-node-app.d.ts +67 -0
- package/lib-prod/env/env.angular-node-app.js +137 -0
- package/lib-prod/env/env.angular-node-app.js.map +1 -0
- package/lib-prod/env/env.docs-webapp.d.ts +67 -0
- package/lib-prod/env/env.docs-webapp.js +137 -0
- package/lib-prod/env/env.docs-webapp.js.map +1 -0
- package/lib-prod/env/env.electron-app.d.ts +67 -0
- package/lib-prod/env/env.electron-app.js +137 -0
- package/lib-prod/env/env.electron-app.js.map +1 -0
- package/lib-prod/env/env.mobile-app.d.ts +67 -0
- package/lib-prod/env/env.mobile-app.js +137 -0
- package/lib-prod/env/env.mobile-app.js.map +1 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +67 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +137 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +1 -0
- package/lib-prod/env/env.vscode-plugin.d.ts +67 -0
- package/lib-prod/env/env.vscode-plugin.js +137 -0
- package/lib-prod/env/env.vscode-plugin.js.map +1 -0
- package/lib-prod/env/index.d.ts +6 -0
- package/lib-prod/env/index.js +7 -0
- package/lib-prod/env/index.js.map +1 -0
- package/lib-prod/index._auto-generated_.d.ts +8 -0
- package/lib-prod/index._auto-generated_.js +17 -0
- package/lib-prod/index._auto-generated_.js.map +1 -0
- package/lib-prod/index.d.ts +4 -0
- package/lib-prod/index.js +4 -0
- package/lib-prod/index.js.map +1 -0
- package/lib-prod/package.json +1 -1
- package/lib-prod/start-cli.d.ts +7 -0
- package/lib-prod/start-cli.js +45 -0
- package/lib-prod/start-cli.js.map +1 -0
- 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 +119 -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 +145 -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.re-export.json +1 -0
- package/lib-prod.split-namespaces.json +28 -0
- package/package.json +1 -1
- package/scss/app/main-page/main-page.container.scss +3 -0
- package/scss/global.scss +94 -0
- package/scss/index.scss +2 -0
- package/scss/lib/index.scss +2 -0
- package/scss/vars.scss +7 -0
- package/src.js +4 -0
- package/websql/README.md +24 -0
- package/websql/fesm2022/i18n-websql.mjs +1567 -0
- package/websql/fesm2022/i18n-websql.mjs.map +1 -0
- package/websql/package.json +20 -1
- package/websql/types/i18n-websql.d.ts +195 -0
- package/websql-prod/README.md +24 -0
- package/websql-prod/fesm2022/i18n-websql-prod.mjs +1556 -0
- package/websql-prod/fesm2022/i18n-websql-prod.mjs.map +1 -0
- package/websql-prod/package.json +20 -2
- package/websql-prod/types/i18n-websql-prod.d.ts +189 -0
- package/websql-prod.re-export.json +1 -0
- package/websql-prod.split-namespaces.json +28 -0
|
@@ -0,0 +1,1567 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
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
|
+
|
|
7
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
8
|
+
/**
|
|
9
|
+
* Autogenerated by current cli tool
|
|
10
|
+
*/
|
|
11
|
+
const BUILD_FRAMEWORK_CLI_NAME = 'tnp';
|
|
12
|
+
/**
|
|
13
|
+
* This value can be change in taon.jsonc (appId)
|
|
14
|
+
*/
|
|
15
|
+
const APP_ID = 'com.domain.example.i18n';
|
|
16
|
+
/**
|
|
17
|
+
* Autogenerated by current cli tool
|
|
18
|
+
*/
|
|
19
|
+
const BUILD_BASE_HREF = '';
|
|
20
|
+
/**
|
|
21
|
+
* This value can be change in taon.jsonc (overrideNpmName)
|
|
22
|
+
*/
|
|
23
|
+
const PROJECT_NPM_NAME = '@taon-dev/i18n';
|
|
24
|
+
/**
|
|
25
|
+
* Taon version from you project taon.json
|
|
26
|
+
*/
|
|
27
|
+
const CURRENT_PACKAGE_TAON_VERSION = 'v21';
|
|
28
|
+
/**
|
|
29
|
+
* Autogenerated by current cli tool. Use *tnp release* to bump version.
|
|
30
|
+
*/
|
|
31
|
+
const CURRENT_PACKAGE_VERSION = '21.0.22';
|
|
32
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
33
|
+
|
|
34
|
+
//#region tnp-helpers cli template
|
|
35
|
+
// import { CoreModels } from 'tnp-core/src';
|
|
36
|
+
// import { Helpers, BaseCommandLineFeature } from 'tnp-helpers/src';
|
|
37
|
+
// import { BaseProject, BaseStartConfig } from 'tnp-helpers/src'; // @backend
|
|
38
|
+
// class $Global extends BaseCommandLineFeature<{}> {
|
|
39
|
+
// static [CoreModels.ClassNameStaticProperty] = '';
|
|
40
|
+
// public _() {
|
|
41
|
+
// console.log(`Hello world from cli`);
|
|
42
|
+
// this._exit();
|
|
43
|
+
// }
|
|
44
|
+
// }
|
|
45
|
+
//#endregion
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
* @param argsv process.argsv
|
|
49
|
+
* @param filename needed if you want ipc communicaiton
|
|
50
|
+
*/
|
|
51
|
+
async function startCli(argsv, filename) {
|
|
52
|
+
/* */
|
|
53
|
+
/* */
|
|
54
|
+
/* */
|
|
55
|
+
/* */
|
|
56
|
+
/* */
|
|
57
|
+
/* */
|
|
58
|
+
/* */
|
|
59
|
+
/* */
|
|
60
|
+
/* */
|
|
61
|
+
/* */
|
|
62
|
+
/* */
|
|
63
|
+
/* */
|
|
64
|
+
/* */
|
|
65
|
+
/* */
|
|
66
|
+
/* */
|
|
67
|
+
/* */
|
|
68
|
+
/* */
|
|
69
|
+
/* */
|
|
70
|
+
/* */
|
|
71
|
+
/* */
|
|
72
|
+
/* */
|
|
73
|
+
/* */
|
|
74
|
+
/* */
|
|
75
|
+
/* */
|
|
76
|
+
return (void 0);
|
|
77
|
+
}
|
|
78
|
+
|
|
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 {
|
|
86
|
+
constructor() {
|
|
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
|
|
123
|
+
/**
|
|
124
|
+
* TODO
|
|
125
|
+
*/
|
|
126
|
+
this.loadingLangsSubjectSrc = new BehaviorSubject(false);
|
|
127
|
+
/**
|
|
128
|
+
* TODO
|
|
129
|
+
*/
|
|
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;
|
|
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));
|
|
148
|
+
}
|
|
149
|
+
this._visibleLanguages = v;
|
|
150
|
+
this.visibleLanguagesSrc.next(v);
|
|
151
|
+
this.availableLangsSrc.next(this.availableLangs);
|
|
152
|
+
}
|
|
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),
|
|
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
|
+
}
|
|
228
|
+
}
|
|
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;
|
|
321
|
+
}
|
|
322
|
+
const modOrFile = await loader();
|
|
323
|
+
const file = modOrFile.default ?? modOrFile;
|
|
324
|
+
files.push(file);
|
|
325
|
+
}
|
|
326
|
+
catch (err) {
|
|
327
|
+
console.log(`[taon-i18n] Error loading language file ${fileRelativePath} `, err);
|
|
328
|
+
}
|
|
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);
|
|
338
|
+
}
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region private methods / ensure loaded
|
|
341
|
+
async ensureLoaded(force = false) {
|
|
342
|
+
if (this.useGlobalLangFile) {
|
|
343
|
+
this.localFileLang = Translation.manager.currentGlobalLanguage;
|
|
344
|
+
}
|
|
345
|
+
if (!force && this.loadedLang === this.localFileLang) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (!force && this.loading) {
|
|
349
|
+
return this.loading;
|
|
350
|
+
}
|
|
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;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
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;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region EXMAPLE
|
|
392
|
+
/*
|
|
393
|
+
// import {Translation} from 'taon'
|
|
394
|
+
|
|
395
|
+
const t = Translation.for('src/lib/translation.ts', {}); // in runtime replaced with proper stuff
|
|
396
|
+
|
|
397
|
+
t.gettext('asdasd');
|
|
398
|
+
|
|
399
|
+
class AnyAngularOrTaonClass {
|
|
400
|
+
t = t.for(this); // probably only usefull for cdr in angular
|
|
401
|
+
|
|
402
|
+
isLoading$ = t.isLoadingLang$; // maybe needed sometime
|
|
403
|
+
|
|
404
|
+
refreshableSignalLabel$ = t.signal.gettext(t.gettext('welcome'));
|
|
405
|
+
|
|
406
|
+
refreshableRxjsLabel$ = t.$.gettext('amazing better place'); // probably even better
|
|
407
|
+
|
|
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
|
|
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
|
+
static { this.selector = '[translate]'; }
|
|
434
|
+
ngOnInit() {
|
|
435
|
+
this.originalText = this.element.nativeElement.textContent?.trim() ?? '';
|
|
436
|
+
this.initialized = true;
|
|
437
|
+
this.render();
|
|
438
|
+
this.t.isLoadingLang$
|
|
439
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
440
|
+
.subscribe(() => {
|
|
441
|
+
// this.t.debug && console.log(`Rerender "${this.originalText}"`)
|
|
442
|
+
this.render();
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
ngOnChanges() {
|
|
446
|
+
if (!this.initialized)
|
|
447
|
+
return;
|
|
448
|
+
// this.t.debug && console.log(`On Chnags for "${this.originalText}"`)
|
|
449
|
+
this.render();
|
|
450
|
+
}
|
|
451
|
+
ngOnDestroy() { }
|
|
452
|
+
render() {
|
|
453
|
+
// console.log('render', this);
|
|
454
|
+
if (!this.t) {
|
|
455
|
+
throw (`Directive ${TranslateDirective.selector} applied on component ` +
|
|
456
|
+
`wihtout implemented Translatable interface`);
|
|
457
|
+
}
|
|
458
|
+
this.element.nativeElement.textContent = this.t.translate(this.originalText, this.params, this.translateContext);
|
|
459
|
+
//#region @browser
|
|
460
|
+
// this.t.cdr?.markForCheck();
|
|
461
|
+
//#endregion
|
|
462
|
+
}
|
|
463
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
464
|
+
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 }); }
|
|
465
|
+
}
|
|
466
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslateDirective, decorators: [{
|
|
467
|
+
type: Directive,
|
|
468
|
+
args: [{
|
|
469
|
+
selector: '[translate]',
|
|
470
|
+
standalone: true,
|
|
471
|
+
}]
|
|
472
|
+
}], propDecorators: { t: [{
|
|
473
|
+
type: Input,
|
|
474
|
+
args: ['translate-t']
|
|
475
|
+
}], params: [{
|
|
476
|
+
type: Input,
|
|
477
|
+
args: ['translate-params']
|
|
478
|
+
}], translateContext: [{
|
|
479
|
+
type: Input,
|
|
480
|
+
args: ['translate-context']
|
|
481
|
+
}] } });
|
|
482
|
+
|
|
483
|
+
class TranslatePipe {
|
|
484
|
+
constructor() {
|
|
485
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
486
|
+
this.tranlsationManager = TranslationManager.Instance;
|
|
487
|
+
this.sub = this.tranlsationManager.isLoadingLangs$.subscribe(() => {
|
|
488
|
+
this.cdr.markForCheck();
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
transform(text, t, params, context) {
|
|
492
|
+
return t?.gettext(text, params, context) ?? text;
|
|
493
|
+
}
|
|
494
|
+
ngOnDestroy() {
|
|
495
|
+
this.sub.unsubscribe();
|
|
496
|
+
}
|
|
497
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
498
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.9", ngImport: i0, type: TranslatePipe, isStandalone: true, name: "translate", pure: false }); }
|
|
499
|
+
}
|
|
500
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslatePipe, decorators: [{
|
|
501
|
+
type: Pipe,
|
|
502
|
+
args: [{
|
|
503
|
+
name: 'translate',
|
|
504
|
+
standalone: true,
|
|
505
|
+
pure: false,
|
|
506
|
+
}]
|
|
507
|
+
}], ctorParameters: () => [] });
|
|
508
|
+
|
|
509
|
+
class TranslateService {
|
|
510
|
+
constructor() {
|
|
511
|
+
this.manager = TranslationManager.Instance;
|
|
512
|
+
/**
|
|
513
|
+
* TODO
|
|
514
|
+
*/
|
|
515
|
+
this.isLoadingLangs$ = this.manager.isLoadingLangs$;
|
|
516
|
+
this.availableLangs$ = this.manager.availableLangs$;
|
|
517
|
+
this.currentGlobalLanguage$ = this.manager.currentGlobalLanguage$;
|
|
518
|
+
}
|
|
519
|
+
setOneLanguagePernament(lang) {
|
|
520
|
+
this.manager.setOneLanguagePernament(lang);
|
|
521
|
+
}
|
|
522
|
+
//#region change global lang
|
|
523
|
+
async changeGlobalLang(lang) {
|
|
524
|
+
await this.manager.changeGlobalLang(lang);
|
|
525
|
+
}
|
|
526
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
527
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslateService, providedIn: 'root' }); }
|
|
528
|
+
}
|
|
529
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.9", ngImport: i0, type: TranslateService, decorators: [{
|
|
530
|
+
type: Injectable,
|
|
531
|
+
args: [{ providedIn: 'root' }]
|
|
532
|
+
}] });
|
|
533
|
+
|
|
534
|
+
//#endregion
|
|
535
|
+
var UtilsI18nExtractGettextTranslateFromHtml;
|
|
536
|
+
(function (UtilsI18nExtractGettextTranslateFromHtml) {
|
|
537
|
+
function extractGettextTranslateFromHtml(html, fileName = 'template.html') {
|
|
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
|
+
/* */
|
|
627
|
+
/* */
|
|
628
|
+
/* */
|
|
629
|
+
/* */
|
|
630
|
+
/* */
|
|
631
|
+
return (void 0);
|
|
632
|
+
}
|
|
633
|
+
UtilsI18nExtractGettextTranslateFromHtml.extractGettextTranslateFromHtml = extractGettextTranslateFromHtml;
|
|
634
|
+
function extractGettextCallsFromSource(html) {
|
|
635
|
+
/* */
|
|
636
|
+
/* */
|
|
637
|
+
/* */
|
|
638
|
+
/* */
|
|
639
|
+
/* */
|
|
640
|
+
/* */
|
|
641
|
+
/* */
|
|
642
|
+
/* */
|
|
643
|
+
/* */
|
|
644
|
+
/* */
|
|
645
|
+
/* */
|
|
646
|
+
/* */
|
|
647
|
+
/* */
|
|
648
|
+
/* */
|
|
649
|
+
/* */
|
|
650
|
+
/* */
|
|
651
|
+
/* */
|
|
652
|
+
/* */
|
|
653
|
+
/* */
|
|
654
|
+
/* */
|
|
655
|
+
/* */
|
|
656
|
+
/* */
|
|
657
|
+
/* */
|
|
658
|
+
/* */
|
|
659
|
+
/* */
|
|
660
|
+
/* */
|
|
661
|
+
/* */
|
|
662
|
+
return (void 0);
|
|
663
|
+
}
|
|
664
|
+
function extractGettextCallsFromHtmlExpression(source) {
|
|
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
|
+
/* */
|
|
697
|
+
/* */
|
|
698
|
+
/* */
|
|
699
|
+
/* */
|
|
700
|
+
/* */
|
|
701
|
+
return (void 0);
|
|
702
|
+
}
|
|
703
|
+
function readBalancedParenthesesContent(source, openParenIndex) {
|
|
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
|
+
/* */
|
|
748
|
+
/* */
|
|
749
|
+
/* */
|
|
750
|
+
/* */
|
|
751
|
+
/* */
|
|
752
|
+
return (void 0);
|
|
753
|
+
}
|
|
754
|
+
function readStaticStringArg(arg) {
|
|
755
|
+
/* */
|
|
756
|
+
/* */
|
|
757
|
+
/* */
|
|
758
|
+
/* */
|
|
759
|
+
/* */
|
|
760
|
+
/* */
|
|
761
|
+
/* */
|
|
762
|
+
/* */
|
|
763
|
+
/* */
|
|
764
|
+
/* */
|
|
765
|
+
/* */
|
|
766
|
+
/* */
|
|
767
|
+
/* */
|
|
768
|
+
/* */
|
|
769
|
+
/* */
|
|
770
|
+
/* */
|
|
771
|
+
return (void 0);
|
|
772
|
+
}
|
|
773
|
+
function extractTranslateParamsFromSource(source) {
|
|
774
|
+
/* */
|
|
775
|
+
/* */
|
|
776
|
+
/* */
|
|
777
|
+
/* */
|
|
778
|
+
/* */
|
|
779
|
+
/* */
|
|
780
|
+
return (void 0);
|
|
781
|
+
}
|
|
782
|
+
function extractObjectLiteralParams(raw) {
|
|
783
|
+
/* */
|
|
784
|
+
/* */
|
|
785
|
+
/* */
|
|
786
|
+
/* */
|
|
787
|
+
/* */
|
|
788
|
+
/* */
|
|
789
|
+
/* */
|
|
790
|
+
/* */
|
|
791
|
+
/* */
|
|
792
|
+
/* */
|
|
793
|
+
/* */
|
|
794
|
+
/* */
|
|
795
|
+
/* */
|
|
796
|
+
/* */
|
|
797
|
+
/* */
|
|
798
|
+
/* */
|
|
799
|
+
/* */
|
|
800
|
+
/* */
|
|
801
|
+
/* */
|
|
802
|
+
/* */
|
|
803
|
+
/* */
|
|
804
|
+
/* */
|
|
805
|
+
/* */
|
|
806
|
+
return (void 0);
|
|
807
|
+
}
|
|
808
|
+
function splitTopLevel(input, separator) {
|
|
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
|
+
/* */
|
|
841
|
+
/* */
|
|
842
|
+
/* */
|
|
843
|
+
/* */
|
|
844
|
+
/* */
|
|
845
|
+
return (void 0);
|
|
846
|
+
}
|
|
847
|
+
function extractTranslatePipeStringsFromSource(source) {
|
|
848
|
+
/* */
|
|
849
|
+
/* */
|
|
850
|
+
/* */
|
|
851
|
+
/* */
|
|
852
|
+
/* */
|
|
853
|
+
/* */
|
|
854
|
+
/* */
|
|
855
|
+
/* */
|
|
856
|
+
/* */
|
|
857
|
+
/* */
|
|
858
|
+
/* */
|
|
859
|
+
/* */
|
|
860
|
+
/* */
|
|
861
|
+
/* */
|
|
862
|
+
/* */
|
|
863
|
+
/* */
|
|
864
|
+
/* */
|
|
865
|
+
/* */
|
|
866
|
+
/* */
|
|
867
|
+
/* */
|
|
868
|
+
/* */
|
|
869
|
+
/* */
|
|
870
|
+
/* */
|
|
871
|
+
/* */
|
|
872
|
+
/* */
|
|
873
|
+
/* */
|
|
874
|
+
return (void 0);
|
|
875
|
+
}
|
|
876
|
+
function extractStringLiterals(source) {
|
|
877
|
+
/* */
|
|
878
|
+
/* */
|
|
879
|
+
/* */
|
|
880
|
+
/* */
|
|
881
|
+
/* */
|
|
882
|
+
/* */
|
|
883
|
+
/* */
|
|
884
|
+
/* */
|
|
885
|
+
/* */
|
|
886
|
+
return (void 0);
|
|
887
|
+
}
|
|
888
|
+
function getNodeAttributes(node) {
|
|
889
|
+
/* */
|
|
890
|
+
/* */
|
|
891
|
+
/* */
|
|
892
|
+
/* */
|
|
893
|
+
/* */
|
|
894
|
+
return (void 0);
|
|
895
|
+
}
|
|
896
|
+
function getNodeInputs(node) {
|
|
897
|
+
/* */
|
|
898
|
+
/* */
|
|
899
|
+
/* */
|
|
900
|
+
/* */
|
|
901
|
+
/* */
|
|
902
|
+
return (void 0);
|
|
903
|
+
}
|
|
904
|
+
function isText(node) {
|
|
905
|
+
/* */
|
|
906
|
+
/* */
|
|
907
|
+
/* */
|
|
908
|
+
/* */
|
|
909
|
+
return (void 0);
|
|
910
|
+
}
|
|
911
|
+
function isBoundText(node) {
|
|
912
|
+
/* */
|
|
913
|
+
/* */
|
|
914
|
+
return (void 0);
|
|
915
|
+
}
|
|
916
|
+
function collectText(nodes) {
|
|
917
|
+
/* */
|
|
918
|
+
/* */
|
|
919
|
+
/* */
|
|
920
|
+
/* */
|
|
921
|
+
/* */
|
|
922
|
+
/* */
|
|
923
|
+
/* */
|
|
924
|
+
/* */
|
|
925
|
+
/* */
|
|
926
|
+
/* */
|
|
927
|
+
/* */
|
|
928
|
+
/* */
|
|
929
|
+
/* */
|
|
930
|
+
/* */
|
|
931
|
+
/* */
|
|
932
|
+
/* */
|
|
933
|
+
/* */
|
|
934
|
+
/* */
|
|
935
|
+
/* */
|
|
936
|
+
/* */
|
|
937
|
+
return (void 0);
|
|
938
|
+
}
|
|
939
|
+
function extractTranslateDirectiveFromSource(html) {
|
|
940
|
+
/* */
|
|
941
|
+
/* */
|
|
942
|
+
/* */
|
|
943
|
+
/* */
|
|
944
|
+
/* */
|
|
945
|
+
/* */
|
|
946
|
+
/* */
|
|
947
|
+
/* */
|
|
948
|
+
/* */
|
|
949
|
+
/* */
|
|
950
|
+
/* */
|
|
951
|
+
/* */
|
|
952
|
+
/* */
|
|
953
|
+
/* */
|
|
954
|
+
/* */
|
|
955
|
+
/* */
|
|
956
|
+
/* */
|
|
957
|
+
/* */
|
|
958
|
+
/* */
|
|
959
|
+
/* */
|
|
960
|
+
/* */
|
|
961
|
+
/* */
|
|
962
|
+
/* */
|
|
963
|
+
/* */
|
|
964
|
+
/* */
|
|
965
|
+
/* */
|
|
966
|
+
/* */
|
|
967
|
+
/* */
|
|
968
|
+
return (void 0);
|
|
969
|
+
}
|
|
970
|
+
function stripHtml(html) {
|
|
971
|
+
/* */
|
|
972
|
+
/* */
|
|
973
|
+
return (void 0);
|
|
974
|
+
}
|
|
975
|
+
function extractTranslateParams(inputs) {
|
|
976
|
+
/* */
|
|
977
|
+
/* */
|
|
978
|
+
/* */
|
|
979
|
+
/* */
|
|
980
|
+
/* */
|
|
981
|
+
/* */
|
|
982
|
+
/* */
|
|
983
|
+
/* */
|
|
984
|
+
return (void 0);
|
|
985
|
+
}
|
|
986
|
+
function extractObjectLiteralFromAst(ast) {
|
|
987
|
+
/* */
|
|
988
|
+
/* */
|
|
989
|
+
/* */
|
|
990
|
+
/* */
|
|
991
|
+
/* */
|
|
992
|
+
/* */
|
|
993
|
+
/* */
|
|
994
|
+
/* */
|
|
995
|
+
/* */
|
|
996
|
+
/* */
|
|
997
|
+
/* */
|
|
998
|
+
/* */
|
|
999
|
+
/* */
|
|
1000
|
+
/* */
|
|
1001
|
+
/* */
|
|
1002
|
+
return (void 0);
|
|
1003
|
+
}
|
|
1004
|
+
function extractTranslatePipeStrings(ast) {
|
|
1005
|
+
/* */
|
|
1006
|
+
/* */
|
|
1007
|
+
/* */
|
|
1008
|
+
/* */
|
|
1009
|
+
/* */
|
|
1010
|
+
/* */
|
|
1011
|
+
/* */
|
|
1012
|
+
/* */
|
|
1013
|
+
/* */
|
|
1014
|
+
/* */
|
|
1015
|
+
/* */
|
|
1016
|
+
/* */
|
|
1017
|
+
/* */
|
|
1018
|
+
/* */
|
|
1019
|
+
/* */
|
|
1020
|
+
/* */
|
|
1021
|
+
/* */
|
|
1022
|
+
/* */
|
|
1023
|
+
/* */
|
|
1024
|
+
/* */
|
|
1025
|
+
/* */
|
|
1026
|
+
/* */
|
|
1027
|
+
/* */
|
|
1028
|
+
/* */
|
|
1029
|
+
/* */
|
|
1030
|
+
/* */
|
|
1031
|
+
return (void 0);
|
|
1032
|
+
}
|
|
1033
|
+
function extractStaticStringsFromExpression(ast) {
|
|
1034
|
+
/* */
|
|
1035
|
+
/* */
|
|
1036
|
+
/* */
|
|
1037
|
+
/* */
|
|
1038
|
+
/* */
|
|
1039
|
+
/* */
|
|
1040
|
+
/* */
|
|
1041
|
+
/* */
|
|
1042
|
+
/* */
|
|
1043
|
+
/* */
|
|
1044
|
+
/* */
|
|
1045
|
+
/* */
|
|
1046
|
+
/* */
|
|
1047
|
+
/* */
|
|
1048
|
+
/* */
|
|
1049
|
+
/* */
|
|
1050
|
+
/* */
|
|
1051
|
+
/* */
|
|
1052
|
+
/* */
|
|
1053
|
+
/* */
|
|
1054
|
+
/* */
|
|
1055
|
+
/* */
|
|
1056
|
+
return (void 0);
|
|
1057
|
+
}
|
|
1058
|
+
function astToSource(ast) {
|
|
1059
|
+
/* */
|
|
1060
|
+
/* */
|
|
1061
|
+
/* */
|
|
1062
|
+
/* */
|
|
1063
|
+
/* */
|
|
1064
|
+
/* */
|
|
1065
|
+
/* */
|
|
1066
|
+
/* */
|
|
1067
|
+
/* */
|
|
1068
|
+
/* */
|
|
1069
|
+
/* */
|
|
1070
|
+
/* */
|
|
1071
|
+
/* */
|
|
1072
|
+
/* */
|
|
1073
|
+
/* */
|
|
1074
|
+
/* */
|
|
1075
|
+
/* */
|
|
1076
|
+
/* */
|
|
1077
|
+
/* */
|
|
1078
|
+
/* */
|
|
1079
|
+
/* */
|
|
1080
|
+
/* */
|
|
1081
|
+
/* */
|
|
1082
|
+
return (void 0);
|
|
1083
|
+
}
|
|
1084
|
+
function normalizeHtmlText(text) {
|
|
1085
|
+
/* */
|
|
1086
|
+
/* */
|
|
1087
|
+
return (void 0);
|
|
1088
|
+
}
|
|
1089
|
+
function uniqueMessages(messages) {
|
|
1090
|
+
/* */
|
|
1091
|
+
/* */
|
|
1092
|
+
/* */
|
|
1093
|
+
/* */
|
|
1094
|
+
/* */
|
|
1095
|
+
/* */
|
|
1096
|
+
/* */
|
|
1097
|
+
/* */
|
|
1098
|
+
/* */
|
|
1099
|
+
/* */
|
|
1100
|
+
/* */
|
|
1101
|
+
/* */
|
|
1102
|
+
/* */
|
|
1103
|
+
/* */
|
|
1104
|
+
/* */
|
|
1105
|
+
return (void 0);
|
|
1106
|
+
}
|
|
1107
|
+
//#endregion
|
|
1108
|
+
})(UtilsI18nExtractGettextTranslateFromHtml || (UtilsI18nExtractGettextTranslateFromHtml = {}));
|
|
1109
|
+
|
|
1110
|
+
//#endregion
|
|
1111
|
+
var UtilsI18nHtml;
|
|
1112
|
+
(function (UtilsI18nHtml) {
|
|
1113
|
+
function extractGettextTranslateFromHtml(html, fileName = 'template.html') {
|
|
1114
|
+
return UtilsI18nExtractGettextTranslateFromHtml.extractGettextTranslateFromHtml(html, fileName);
|
|
1115
|
+
}
|
|
1116
|
+
UtilsI18nHtml.extractGettextTranslateFromHtml = extractGettextTranslateFromHtml;
|
|
1117
|
+
function replaceTranslatePipieDirectiveTContext(html) {
|
|
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
|
+
/* */
|
|
1170
|
+
/* */
|
|
1171
|
+
/* */
|
|
1172
|
+
/* */
|
|
1173
|
+
/* */
|
|
1174
|
+
/* */
|
|
1175
|
+
/* */
|
|
1176
|
+
/* */
|
|
1177
|
+
/* */
|
|
1178
|
+
/* */
|
|
1179
|
+
/* */
|
|
1180
|
+
return (void 0);
|
|
1181
|
+
}
|
|
1182
|
+
UtilsI18nHtml.replaceTranslatePipieDirectiveTContext = replaceTranslatePipieDirectiveTContext;
|
|
1183
|
+
function findTranslateDirectiveEditsFromSource(html) {
|
|
1184
|
+
/* */
|
|
1185
|
+
/* */
|
|
1186
|
+
/* */
|
|
1187
|
+
/* */
|
|
1188
|
+
/* */
|
|
1189
|
+
/* */
|
|
1190
|
+
/* */
|
|
1191
|
+
/* */
|
|
1192
|
+
/* */
|
|
1193
|
+
/* */
|
|
1194
|
+
/* */
|
|
1195
|
+
/* */
|
|
1196
|
+
/* */
|
|
1197
|
+
/* */
|
|
1198
|
+
/* */
|
|
1199
|
+
/* */
|
|
1200
|
+
/* */
|
|
1201
|
+
/* */
|
|
1202
|
+
/* */
|
|
1203
|
+
/* */
|
|
1204
|
+
/* */
|
|
1205
|
+
/* */
|
|
1206
|
+
/* */
|
|
1207
|
+
/* */
|
|
1208
|
+
/* */
|
|
1209
|
+
/* */
|
|
1210
|
+
/* */
|
|
1211
|
+
/* */
|
|
1212
|
+
/* */
|
|
1213
|
+
return (void 0);
|
|
1214
|
+
}
|
|
1215
|
+
function hasTranslateDirective(node) {
|
|
1216
|
+
/* */
|
|
1217
|
+
/* */
|
|
1218
|
+
/* */
|
|
1219
|
+
/* */
|
|
1220
|
+
return (void 0);
|
|
1221
|
+
}
|
|
1222
|
+
function hasTranslateTInput(node) {
|
|
1223
|
+
/* */
|
|
1224
|
+
/* */
|
|
1225
|
+
/* */
|
|
1226
|
+
/* */
|
|
1227
|
+
/* */
|
|
1228
|
+
/* */
|
|
1229
|
+
/* */
|
|
1230
|
+
/* */
|
|
1231
|
+
return (void 0);
|
|
1232
|
+
}
|
|
1233
|
+
function findOpenTagInsertPosition(html, start, length) {
|
|
1234
|
+
/* */
|
|
1235
|
+
/* */
|
|
1236
|
+
/* */
|
|
1237
|
+
/* */
|
|
1238
|
+
/* */
|
|
1239
|
+
/* */
|
|
1240
|
+
/* */
|
|
1241
|
+
/* */
|
|
1242
|
+
/* */
|
|
1243
|
+
/* */
|
|
1244
|
+
/* */
|
|
1245
|
+
/* */
|
|
1246
|
+
/* */
|
|
1247
|
+
/* */
|
|
1248
|
+
return (void 0);
|
|
1249
|
+
}
|
|
1250
|
+
function applyEdits(input, edits) {
|
|
1251
|
+
/* */
|
|
1252
|
+
/* */
|
|
1253
|
+
/* */
|
|
1254
|
+
/* */
|
|
1255
|
+
/* */
|
|
1256
|
+
/* */
|
|
1257
|
+
return (void 0);
|
|
1258
|
+
}
|
|
1259
|
+
})(UtilsI18nHtml || (UtilsI18nHtml = {}));
|
|
1260
|
+
|
|
1261
|
+
var UtilsPoFile;
|
|
1262
|
+
(function (UtilsPoFile) {
|
|
1263
|
+
//#region generate po files
|
|
1264
|
+
function generatePoFiles(files, locales, destinationAbsFolderPath) {
|
|
1265
|
+
/* */
|
|
1266
|
+
/* */
|
|
1267
|
+
/* */
|
|
1268
|
+
/* */
|
|
1269
|
+
/* */
|
|
1270
|
+
/* */
|
|
1271
|
+
/* */
|
|
1272
|
+
/* */
|
|
1273
|
+
/* */
|
|
1274
|
+
return (void 0);
|
|
1275
|
+
}
|
|
1276
|
+
UtilsPoFile.generatePoFiles = generatePoFiles;
|
|
1277
|
+
//#endregion
|
|
1278
|
+
//#region generate po file content
|
|
1279
|
+
function generatePoFileContent(files, locale) {
|
|
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
|
+
/* */
|
|
1326
|
+
/* */
|
|
1327
|
+
/* */
|
|
1328
|
+
/* */
|
|
1329
|
+
/* */
|
|
1330
|
+
/* */
|
|
1331
|
+
/* */
|
|
1332
|
+
/* */
|
|
1333
|
+
/* */
|
|
1334
|
+
/* */
|
|
1335
|
+
/* */
|
|
1336
|
+
return (void 0);
|
|
1337
|
+
}
|
|
1338
|
+
UtilsPoFile.generatePoFileContent = generatePoFileContent;
|
|
1339
|
+
//#endregion
|
|
1340
|
+
//#region extract po to json
|
|
1341
|
+
function extractPoToJson(poFileContent) {
|
|
1342
|
+
/* */
|
|
1343
|
+
/* */
|
|
1344
|
+
/* */
|
|
1345
|
+
/* */
|
|
1346
|
+
/* */
|
|
1347
|
+
/* */
|
|
1348
|
+
/* */
|
|
1349
|
+
/* */
|
|
1350
|
+
/* */
|
|
1351
|
+
/* */
|
|
1352
|
+
/* */
|
|
1353
|
+
/* */
|
|
1354
|
+
/* */
|
|
1355
|
+
/* */
|
|
1356
|
+
/* */
|
|
1357
|
+
/* */
|
|
1358
|
+
/* */
|
|
1359
|
+
/* */
|
|
1360
|
+
/* */
|
|
1361
|
+
/* */
|
|
1362
|
+
/* */
|
|
1363
|
+
/* */
|
|
1364
|
+
/* */
|
|
1365
|
+
/* */
|
|
1366
|
+
/* */
|
|
1367
|
+
/* */
|
|
1368
|
+
/* */
|
|
1369
|
+
/* */
|
|
1370
|
+
/* */
|
|
1371
|
+
/* */
|
|
1372
|
+
/* */
|
|
1373
|
+
return (void 0);
|
|
1374
|
+
}
|
|
1375
|
+
UtilsPoFile.extractPoToJson = extractPoToJson;
|
|
1376
|
+
//#endregion
|
|
1377
|
+
//#region generate translation override interface
|
|
1378
|
+
function generateTranslationOverrideInterface(file, interfaceName, locale) {
|
|
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
|
+
/* */
|
|
1408
|
+
/* */
|
|
1409
|
+
/* */
|
|
1410
|
+
/* */
|
|
1411
|
+
/* */
|
|
1412
|
+
/* */
|
|
1413
|
+
/* */
|
|
1414
|
+
/* */
|
|
1415
|
+
/* */
|
|
1416
|
+
/* */
|
|
1417
|
+
/* */
|
|
1418
|
+
return (void 0);
|
|
1419
|
+
}
|
|
1420
|
+
UtilsPoFile.generateTranslationOverrideInterface = generateTranslationOverrideInterface;
|
|
1421
|
+
function escapeTs(value) {
|
|
1422
|
+
return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
1423
|
+
}
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region merge gettext file
|
|
1426
|
+
function mergeGettextFile(jsonContent1FromTsHtml, json2ContentFromPoFileModifedByUser) {
|
|
1427
|
+
/* */
|
|
1428
|
+
/* */
|
|
1429
|
+
/* */
|
|
1430
|
+
/* */
|
|
1431
|
+
/* */
|
|
1432
|
+
/* */
|
|
1433
|
+
/* */
|
|
1434
|
+
/* */
|
|
1435
|
+
/* */
|
|
1436
|
+
/* */
|
|
1437
|
+
/* */
|
|
1438
|
+
/* */
|
|
1439
|
+
/* */
|
|
1440
|
+
/* */
|
|
1441
|
+
/* */
|
|
1442
|
+
/* */
|
|
1443
|
+
/* */
|
|
1444
|
+
/* */
|
|
1445
|
+
/* */
|
|
1446
|
+
/* */
|
|
1447
|
+
/* */
|
|
1448
|
+
return (void 0);
|
|
1449
|
+
}
|
|
1450
|
+
UtilsPoFile.mergeGettextFile = mergeGettextFile;
|
|
1451
|
+
//#endregion
|
|
1452
|
+
//#region models & helpers
|
|
1453
|
+
function getGettextTagKey(tag) {
|
|
1454
|
+
return `${tag.context ?? ''}\u0004${tag.gettextString}`;
|
|
1455
|
+
}
|
|
1456
|
+
function parsePoEntries(po) {
|
|
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
|
+
/* */
|
|
1510
|
+
/* */
|
|
1511
|
+
/* */
|
|
1512
|
+
/* */
|
|
1513
|
+
/* */
|
|
1514
|
+
/* */
|
|
1515
|
+
/* */
|
|
1516
|
+
/* */
|
|
1517
|
+
/* */
|
|
1518
|
+
/* */
|
|
1519
|
+
/* */
|
|
1520
|
+
return (void 0);
|
|
1521
|
+
}
|
|
1522
|
+
function parsePoRef(ref) {
|
|
1523
|
+
/* */
|
|
1524
|
+
/* */
|
|
1525
|
+
/* */
|
|
1526
|
+
/* */
|
|
1527
|
+
/* */
|
|
1528
|
+
/* */
|
|
1529
|
+
/* */
|
|
1530
|
+
/* */
|
|
1531
|
+
return (void 0);
|
|
1532
|
+
}
|
|
1533
|
+
function escapePoString(value) {
|
|
1534
|
+
return value
|
|
1535
|
+
.replace(/\\/g, '\\\\')
|
|
1536
|
+
.replace(/"/g, '\\"')
|
|
1537
|
+
.replace(/\n/g, '\\n');
|
|
1538
|
+
}
|
|
1539
|
+
function readPoQuoted(value) {
|
|
1540
|
+
const match = value.match(/^"([\s\S]*)"$/);
|
|
1541
|
+
if (!match)
|
|
1542
|
+
return '';
|
|
1543
|
+
return unescapePoString(match[1]);
|
|
1544
|
+
}
|
|
1545
|
+
function unescapePoString(value) {
|
|
1546
|
+
return value
|
|
1547
|
+
.replace(/\\n/g, '\n')
|
|
1548
|
+
.replace(/\\"/g, '"')
|
|
1549
|
+
.replace(/\\\\/g, '\\');
|
|
1550
|
+
}
|
|
1551
|
+
//#endregion
|
|
1552
|
+
})(UtilsPoFile || (UtilsPoFile = {}));
|
|
1553
|
+
|
|
1554
|
+
// @ts-nocheck
|
|
1555
|
+
// This file is auto-generated during init process. Do not modify.
|
|
1556
|
+
// This disable this auto generate file.
|
|
1557
|
+
// set property "shouldGenerateAutogenIndexFile: false"
|
|
1558
|
+
// in taon.jsonc of your project.
|
|
1559
|
+
|
|
1560
|
+
var index = {};
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* Generated bundle index. Do not edit.
|
|
1564
|
+
*/
|
|
1565
|
+
|
|
1566
|
+
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 };
|
|
1567
|
+
//# sourceMappingURL=i18n-websql.mjs.map
|