@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,7 +1,9 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { ChangeDetectorRef, WritableSignal, OnInit, OnDestroy, OnChanges, PipeTransform } from '@angular/core';
|
|
4
|
+
import * as rxjs from 'rxjs';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
import { UtilsI18n__NS__CommonLocaleCode, UtilsI18n__NS__LangOption, UtilsI18n__NS__GettextFile, UtilsI18n__NS__GettextExtracted } from 'tnp-core/browser-prod';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Autogenerated by current cli tool
|
|
@@ -26,10 +28,7 @@ declare const CURRENT_PACKAGE_TAON_VERSION = "v21";
|
|
|
26
28
|
/**
|
|
27
29
|
* Autogenerated by current cli tool. Use *tnp release* to bump version.
|
|
28
30
|
*/
|
|
29
|
-
declare const CURRENT_PACKAGE_VERSION = "
|
|
30
|
-
|
|
31
|
-
declare const INTERNAL_TRANSIGNAL_CONFIG: unique symbol;
|
|
32
|
-
declare const TREE_SHAKED_TRANSLATIONS: unique symbol;
|
|
31
|
+
declare const CURRENT_PACKAGE_VERSION = "21.0.7";
|
|
33
32
|
|
|
34
33
|
/**
|
|
35
34
|
*
|
|
@@ -38,316 +37,152 @@ declare const TREE_SHAKED_TRANSLATIONS: unique symbol;
|
|
|
38
37
|
*/
|
|
39
38
|
declare function startCli(argsv: string[], filename: string): Promise<void>;
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
type Paths<T> = T extends object ? T extends Array<infer U> ? `${number}${'' | DotPrefix<Paths<U>>}` : {
|
|
59
|
-
[K in keyof T]-?: K extends string | number ? `${K}${'' | DotPrefix<Paths<T[K]>>}` : never;
|
|
60
|
-
}[keyof T] : '';
|
|
61
|
-
type ArrayPaths<T> = {
|
|
62
|
-
[P in Paths<T>]: GetNestedType<T, P> extends Array<unknown> ? P : never;
|
|
63
|
-
}[Paths<T>];
|
|
64
|
-
type ObjectPaths<T> = {
|
|
65
|
-
[P in Paths<T>]: GetNestedType<T, P> extends Record<any, unknown> ? P : never;
|
|
66
|
-
}[Paths<T>];
|
|
67
|
-
type PluralPaths<T> = {
|
|
68
|
-
[P in Paths<T>]: GetNestedType<T, P> extends PluralTranslation ? P : never;
|
|
69
|
-
}[Paths<T>];
|
|
70
|
-
type SelectPaths<T> = {
|
|
71
|
-
[P in Paths<T>]: GetNestedType<T, P> extends SelectTranslation ? P : never;
|
|
72
|
-
}[Paths<T>];
|
|
73
|
-
type StringPaths<T> = {
|
|
74
|
-
[P in Paths<T>]: GetNestedType<T, P> extends string ? P : never;
|
|
75
|
-
}[Paths<T>];
|
|
76
|
-
type StringKeys<T> = Extract<keyof T, string>;
|
|
77
|
-
type ResourceRefLike<T> = {
|
|
78
|
-
value: Signal<T | undefined>;
|
|
79
|
-
isLoading: Signal<boolean>;
|
|
80
|
-
error: Signal<Error | undefined>;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
type TransignalError =
|
|
84
|
-
/** Error when key is not found in translations */
|
|
85
|
-
'missing_key'
|
|
86
|
-
/** Error when translation file for scope and lang has not been found */
|
|
87
|
-
| 'missing_file'
|
|
88
|
-
/** Error plural for a value is not defined for a language */
|
|
89
|
-
| 'missing_plural'
|
|
90
|
-
/** Error when plural used on a non-plural translation */
|
|
91
|
-
| 'invalid_plural'
|
|
92
|
-
/** Error select for a value is not defined for a language */
|
|
93
|
-
| 'missing_select'
|
|
94
|
-
/** Error when select used on a non-select translation */
|
|
95
|
-
| 'invalid_select'
|
|
96
|
-
/** Error when prefix chain is called more then {@link TransignalConfig.maxPrefixDepth} */
|
|
97
|
-
| 'prefix_too_deep';
|
|
98
|
-
type TranslateParams = Record<string, unknown>;
|
|
99
|
-
type Marked<K, T> = K & {
|
|
100
|
-
__marker: T;
|
|
101
|
-
};
|
|
102
|
-
type BasePluralTranslation = Partial<Record<number | 'one' | 'few' | 'many' | 'other', string>>;
|
|
103
|
-
type PluralTranslation = Marked<BasePluralTranslation, 'plural'>;
|
|
104
|
-
type BaseSelectTranslation = Partial<Record<string | number | 'null', string>>;
|
|
105
|
-
type MarkedAsSelect<T extends BaseSelectTranslation> = Marked<T, 'select'>;
|
|
106
|
-
type SelectTranslation = MarkedAsSelect<BaseSelectTranslation>;
|
|
107
|
-
type TranslateFn<Keys extends string, Result> = (key: Keys, params?: TranslateParams) => Result;
|
|
108
|
-
type TranslateObj<Context extends Record<string, any>> = TranslateFn<StringPaths<Context>, string> & {
|
|
109
|
-
/**
|
|
110
|
-
* Returns translating function that returns an array of translations
|
|
111
|
-
* @param key path of translation
|
|
112
|
-
* @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
|
|
113
|
-
*/
|
|
114
|
-
arr: <ArrKey extends ArrayPaths<Context>>(key: ArrKey, params?: TranslateParams) => GetNestedType<Context, ArrKey>;
|
|
115
|
-
/**
|
|
116
|
-
* Returns translating function that returns an object of translations
|
|
117
|
-
* @param key path of translation
|
|
118
|
-
* @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
|
|
119
|
-
*/
|
|
120
|
-
obj: <ObjKey extends ObjectPaths<Context>>(key: ObjKey, params?: TranslateParams) => GetNestedType<Context, ObjKey>;
|
|
121
|
-
/**
|
|
122
|
-
* Returns translating function that returns a string translation depending on a correct plural form
|
|
123
|
-
* @param key path of translation
|
|
124
|
-
* @param count count to determine correct plural form
|
|
125
|
-
* @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
|
|
126
|
-
*/
|
|
127
|
-
plural: <ObjKey extends PluralPaths<Context>>(key: ObjKey, count: number, params?: TranslateParams) => string;
|
|
128
|
-
/**
|
|
129
|
-
* Returns translating function that returns a string translation depending on a selected value
|
|
130
|
-
* @param key path of translation
|
|
131
|
-
* @param value value to determine selected translation
|
|
132
|
-
* @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
|
|
133
|
-
*/
|
|
134
|
-
select: <ObjKey extends SelectPaths<Context>>(key: ObjKey, value: keyof SelectTranslation | null, params?: TranslateParams) => string;
|
|
135
|
-
/**
|
|
136
|
-
* Returns translating function that is encapsulated in a selected prefix
|
|
137
|
-
* @param prefix path of new root translation
|
|
138
|
-
*/
|
|
139
|
-
prefix: <T extends ObjectPaths<Context>>(prefix: T) => TranslateObj<GetNestedType<Context, T>>;
|
|
140
|
-
};
|
|
141
|
-
type TranslationFile = Record<string, unknown>;
|
|
142
|
-
type TransignalConfig<Languages extends string, Translations extends Record<string, Record<string, unknown>>> = {
|
|
143
|
-
/**
|
|
144
|
-
* Default language code
|
|
145
|
-
*/
|
|
146
|
-
defaultLang: NoInfer<Languages>;
|
|
40
|
+
declare class TranslationManager {
|
|
41
|
+
instances: Set<Translation>;
|
|
42
|
+
constructor();
|
|
43
|
+
private defaultLangLocale;
|
|
44
|
+
private _currentGlobalLanguage;
|
|
45
|
+
get currentGlobalLanguage(): UtilsI18n__NS__CommonLocaleCode;
|
|
46
|
+
set currentGlobalLanguage(v: UtilsI18n__NS__CommonLocaleCode);
|
|
47
|
+
private currentGlobalLanguageSrc;
|
|
48
|
+
readonly currentGlobalLanguage$: rxjs.Observable<"en-US" | "pl-PL" | "en-GB" | "de-DE" | "fr-FR" | "es-ES" | "zh-CN">;
|
|
49
|
+
availableLangs: UtilsI18n__NS__LangOption[];
|
|
50
|
+
private availableLangsSrc;
|
|
51
|
+
readonly availableLangs$: rxjs.Observable<UtilsI18n__NS__LangOption[]>;
|
|
52
|
+
_visibleLanguages: UtilsI18n__NS__CommonLocaleCode[];
|
|
53
|
+
get visibleLanguages(): UtilsI18n__NS__CommonLocaleCode[];
|
|
54
|
+
set visibleLanguages(v: UtilsI18n__NS__CommonLocaleCode[]);
|
|
55
|
+
private visibleLanguagesSrc;
|
|
56
|
+
readonly visibleLanguages$: rxjs.Observable<("en-US" | "pl-PL" | "en-GB" | "de-DE" | "fr-FR" | "es-ES" | "zh-CN")[]>;
|
|
147
57
|
/**
|
|
148
|
-
*
|
|
149
|
-
* These should be unique string identifiers for each language (e.g., ['en', 'fr', 'es']).
|
|
58
|
+
* TODO
|
|
150
59
|
*/
|
|
151
|
-
|
|
60
|
+
private loadingLangsSubjectSrc;
|
|
152
61
|
/**
|
|
153
|
-
*
|
|
154
|
-
* Please use helper function {@link treeShakedTranslations()}
|
|
155
|
-
* @example
|
|
156
|
-
* ```typescript
|
|
157
|
-
* import type translations from './i18n/translations';
|
|
158
|
-
* ...
|
|
159
|
-
* translations: treeShakedTranslations<typeof translations>(),
|
|
160
|
-
* ```
|
|
62
|
+
* TODO
|
|
161
63
|
*/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
* @param lang The language identifier for which to load translations (e.g., 'en', 'fr').
|
|
170
|
-
* @returns A Promise that resolves to a `TranslationFile` object, which is
|
|
171
|
-
* a record of string keys to unknown values representing the translations for
|
|
172
|
-
* the given scope and language.
|
|
173
|
-
*/
|
|
174
|
-
loader: (scope: StringKeys<Translations>, lang: Languages) => Promise<TranslationFile>;
|
|
175
|
-
/**
|
|
176
|
-
* An optional function that defines how a loading message should be displayed
|
|
177
|
-
* while translations are being loaded.
|
|
178
|
-
*
|
|
179
|
-
* @param key The translation key that is currently being loaded.
|
|
180
|
-
* @returns A string representing the loading message.
|
|
181
|
-
*/
|
|
182
|
-
loadingFn?: (key: string) => string;
|
|
183
|
-
/**
|
|
184
|
-
* An optional function that defines how params should be processed
|
|
185
|
-
* Defaults to {@link simpleParamsHandler}
|
|
186
|
-
* Use {@link noParamsHandler} if you don't want to use params
|
|
187
|
-
* If you want to handle message format then you can install TODO
|
|
188
|
-
*/
|
|
189
|
-
paramHandler?: ParamHandler;
|
|
190
|
-
/**
|
|
191
|
-
* An optional error handler function that will be called when a `TransignalError` occurs.
|
|
192
|
-
* This allows you to implement custom error reporting or logging.
|
|
193
|
-
*
|
|
194
|
-
* @param errorCode Code of an error {@link TransignalError} code that occurred.
|
|
195
|
-
* @param args Any additional arguments relevant to the error.
|
|
196
|
-
*/
|
|
197
|
-
errorHandler?: (errorCode: TransignalError, ...args: unknown[]) => void;
|
|
198
|
-
/**
|
|
199
|
-
* Defines max depth of prefix functions in {@link TranslateObj}
|
|
200
|
-
* Defaults to 3, this means that if prefix function is used more than 3 time on the same t then it will fail
|
|
201
|
-
* Required for performance reasons
|
|
202
|
-
*/
|
|
203
|
-
maxPrefixDepth?: number;
|
|
204
|
-
};
|
|
64
|
+
readonly isLoadingLangs$: rxjs.Observable<boolean>;
|
|
65
|
+
private static _instance;
|
|
66
|
+
static get Instance(): TranslationManager;
|
|
67
|
+
readonly pernamentLanguage: UtilsI18n__NS__CommonLocaleCode | null;
|
|
68
|
+
setOneLanguagePernament(lang: UtilsI18n__NS__CommonLocaleCode): void;
|
|
69
|
+
changeGlobalLang(lang: UtilsI18n__NS__CommonLocaleCode): Promise<void>;
|
|
70
|
+
}
|
|
205
71
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
t<Scope extends Scopes>(scope: Scope): TranslateObj<Translations[Scope]>;
|
|
228
|
-
private initT;
|
|
229
|
-
private preparePrefixFn;
|
|
230
|
-
private preparePluralFn;
|
|
231
|
-
private prepareSelectFn;
|
|
232
|
-
protected replaceParams<T>(translation: T, params?: TranslateParams): T;
|
|
233
|
-
private fetchLanguage;
|
|
234
|
-
private resolveObjectPath;
|
|
235
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<TransignalService<any, any, any>, never>;
|
|
236
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<TransignalService<any, any, any>>;
|
|
72
|
+
type TranslationLookup = Record<string, string>;
|
|
73
|
+
type TranslationParams = Record<string, unknown> | null;
|
|
74
|
+
type FileRelativeLocation = string;
|
|
75
|
+
type TaonTranslationsMapImport = Record<FileRelativeLocation, {
|
|
76
|
+
[lang in UtilsI18n__NS__CommonLocaleCode]?: () => Promise<UtilsI18n__NS__GettextFile>;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Searching all tags with each gettext probably not a good idea.. maybe some
|
|
80
|
+
* kind of object/map can be created/use
|
|
81
|
+
*/
|
|
82
|
+
type TaonTranslationsMap = Record<FileRelativeLocation, {
|
|
83
|
+
[lang in UtilsI18n__NS__CommonLocaleCode]?: UtilsI18n__NS__GettextFile;
|
|
84
|
+
}>;
|
|
85
|
+
interface TranslationBinding {
|
|
86
|
+
text: string;
|
|
87
|
+
params?: TranslationParams;
|
|
88
|
+
context?: string;
|
|
89
|
+
update(value: string): void;
|
|
90
|
+
}
|
|
91
|
+
interface Translatable {
|
|
92
|
+
t: Translation;
|
|
237
93
|
}
|
|
238
94
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
95
|
+
declare class Translation {
|
|
96
|
+
protected fileRelativePath: string;
|
|
97
|
+
protected localFileLang: UtilsI18n__NS__CommonLocaleCode;
|
|
98
|
+
protected langImportMap: TaonTranslationsMapImport;
|
|
99
|
+
debug: boolean;
|
|
100
|
+
static manager: TranslationManager;
|
|
101
|
+
static for(fileRelativePath: string, langImportMap: TaonTranslationsMapImport, opt?: {
|
|
102
|
+
debug?: boolean;
|
|
103
|
+
}): Translation;
|
|
104
|
+
cdr?: ChangeDetectorRef;
|
|
105
|
+
private lookup;
|
|
106
|
+
private readonly loadingSubjectSrc;
|
|
107
|
+
readonly isLoadingLang$: Observable<boolean>;
|
|
108
|
+
private loading?;
|
|
109
|
+
private loadedLang?;
|
|
110
|
+
private readonly bindings;
|
|
111
|
+
private useGlobalLangFile;
|
|
112
|
+
private constructor();
|
|
113
|
+
for(_classThis: object): Translation;
|
|
114
|
+
changeFileLang(lang: UtilsI18n__NS__CommonLocaleCode): Promise<void>;
|
|
115
|
+
useGlobalFileLang(lang: UtilsI18n__NS__CommonLocaleCode): Promise<void>;
|
|
116
|
+
gettext: (text: string, params?: TranslationParams, context?: string) => string;
|
|
117
|
+
private createSignal;
|
|
118
|
+
readonly signal: {
|
|
119
|
+
gettext: (text: string, params?: TranslationParams, context?: string) => WritableSignal<string>;
|
|
262
120
|
};
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
121
|
+
private createObservable;
|
|
122
|
+
readonly $: {
|
|
123
|
+
gettext: (text: string, params?: TranslationParams, context?: string) => Observable<string>;
|
|
124
|
+
};
|
|
125
|
+
private refreshBindings;
|
|
126
|
+
translate(text: string, params?: TranslationParams, context?: string): string;
|
|
127
|
+
private gettextWithoutEnsureLoaded;
|
|
128
|
+
private load;
|
|
129
|
+
private ensureLoaded;
|
|
130
|
+
private createLookup;
|
|
131
|
+
private key;
|
|
132
|
+
private interpolate;
|
|
133
|
+
}
|
|
275
134
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
135
|
+
declare class TranslateDirective implements OnInit, OnDestroy, OnChanges {
|
|
136
|
+
t: Translation;
|
|
137
|
+
params?: Record<string, unknown>;
|
|
138
|
+
translateContext?: string;
|
|
139
|
+
private initialized;
|
|
140
|
+
private readonly element;
|
|
141
|
+
private readonly destroyRef;
|
|
142
|
+
private originalText;
|
|
143
|
+
ngOnInit(): void;
|
|
144
|
+
ngOnChanges(): void;
|
|
145
|
+
ngOnDestroy(): void;
|
|
146
|
+
private render;
|
|
147
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TranslateDirective, never>;
|
|
148
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TranslateDirective, "[translate]", never, { "t": { "alias": "translate-t"; "required": false; }; "params": { "alias": "translate-params"; "required": false; }; "translateContext": { "alias": "translate-context"; "required": false; }; }, {}, never, never, true, never>;
|
|
149
|
+
}
|
|
290
150
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
151
|
+
declare class TranslatePipe implements PipeTransform, OnDestroy {
|
|
152
|
+
private readonly cdr;
|
|
153
|
+
private tranlsationManager;
|
|
154
|
+
private readonly sub;
|
|
155
|
+
constructor();
|
|
156
|
+
transform(text: string, t: Translation, params?: Record<string, unknown>, context?: string): string;
|
|
157
|
+
ngOnDestroy(): void;
|
|
158
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TranslatePipe, never>;
|
|
159
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<TranslatePipe, "translate", true>;
|
|
160
|
+
}
|
|
299
161
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
162
|
+
declare class TranslateService {
|
|
163
|
+
manager: TranslationManager;
|
|
164
|
+
/**
|
|
165
|
+
* TODO
|
|
166
|
+
*/
|
|
167
|
+
readonly isLoadingLangs$: rxjs.Observable<boolean>;
|
|
168
|
+
readonly availableLangs$: rxjs.Observable<UtilsI18n__NS__LangOption[]>;
|
|
169
|
+
readonly currentGlobalLanguage$: rxjs.Observable<"en-US" | "pl-PL" | "en-GB" | "de-DE" | "fr-FR" | "es-ES" | "zh-CN">;
|
|
170
|
+
setOneLanguagePernament(lang: UtilsI18n__NS__CommonLocaleCode): void;
|
|
171
|
+
changeGlobalLang(lang: UtilsI18n__NS__CommonLocaleCode): Promise<void>;
|
|
172
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TranslateService, never>;
|
|
173
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<TranslateService>;
|
|
174
|
+
}
|
|
305
175
|
|
|
306
|
-
|
|
307
|
-
* Preloads selected scopes in default language
|
|
308
|
-
* Use after language init by {@link withServerSideLanguage} or {@link withNavigatorLanguage}
|
|
309
|
-
* @param scopes Scopes which should be preloaded
|
|
310
|
-
*/
|
|
311
|
-
declare const withPreloadScopes: <Languages extends string, Translations extends Record<string, Record<string, unknown>>>(scopes: StringKeys<Translations>[]) => TransignalFeature<Languages, Translations>;
|
|
176
|
+
declare function UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml(html: string, fileName?: string): UtilsI18n__NS__GettextExtracted[];
|
|
312
177
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
* Works only in SSR environment
|
|
316
|
-
*/
|
|
317
|
-
declare const withServerSideLanguage: <Languages extends string, Translations extends Record<string, Record<string, unknown>>>() => TransignalFeature<Languages, Translations>;
|
|
178
|
+
declare function UtilsI18nHtml__NS__extractGettextTranslateFromHtml(html: string, fileName?: string): UtilsI18n__NS__GettextExtracted[];
|
|
179
|
+
declare function UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext(html: string): string;
|
|
318
180
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
* @example
|
|
325
|
-
* ```typescript
|
|
326
|
-
* // src/app/app.routes.ts
|
|
327
|
-
* export const routes = [
|
|
328
|
-
* { path: 'base', title: 'base', children: [
|
|
329
|
-
* { path: 'child', title: 'child' },
|
|
330
|
-
* ],
|
|
331
|
-
* { path: 'aux', outlet: 'popup', title: 'popupTitle' }
|
|
332
|
-
* ];
|
|
333
|
-
*
|
|
334
|
-
* // src/app/transignal.ts
|
|
335
|
-
* export const transignal = prepareTransignal(<config>, withTranslatedTitle('global'));
|
|
336
|
-
*
|
|
337
|
-
* // src/app/i18n/global/en.ts
|
|
338
|
-
* export default {
|
|
339
|
-
* title: {
|
|
340
|
-
* base: 'Base title',
|
|
341
|
-
* child: 'Child title'
|
|
342
|
-
* popupTitle: 'Popup title'
|
|
343
|
-
* }
|
|
344
|
-
* };
|
|
345
|
-
* ```
|
|
346
|
-
*
|
|
347
|
-
* @param scope scope under which there are title translations
|
|
348
|
-
* @param translationKey translation key under which there are translations, `title` by default
|
|
349
|
-
*/
|
|
350
|
-
declare const withTranslatedTitle: <Languages extends string, Translations extends Record<string, Record<string, unknown>>>(scope: StringKeys<Translations>, translationKey?: string) => TransignalFeature<Languages, Translations>;
|
|
181
|
+
declare function UtilsPoFile__NS__generatePoFiles(files: UtilsI18n__NS__GettextFile[], locales: UtilsI18n__NS__CommonLocaleCode[], destinationAbsFolderPath: string): void;
|
|
182
|
+
declare function UtilsPoFile__NS__generatePoFileContent(files: UtilsI18n__NS__GettextFile[], locale: UtilsI18n__NS__CommonLocaleCode): string;
|
|
183
|
+
declare function UtilsPoFile__NS__extractPoToJson(poFileContent: string): UtilsI18n__NS__GettextFile[];
|
|
184
|
+
declare function UtilsPoFile__NS__generateTranslationOverrideInterface(file: UtilsI18n__NS__GettextFile, interfaceName: string, locale: UtilsI18n__NS__CommonLocaleCode): string;
|
|
185
|
+
declare function UtilsPoFile__NS__mergeGettextFile(jsonContent1FromTsHtml: UtilsI18n__NS__GettextFile, json2ContentFromPoFileModifedByUser?: UtilsI18n__NS__GettextFile | null): UtilsI18n__NS__GettextFile;
|
|
351
186
|
|
|
352
|
-
export { APP_ID, BUILD_BASE_HREF, BUILD_FRAMEWORK_CLI_NAME, CURRENT_PACKAGE_TAON_VERSION, CURRENT_PACKAGE_VERSION,
|
|
353
|
-
export type {
|
|
187
|
+
export { APP_ID, BUILD_BASE_HREF, BUILD_FRAMEWORK_CLI_NAME, CURRENT_PACKAGE_TAON_VERSION, CURRENT_PACKAGE_VERSION, PROJECT_NPM_NAME, TranslateDirective, TranslatePipe, TranslateService, Translation, TranslationManager, UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml, UtilsI18nHtml__NS__extractGettextTranslateFromHtml, UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext, UtilsPoFile__NS__extractPoToJson, UtilsPoFile__NS__generatePoFileContent, UtilsPoFile__NS__generatePoFiles, UtilsPoFile__NS__generateTranslationOverrideInterface, UtilsPoFile__NS__mergeGettextFile, startCli };
|
|
188
|
+
export type { TaonTranslationsMap, TaonTranslationsMapImport, Translatable, TranslationBinding, TranslationLookup, TranslationParams };
|
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
-
"namespacesMapObj": {
|
|
3
|
-
|
|
2
|
+
"namespacesMapObj": {
|
|
3
|
+
"UtilsI18nExtractGettextTranslateFromHtml.extractGettextTranslateFromHtml": "UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml",
|
|
4
|
+
"UtilsI18nHtml.extractGettextTranslateFromHtml": "UtilsI18nHtml__NS__extractGettextTranslateFromHtml",
|
|
5
|
+
"UtilsI18nHtml.replaceTranslatePipieDirectiveTContext": "UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext",
|
|
6
|
+
"UtilsPoFile.generatePoFiles": "UtilsPoFile__NS__generatePoFiles",
|
|
7
|
+
"UtilsPoFile.generatePoFileContent": "UtilsPoFile__NS__generatePoFileContent",
|
|
8
|
+
"UtilsPoFile.extractPoToJson": "UtilsPoFile__NS__extractPoToJson",
|
|
9
|
+
"UtilsPoFile.generateTranslationOverrideInterface": "UtilsPoFile__NS__generateTranslationOverrideInterface",
|
|
10
|
+
"UtilsPoFile.mergeGettextFile": "UtilsPoFile__NS__mergeGettextFile"
|
|
11
|
+
},
|
|
12
|
+
"namespacesReplace": {
|
|
13
|
+
"UtilsI18nExtractGettextTranslateFromHtml": [
|
|
14
|
+
"UtilsI18nExtractGettextTranslateFromHtml__NS__extractGettextTranslateFromHtml"
|
|
15
|
+
],
|
|
16
|
+
"UtilsI18nHtml": [
|
|
17
|
+
"UtilsI18nHtml__NS__extractGettextTranslateFromHtml",
|
|
18
|
+
"UtilsI18nHtml__NS__replaceTranslatePipieDirectiveTContext"
|
|
19
|
+
],
|
|
20
|
+
"UtilsPoFile": [
|
|
21
|
+
"UtilsPoFile__NS__extractPoToJson",
|
|
22
|
+
"UtilsPoFile__NS__generatePoFileContent",
|
|
23
|
+
"UtilsPoFile__NS__generatePoFiles",
|
|
24
|
+
"UtilsPoFile__NS__generateTranslationOverrideInterface",
|
|
25
|
+
"UtilsPoFile__NS__mergeGettextFile"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
4
28
|
}
|