@taon-dev/i18n 21.0.48 → 21.0.49
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/browser/fesm2022/i18n-browser.mjs +1 -1
- package/browser/fesm2022/i18n-browser.mjs.map +1 -1
- package/browser/package.json +1 -1
- package/browser/types/i18n-browser.d.ts +1 -1
- package/browser-prod/fesm2022/i18n-browser-prod.mjs +1 -1
- 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 +1 -1
- package/full-dts/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +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-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/package.json +1 -1
- package/package.json +1 -1
- package/ts-source/browser-code/build-info._auto-generated_.ts +13 -0
- package/ts-source/browser-code/i18n/lib.translation.ts +12 -0
- package/ts-source/browser-code/i18n/translation.ts.en-US.i18n.data.ts +33 -0
- package/ts-source/browser-code/i18n/translation.ts.en-US.po +17 -0
- package/ts-source/browser-code/i18n/translation.ts.pl-PL.i18n.data.ts +33 -0
- package/ts-source/browser-code/i18n/translation.ts.pl-PL.po +17 -0
- package/ts-source/browser-code/index._auto-generated_.ts +20 -0
- package/ts-source/browser-code/index.scss +7 -0
- package/ts-source/browser-code/index.ts +10 -0
- package/ts-source/browser-code/lib-info.md +8 -0
- package/ts-source/browser-code/local-translation.ts +126 -0
- package/ts-source/browser-code/migrations/migrations-info.md +6 -0
- package/ts-source/browser-code/start-cli.ts +12 -0
- package/ts-source/browser-code/translate.directive.ts +59 -0
- package/ts-source/browser-code/translate.pipe.ts +32 -0
- package/ts-source/browser-code/translate.service.ts +20 -0
- package/ts-source/browser-code/translation-manager.ts +101 -0
- package/ts-source/browser-code/translation.models.ts +27 -0
- package/ts-source/browser-code/translation.ts +179 -0
- package/ts-source/browser-code/utils-i18n-extract-gettext-translate-from-html.ts +87 -0
- package/ts-source/browser-code/utils-i18n-html.ts +79 -0
- package/ts-source/browser-code/utils-po-file.ts +70 -0
- package/ts-source/browser-code-prod/build-info._auto-generated_.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/build-info._auto-generated_.ts +13 -0
- package/ts-source/browser-code-prod/i18n/lib.translation.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/i18n/lib.translation.ts +12 -0
- package/ts-source/browser-code-prod/i18n/translation.ts.en-US.i18n.data.ts +33 -0
- package/ts-source/browser-code-prod/i18n/translation.ts.en-US.po +17 -0
- package/ts-source/browser-code-prod/i18n/translation.ts.pl-PL.i18n.data.ts +33 -0
- package/ts-source/browser-code-prod/i18n/translation.ts.pl-PL.po +17 -0
- package/ts-source/browser-code-prod/index._auto-generated_.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/index._auto-generated_.ts +20 -0
- package/ts-source/browser-code-prod/index.scss +7 -0
- package/ts-source/browser-code-prod/index.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/index.ts +10 -0
- package/ts-source/browser-code-prod/lib-info.md +8 -0
- package/ts-source/browser-code-prod/local-translation.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/local-translation.ts +126 -0
- package/ts-source/browser-code-prod/migrations/migrations-info.md +6 -0
- package/ts-source/browser-code-prod/start-cli.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/start-cli.ts +12 -0
- package/ts-source/browser-code-prod/translate.directive.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/translate.directive.ts +59 -0
- package/ts-source/browser-code-prod/translate.pipe.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/translate.pipe.ts +32 -0
- package/ts-source/browser-code-prod/translate.service.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/translate.service.ts +20 -0
- package/ts-source/browser-code-prod/translation-manager.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/translation-manager.ts +101 -0
- package/ts-source/browser-code-prod/translation.models.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/translation.models.ts +27 -0
- package/ts-source/browser-code-prod/translation.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/translation.ts +179 -0
- package/ts-source/browser-code-prod/utils-i18n-extract-gettext-translate-from-html.split-namespaces.json +10 -0
- package/ts-source/browser-code-prod/utils-i18n-extract-gettext-translate-from-html.ts +85 -0
- package/ts-source/browser-code-prod/utils-i18n-html.split-namespaces.json +16 -0
- package/ts-source/browser-code-prod/utils-i18n-html.ts +77 -0
- package/ts-source/browser-code-prod/utils-po-file.split-namespaces.json +18 -0
- package/ts-source/browser-code-prod/utils-po-file.ts +68 -0
- package/ts-source/websql-code/build-info._auto-generated_.ts +13 -0
- package/ts-source/websql-code/i18n/lib.translation.ts +12 -0
- package/ts-source/websql-code/i18n/translation.ts.en-US.i18n.data.ts +33 -0
- package/ts-source/websql-code/i18n/translation.ts.en-US.po +17 -0
- package/ts-source/websql-code/i18n/translation.ts.pl-PL.i18n.data.ts +33 -0
- package/ts-source/websql-code/i18n/translation.ts.pl-PL.po +17 -0
- package/ts-source/websql-code/index._auto-generated_.ts +20 -0
- package/ts-source/websql-code/index.scss +7 -0
- package/ts-source/websql-code/index.ts +10 -0
- package/ts-source/websql-code/lib-info.md +8 -0
- package/ts-source/websql-code/local-translation.ts +126 -0
- package/ts-source/websql-code/migrations/migrations-info.md +6 -0
- package/ts-source/websql-code/start-cli.ts +12 -0
- package/ts-source/websql-code/translate.directive.ts +59 -0
- package/ts-source/websql-code/translate.pipe.ts +32 -0
- package/ts-source/websql-code/translate.service.ts +20 -0
- package/ts-source/websql-code/translation-manager.ts +101 -0
- package/ts-source/websql-code/translation.models.ts +27 -0
- package/ts-source/websql-code/translation.ts +179 -0
- package/ts-source/websql-code/utils-i18n-extract-gettext-translate-from-html.ts +87 -0
- package/ts-source/websql-code/utils-i18n-html.ts +79 -0
- package/ts-source/websql-code/utils-po-file.ts +70 -0
- package/ts-source/websql-code-prod/build-info._auto-generated_.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/build-info._auto-generated_.ts +13 -0
- package/ts-source/websql-code-prod/i18n/lib.translation.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/i18n/lib.translation.ts +12 -0
- package/ts-source/websql-code-prod/i18n/translation.ts.en-US.i18n.data.ts +33 -0
- package/ts-source/websql-code-prod/i18n/translation.ts.en-US.po +17 -0
- package/ts-source/websql-code-prod/i18n/translation.ts.pl-PL.i18n.data.ts +33 -0
- package/ts-source/websql-code-prod/i18n/translation.ts.pl-PL.po +17 -0
- package/ts-source/websql-code-prod/index._auto-generated_.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/index._auto-generated_.ts +20 -0
- package/ts-source/websql-code-prod/index.scss +7 -0
- package/ts-source/websql-code-prod/index.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/index.ts +10 -0
- package/ts-source/websql-code-prod/lib-info.md +8 -0
- package/ts-source/websql-code-prod/local-translation.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/local-translation.ts +126 -0
- package/ts-source/websql-code-prod/migrations/migrations-info.md +6 -0
- package/ts-source/websql-code-prod/start-cli.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/start-cli.ts +12 -0
- package/ts-source/websql-code-prod/translate.directive.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/translate.directive.ts +59 -0
- package/ts-source/websql-code-prod/translate.pipe.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/translate.pipe.ts +32 -0
- package/ts-source/websql-code-prod/translate.service.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/translate.service.ts +20 -0
- package/ts-source/websql-code-prod/translation-manager.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/translation-manager.ts +101 -0
- package/ts-source/websql-code-prod/translation.models.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/translation.models.ts +27 -0
- package/ts-source/websql-code-prod/translation.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/translation.ts +179 -0
- package/ts-source/websql-code-prod/utils-i18n-extract-gettext-translate-from-html.split-namespaces.json +10 -0
- package/ts-source/websql-code-prod/utils-i18n-extract-gettext-translate-from-html.ts +85 -0
- package/ts-source/websql-code-prod/utils-i18n-html.split-namespaces.json +16 -0
- package/ts-source/websql-code-prod/utils-i18n-html.ts +77 -0
- package/ts-source/websql-code-prod/utils-po-file.split-namespaces.json +18 -0
- package/ts-source/websql-code-prod/utils-po-file.ts +68 -0
- package/websql/fesm2022/i18n-websql.mjs +1 -1
- package/websql/fesm2022/i18n-websql.mjs.map +1 -1
- package/websql/package.json +1 -1
- package/websql/types/i18n-websql.d.ts +1 -1
- package/websql-prod/fesm2022/i18n-websql-prod.mjs +1 -1
- 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 +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Language: en-US\n"
|
|
4
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
5
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
6
|
+
|
|
7
|
+
#: src/lib/translation.ts:345
|
|
8
|
+
msgid "asdasd"
|
|
9
|
+
msgstr ""
|
|
10
|
+
|
|
11
|
+
#: src/lib/translation.ts:355
|
|
12
|
+
msgid "amazing better place"
|
|
13
|
+
msgstr ""
|
|
14
|
+
|
|
15
|
+
#: src/lib/translation.ts:369
|
|
16
|
+
msgid "hello"
|
|
17
|
+
msgstr ""
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* TAON READONLY SOURCE
|
|
4
|
+
* DO NOT MODIFY THIS FILE.
|
|
5
|
+
* Changes may be overwritten.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
export interface PlPlTraslationOverrideSrcLibTranslationTs {
|
|
9
|
+
"pl-PL": {
|
|
10
|
+
"": {
|
|
11
|
+
"amazing better place"?: string;
|
|
12
|
+
"asdasd"?: string;
|
|
13
|
+
"hello"?: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export default {
|
|
18
|
+
"fileRelativePath": "src/lib/translation.ts",
|
|
19
|
+
"tags": [
|
|
20
|
+
{
|
|
21
|
+
"gettextString": "asdasd",
|
|
22
|
+
"lineNumber": 345
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"gettextString": "amazing better place",
|
|
26
|
+
"lineNumber": 355
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"gettextString": "hello",
|
|
30
|
+
"lineNumber": 369
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
msgid ""
|
|
2
|
+
msgstr ""
|
|
3
|
+
"Language: pl-PL\n"
|
|
4
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
|
5
|
+
"Content-Transfer-Encoding: 8bit\n"
|
|
6
|
+
|
|
7
|
+
#: src/lib/translation.ts:345
|
|
8
|
+
msgid "asdasd"
|
|
9
|
+
msgstr ""
|
|
10
|
+
|
|
11
|
+
#: src/lib/translation.ts:355
|
|
12
|
+
msgid "amazing better place"
|
|
13
|
+
msgstr ""
|
|
14
|
+
|
|
15
|
+
#: src/lib/translation.ts:369
|
|
16
|
+
msgid "hello"
|
|
17
|
+
msgstr ""
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* TAON READONLY SOURCE
|
|
4
|
+
* DO NOT MODIFY THIS FILE.
|
|
5
|
+
* Changes may be overwritten.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
export * from './build-info._auto-generated_';
|
|
9
|
+
export * from './local-translation';
|
|
10
|
+
export * from './start-cli';
|
|
11
|
+
export * from './translate.directive';
|
|
12
|
+
export * from './translate.pipe';
|
|
13
|
+
export * from './translate.service';
|
|
14
|
+
export * from './translation-manager';
|
|
15
|
+
export * from './translation.models';
|
|
16
|
+
export * from './translation';
|
|
17
|
+
export * from './utils-i18n-extract-gettext-translate-from-html';
|
|
18
|
+
export * from './utils-i18n-html';
|
|
19
|
+
export * from './utils-po-file';
|
|
20
|
+
export * from './i18n/lib.translation';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* TAON READONLY SOURCE
|
|
4
|
+
* DO NOT MODIFY THIS FILE.
|
|
5
|
+
* Changes may be overwritten.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
export * from './index._auto-generated_';
|
|
9
|
+
export * from './start-cli';
|
|
10
|
+
export default {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* TAON READONLY SOURCE
|
|
4
|
+
* DO NOT MODIFY THIS FILE.
|
|
5
|
+
* Changes may be overwritten.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import { crossPlatformPath, dotTaonFolder, ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLeafObject, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith, Helpers__NS___fixCommand, Helpers__NS__ActionInstance, Helpers__NS__actionStarted, Helpers__NS__bigMaxBuffer, Helpers__NS__checkProcess, Helpers__NS__cleanExit, Helpers__NS__clearConsole, Helpers__NS__command, Helpers__NS__commandOutputAsString, Helpers__NS__commandOutputAsStringAsync, Helpers__NS__contain, Helpers__NS__createFolder, Helpers__NS__createSymLink, Helpers__NS__error, Helpers__NS__execute, Helpers__NS__exists, Helpers__NS__filesFrom, Helpers__NS__foldersFrom, Helpers__NS__getFilesFrom, Helpers__NS__getFoldersFrom, Helpers__NS__getIsBrowser, Helpers__NS__getIsElectron, Helpers__NS__getIsNode, Helpers__NS__getIsRunningInGitBash, Helpers__NS__getIsSupportedTaonTerminal, Helpers__NS__getIsVerboseMode, Helpers__NS__getIsVerboseModeOrTnp, Helpers__NS__getIsWebSQL, Helpers__NS__getIsWsl, Helpers__NS__getStdio, Helpers__NS__hideNodeWarnings, Helpers__NS__info, Helpers__NS__isBlob, Helpers__NS__isBuffer, Helpers__NS__isClass, Helpers__NS__isExistedSymlink, Helpers__NS__isFile, Helpers__NS__isFolder, Helpers__NS__isRunningInDocker, Helpers__NS__isRunningInLinuxGraphicsCapableEnvironment, Helpers__NS__isSymlinkFileExitedOrUnexisted, Helpers__NS__isSymlinkThatMatchesUrl, Helpers__NS__isUnexistedLink, Helpers__NS__killOnPort, Helpers__NS__killProcess, Helpers__NS__killProcessByPort, Helpers__NS__linksToFolderFrom, Helpers__NS__linksToFoldersFrom, Helpers__NS__log, Helpers__NS__logError, Helpers__NS__logInfo, Helpers__NS__logProc, Helpers__NS__logSuccess, Helpers__NS__logTaskDone, Helpers__NS__logTaskStarted, Helpers__NS__logWarn, Helpers__NS__mediaTypeFromSrc, Helpers__NS__mkdirp, Helpers__NS__modifyLineByLine, Helpers__NS__msgCacheClear, Helpers__NS__openFolderInFileExplorer, Helpers__NS__parse, Helpers__NS__pathContainLink, Helpers__NS__questionYesNo, Helpers__NS__readFile, Helpers__NS__readJson, Helpers__NS__readJson5, Helpers__NS__readJsonC, Helpers__NS__relative, Helpers__NS__remove, Helpers__NS__removeEmptyLineFromString, Helpers__NS__removeFileIfExists, Helpers__NS__removeFolderIfExists, Helpers__NS__removeIfExists, Helpers__NS__removeSlashAtBegin, Helpers__NS__removeSlashAtEnd, Helpers__NS__removeSymlinks, Helpers__NS__renderError, Helpers__NS__replaceLinesInFile, Helpers__NS__run, Helpers__NS__runAsyncIn, Helpers__NS__runSyncIn, Helpers__NS__runSyncOrAsync, Helpers__NS__sleep, Helpers__NS__stopApplication, Helpers__NS__stringify, Helpers__NS__success, Helpers__NS__taskDone, Helpers__NS__taskStarted, Helpers__NS__throwError, Helpers__NS__timeout, Helpers__NS__tryCatchError, Helpers__NS__tryReadFile, Helpers__NS__tryRemoveDir, Helpers__NS__values, Helpers__NS__wait, Helpers__NS__warn, Helpers__NS__writeFile, Helpers__NS__writeJson, Helpers__NS__writeJson5, Helpers__NS__writeJsonC, UtilsI18n__NS__CommonLocaleCode, UtilsI18n__NS__CommonLocaleCodeEnum, UtilsI18n__NS__commonLocales, UtilsI18n__NS__defaultLangLocale, UtilsI18n__NS__detectLocale, UtilsI18n__NS__GettextExtracted, UtilsI18n__NS__GettextFile, UtilsI18n__NS__LangOption, UtilsI18n__NS__LangOptionArr, UtilsOs__NS__commandExistsAsync, UtilsOs__NS__commandExistsSync, UtilsOs__NS__detectEditor, UtilsOs__NS__drawHorizontalLine, UtilsOs__NS__drawVerticalLine, UtilsOs__NS__Editor, UtilsOs__NS__EDITOR_PROCESSES, UtilsOs__NS__EditorArr, UtilsOs__NS__EditorProcess, UtilsOs__NS__getEditorKeybindingPath, UtilsOs__NS__getEditorSettingsJsonPath, UtilsOs__NS__getInotifyWatchCount, UtilsOs__NS__getRealHomeDir, UtilsOs__NS__isBrowser, UtilsOs__NS__isDockerAvailable, UtilsOs__NS__isElectron, UtilsOs__NS__isNode, UtilsOs__NS__isNodeVersionOk, UtilsOs__NS__isPortInUse, UtilsOs__NS__isRunningInBrowser, UtilsOs__NS__isRunningInCliMode, UtilsOs__NS__isRunningInCloudflareWorker, UtilsOs__NS__isRunningInDocker, UtilsOs__NS__isRunningInElectron, UtilsOs__NS__isRunningInLinuxDistro, UtilsOs__NS__isRunningInLinuxGraphicsCapableEnvironment, UtilsOs__NS__isRunningInMochaTest, UtilsOs__NS__isRunningInNode, UtilsOs__NS__isRunningInOsWithGraphicsCapableEnvironment, UtilsOs__NS__isRunningInSSRMode, UtilsOs__NS__isRunningInVscodeExtension, UtilsOs__NS__isRunningInWebSQL, UtilsOs__NS__isRunningInWindows, UtilsOs__NS__isRunningInWindowsCmd, UtilsOs__NS__isRunningInWindowsGitBash, UtilsOs__NS__isRunningInWindowsPowerShell, UtilsOs__NS__isRunningInWsl, UtilsOs__NS__isRunningNodeDebugger, UtilsOs__NS__isSSRMode, UtilsOs__NS__isVscodeExtension, UtilsOs__NS__isWebSQL, UtilsOs__NS__killAllEditor, UtilsOs__NS__openFolderInFileExplorer, UtilsOs__NS__pipxNestedPackageExists, UtilsOs__NS__pipxPackageExists, UtilsOs__NS__pythonModuleExists, UtilsOs__NS__safeExitProgramCleanUp, UtilsOs__NS__sendNotification, UtilsOs__NS__whichOrWherePackageLocated } from 'tnp-core/websql-prod';
|
|
9
|
+
export interface TranslationOptions {
|
|
10
|
+
text: string;
|
|
11
|
+
from: UtilsI18n__NS__CommonLocaleCode;
|
|
12
|
+
to: UtilsI18n__NS__CommonLocaleCode;
|
|
13
|
+
context?: string;
|
|
14
|
+
glossary?: Record<string, string>;
|
|
15
|
+
}
|
|
16
|
+
export interface AiDownloadProgress {
|
|
17
|
+
status: 'initiate' | 'download' | 'progress' | 'progress_total' | 'done' | 'ready' | string;
|
|
18
|
+
file?: string;
|
|
19
|
+
progress?: number;
|
|
20
|
+
loaded?: number;
|
|
21
|
+
total?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface MakeSureAiDownloadedOptions {
|
|
24
|
+
onProgress?: (progress: AiDownloadProgress) => void;
|
|
25
|
+
warmup?: boolean;
|
|
26
|
+
}
|
|
27
|
+
const MODEL_ID = 'Xenova/nllb-200-distilled-600M';
|
|
28
|
+
const nllbLanguageCodes: Partial<Record<UtilsI18n__NS__CommonLocaleCode, string>> = {
|
|
29
|
+
'en-US': 'eng_Latn',
|
|
30
|
+
'pl-PL': 'pol_Latn',
|
|
31
|
+
'de-DE': 'deu_Latn',
|
|
32
|
+
};
|
|
33
|
+
export class LocalTranslationService {
|
|
34
|
+
private translatorPromise?: Promise<any>;
|
|
35
|
+
private aiReady = false;
|
|
36
|
+
private warmupPromise?: Promise<void>;
|
|
37
|
+
private progressListeners = new Set<(progress: AiDownloadProgress) => void>();
|
|
38
|
+
async makeSureAiDownloaded(options: MakeSureAiDownloadedOptions = {}): Promise<void> {
|
|
39
|
+
return (void 0);
|
|
40
|
+
}
|
|
41
|
+
isAiReady(): boolean {
|
|
42
|
+
return this.aiReady;
|
|
43
|
+
}
|
|
44
|
+
private getTranslator(): Promise<any> {
|
|
45
|
+
this.translatorPromise ??= this.createTranslator().catch(error => {
|
|
46
|
+
this.translatorPromise = undefined;
|
|
47
|
+
this.aiReady = false;
|
|
48
|
+
throw error;
|
|
49
|
+
});
|
|
50
|
+
return this.translatorPromise;
|
|
51
|
+
}
|
|
52
|
+
private async createTranslator(): Promise<any> {
|
|
53
|
+
return (void 0);
|
|
54
|
+
return void 0 as any;
|
|
55
|
+
}
|
|
56
|
+
private emitProgress(progress: AiDownloadProgress): void {
|
|
57
|
+
for (const listener of this.progressListeners) {
|
|
58
|
+
try {
|
|
59
|
+
listener(progress);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
private warmupTranslator(translator: any): Promise<void> {
|
|
66
|
+
this.warmupPromise ??= translator('Hello.', {
|
|
67
|
+
src_lang: 'eng_Latn',
|
|
68
|
+
tgt_lang: 'pol_Latn',
|
|
69
|
+
max_new_tokens: 16,
|
|
70
|
+
})
|
|
71
|
+
.then(() => undefined)
|
|
72
|
+
.catch(error => {
|
|
73
|
+
this.warmupPromise = undefined;
|
|
74
|
+
throw error;
|
|
75
|
+
});
|
|
76
|
+
return this.warmupPromise;
|
|
77
|
+
}
|
|
78
|
+
async translate(options: TranslationOptions): Promise<string> {
|
|
79
|
+
return (void 0);
|
|
80
|
+
}
|
|
81
|
+
private protectGlossary(text: string, glossary?: Record<string, string>): {
|
|
82
|
+
preparedText: string;
|
|
83
|
+
restore: (translatedText: string) => string;
|
|
84
|
+
} {
|
|
85
|
+
if (!glossary || Object.keys(glossary).length === 0) {
|
|
86
|
+
return {
|
|
87
|
+
preparedText: text,
|
|
88
|
+
restore: translatedText => translatedText,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const replacements: Array<{
|
|
92
|
+
placeholder: string;
|
|
93
|
+
translatedValue: string;
|
|
94
|
+
}> = [];
|
|
95
|
+
let preparedText = text;
|
|
96
|
+
Object.entries(glossary)
|
|
97
|
+
.sort(([left], [right]) => right.length - left.length)
|
|
98
|
+
.forEach(([sourceValue, translatedValue], index) => {
|
|
99
|
+
const placeholder = `TAONTERM${index}PLACEHOLDER`;
|
|
100
|
+
preparedText = preparedText.replaceAll(sourceValue, placeholder);
|
|
101
|
+
replacements.push({
|
|
102
|
+
placeholder,
|
|
103
|
+
translatedValue,
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
preparedText,
|
|
108
|
+
restore(translatedText: string): string {
|
|
109
|
+
let result = translatedText;
|
|
110
|
+
for (const replacement of replacements) {
|
|
111
|
+
result = result.replaceAll(replacement.placeholder, replacement.translatedValue);
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
private getModelsCachePath(): string {
|
|
118
|
+
const cachePath = crossPlatformPath([
|
|
119
|
+
UtilsOs__NS__getRealHomeDir(),
|
|
120
|
+
dotTaonFolder,
|
|
121
|
+
'ai-models-cache',
|
|
122
|
+
]);
|
|
123
|
+
Helpers__NS__mkdirp(cachePath);
|
|
124
|
+
return cachePath;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* TAON READONLY SOURCE
|
|
4
|
+
* DO NOT MODIFY THIS FILE.
|
|
5
|
+
* Changes may be overwritten.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import { LocalTranslationService } from './local-translation';
|
|
9
|
+
export async function startCli(argsv: string[], filename: string): Promise<void> {
|
|
10
|
+
return (void 0);
|
|
11
|
+
}
|
|
12
|
+
export default startCli;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* TAON READONLY SOURCE
|
|
4
|
+
* DO NOT MODIFY THIS FILE.
|
|
5
|
+
* Changes may be overwritten.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import { AfterViewInit, DestroyRef, Directive, ElementRef, inject, Input, OnChanges, } from '@angular/core';
|
|
9
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
10
|
+
import { Translation } from './translation';
|
|
11
|
+
@Directive({
|
|
12
|
+
selector: '[translate]',
|
|
13
|
+
standalone: true,
|
|
14
|
+
})
|
|
15
|
+
export class TranslateDirective implements AfterViewInit, OnChanges {
|
|
16
|
+
private static readonly selector = '[translate]';
|
|
17
|
+
@Input('translate-t')
|
|
18
|
+
t!: Translation;
|
|
19
|
+
@Input('translate-params')
|
|
20
|
+
params?: Record<string, unknown>;
|
|
21
|
+
@Input('translate-context')
|
|
22
|
+
translateContext?: string;
|
|
23
|
+
private initialized = false;
|
|
24
|
+
private readonly element = inject(ElementRef<HTMLElement>);
|
|
25
|
+
private readonly destroyRef = inject(DestroyRef);
|
|
26
|
+
private originalText = '';
|
|
27
|
+
ngAfterViewInit(): void {
|
|
28
|
+
const nativeElement = this.element.nativeElement;
|
|
29
|
+
this.validateContent();
|
|
30
|
+
this.originalText = nativeElement.textContent?.trim() ?? '';
|
|
31
|
+
this.initialized = true;
|
|
32
|
+
this.render();
|
|
33
|
+
this.t.isLoadingLang$
|
|
34
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
35
|
+
.subscribe(() => {
|
|
36
|
+
this.render();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
ngOnChanges(): void {
|
|
40
|
+
if (!this.initialized) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.render();
|
|
44
|
+
}
|
|
45
|
+
private validateContent(): void {
|
|
46
|
+
const element = this.element.nativeElement;
|
|
47
|
+
if (element.children.length > 0) {
|
|
48
|
+
console.error(`[@taon-dev/i18n] ${TranslateDirective.selector} should only be used ` +
|
|
49
|
+
`with plain text. HTML/content elements detected inside:`, element);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
private render(): void {
|
|
53
|
+
if (!this.t) {
|
|
54
|
+
throw (`Directive ${TranslateDirective.selector} applied on component ` +
|
|
55
|
+
`without implemented Translatable interface`);
|
|
56
|
+
}
|
|
57
|
+
this.element.nativeElement.textContent = this.t.translate(this.originalText, this.params, this.translateContext);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* TAON READONLY SOURCE
|
|
4
|
+
* DO NOT MODIFY THIS FILE.
|
|
5
|
+
* Changes may be overwritten.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import { ChangeDetectorRef, inject, OnDestroy, Pipe, PipeTransform, } from '@angular/core';
|
|
9
|
+
import { Subscription } from 'rxjs';
|
|
10
|
+
import { Translation } from './translation';
|
|
11
|
+
import { TranslationManager } from './translation-manager';
|
|
12
|
+
@Pipe({
|
|
13
|
+
name: 'translate',
|
|
14
|
+
standalone: true,
|
|
15
|
+
pure: false,
|
|
16
|
+
})
|
|
17
|
+
export class TranslatePipe implements PipeTransform, OnDestroy {
|
|
18
|
+
private readonly cdr = inject(ChangeDetectorRef);
|
|
19
|
+
private tranlsationManager = TranslationManager.Instance;
|
|
20
|
+
private readonly sub: Subscription;
|
|
21
|
+
constructor() {
|
|
22
|
+
this.sub = this.tranlsationManager.isLoadingLangs$.subscribe(() => {
|
|
23
|
+
this.cdr.markForCheck();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
transform(text: string, t: Translation, params?: Record<string, unknown>, context?: string): string {
|
|
27
|
+
return t?.gettext(text, params, context) ?? text;
|
|
28
|
+
}
|
|
29
|
+
ngOnDestroy(): void {
|
|
30
|
+
this.sub.unsubscribe();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* TAON READONLY SOURCE
|
|
4
|
+
* DO NOT MODIFY THIS FILE.
|
|
5
|
+
* Changes may be overwritten.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import { Injectable } from '@angular/core';
|
|
9
|
+
import { UtilsI18n__NS__CommonLocaleCode, UtilsI18n__NS__CommonLocaleCodeEnum, UtilsI18n__NS__commonLocales, UtilsI18n__NS__defaultLangLocale, UtilsI18n__NS__detectLocale, UtilsI18n__NS__GettextExtracted, UtilsI18n__NS__GettextFile, UtilsI18n__NS__LangOption, UtilsI18n__NS__LangOptionArr } from 'tnp-core/websql-prod';
|
|
10
|
+
import { TranslationManager } from './translation-manager';
|
|
11
|
+
@Injectable({ providedIn: 'root' })
|
|
12
|
+
export class TranslateService {
|
|
13
|
+
public manager = TranslationManager.Instance;
|
|
14
|
+
public setOneLanguagePernament(lang: UtilsI18n__NS__CommonLocaleCode): void {
|
|
15
|
+
this.manager.setOneLanguagePernament(lang);
|
|
16
|
+
}
|
|
17
|
+
async changeGlobalLang(lang: UtilsI18n__NS__CommonLocaleCode): Promise<void> {
|
|
18
|
+
await this.manager.changeGlobalLang(lang);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* TAON READONLY SOURCE
|
|
4
|
+
* DO NOT MODIFY THIS FILE.
|
|
5
|
+
* Changes may be overwritten.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import { BehaviorSubject, filter, map, tap } from 'rxjs';
|
|
9
|
+
import { GlobalStorage, ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLeafObject, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith, UtilsI18n__NS__CommonLocaleCode, UtilsI18n__NS__CommonLocaleCodeEnum, UtilsI18n__NS__commonLocales, UtilsI18n__NS__defaultLangLocale, UtilsI18n__NS__detectLocale, UtilsI18n__NS__GettextExtracted, UtilsI18n__NS__GettextFile, UtilsI18n__NS__LangOption, UtilsI18n__NS__LangOptionArr } from 'tnp-core/websql-prod';
|
|
10
|
+
import type { Translation } from './translation';
|
|
11
|
+
const globalStorageKeyMainLanguage = 'taon-gettext-main-language';
|
|
12
|
+
const globalTaonLanguageLocalKeyLocalStor = 'taon-language-local';
|
|
13
|
+
const TranslationManagerGlobalStorKey = 'TranslationManagerGlobalStorKey';
|
|
14
|
+
export class TranslationManager {
|
|
15
|
+
static globalDefautlLanguageOverride: UtilsI18n__NS__CommonLocaleCode;
|
|
16
|
+
public get instances(): Set<Translation> {
|
|
17
|
+
let set = GlobalStorage.get(TranslationManagerGlobalStorKey) as Set<Translation>;
|
|
18
|
+
if (___NS__isNil(set)) {
|
|
19
|
+
GlobalStorage.set(TranslationManagerGlobalStorKey, new Set<Translation>());
|
|
20
|
+
}
|
|
21
|
+
set = GlobalStorage.get(TranslationManagerGlobalStorKey) as Set<Translation>;
|
|
22
|
+
return set;
|
|
23
|
+
}
|
|
24
|
+
constructor() {
|
|
25
|
+
}
|
|
26
|
+
private defaultLangLocale: UtilsI18n__NS__CommonLocaleCode = (() => {
|
|
27
|
+
return ((localStorage.getItem(globalTaonLanguageLocalKeyLocalStor) as UtilsI18n__NS__CommonLocaleCode) ||
|
|
28
|
+
TranslationManager.globalDefautlLanguageOverride ||
|
|
29
|
+
(UtilsI18n__NS__detectLocale() as UtilsI18n__NS__CommonLocaleCode));
|
|
30
|
+
return UtilsI18n__NS__defaultLangLocale;
|
|
31
|
+
})();
|
|
32
|
+
private _currentGlobalLanguage = this
|
|
33
|
+
.defaultLangLocale as UtilsI18n__NS__CommonLocaleCode;
|
|
34
|
+
public get currentGlobalLanguage(): UtilsI18n__NS__CommonLocaleCode {
|
|
35
|
+
return this._currentGlobalLanguage;
|
|
36
|
+
}
|
|
37
|
+
public set currentGlobalLanguage(v: UtilsI18n__NS__CommonLocaleCode) {
|
|
38
|
+
this._currentGlobalLanguage = v;
|
|
39
|
+
this.currentGlobalLanguageSrc.next(v);
|
|
40
|
+
}
|
|
41
|
+
private currentGlobalLanguageSrc = new BehaviorSubject(this.currentGlobalLanguage);
|
|
42
|
+
public readonly currentGlobalLanguage$ = this.currentGlobalLanguageSrc
|
|
43
|
+
.asObservable()
|
|
44
|
+
.pipe(tap(currentGlobalLanguage => {
|
|
45
|
+
GlobalStorage.set<UtilsI18n__NS__CommonLocaleCode>(globalStorageKeyMainLanguage, currentGlobalLanguage);
|
|
46
|
+
}));
|
|
47
|
+
public availableLangs = ___NS__cloneDeep(UtilsI18n__NS__LangOptionArr);
|
|
48
|
+
private availableLangsSrc = new BehaviorSubject(this.availableLangs);
|
|
49
|
+
public readonly availableLangs$ = this.availableLangsSrc.asObservable().pipe(map(f => {
|
|
50
|
+
if (this.visibleLanguages.length > 0) {
|
|
51
|
+
return f.filter(a => this.visibleLanguages.includes(a.code));
|
|
52
|
+
}
|
|
53
|
+
return f;
|
|
54
|
+
}));
|
|
55
|
+
public _visibleLanguages: UtilsI18n__NS__CommonLocaleCode[] = [];
|
|
56
|
+
public get visibleLanguages(): UtilsI18n__NS__CommonLocaleCode[] {
|
|
57
|
+
return this._visibleLanguages;
|
|
58
|
+
}
|
|
59
|
+
public set visibleLanguages(v: UtilsI18n__NS__CommonLocaleCode[]) {
|
|
60
|
+
if (this.pernamentLanguage) {
|
|
61
|
+
v = v.filter(a => [this.pernamentLanguage].includes(a));
|
|
62
|
+
}
|
|
63
|
+
this._visibleLanguages = v;
|
|
64
|
+
this.visibleLanguagesSrc.next(v);
|
|
65
|
+
this.availableLangsSrc.next(this.availableLangs);
|
|
66
|
+
}
|
|
67
|
+
private visibleLanguagesSrc = new BehaviorSubject(this.visibleLanguages);
|
|
68
|
+
public readonly visibleLanguages$ = this.visibleLanguagesSrc.asObservable();
|
|
69
|
+
private loadingLangsSubjectSrc = new BehaviorSubject(false);
|
|
70
|
+
public readonly isLoadingLangs$ = this.loadingLangsSubjectSrc.asObservable();
|
|
71
|
+
private static _instance: TranslationManager;
|
|
72
|
+
static get Instance(): TranslationManager {
|
|
73
|
+
if (!this._instance) {
|
|
74
|
+
this._instance = new TranslationManager();
|
|
75
|
+
}
|
|
76
|
+
return this._instance;
|
|
77
|
+
}
|
|
78
|
+
public readonly pernamentLanguage: UtilsI18n__NS__CommonLocaleCode | null = null;
|
|
79
|
+
public setOneLanguagePernament(lang: UtilsI18n__NS__CommonLocaleCode): void {
|
|
80
|
+
console.info(`Setting pernament language to ${lang}`);
|
|
81
|
+
if (this.pernamentLanguage) {
|
|
82
|
+
console.log('You are trying to set again pernament language');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.visibleLanguages = [lang];
|
|
86
|
+
this.pernamentLanguage = lang;
|
|
87
|
+
void this.changeGlobalLang(lang);
|
|
88
|
+
}
|
|
89
|
+
async changeGlobalLang(lang: UtilsI18n__NS__CommonLocaleCode): Promise<void> {
|
|
90
|
+
this.loadingLangsSubjectSrc.next(true);
|
|
91
|
+
this.currentGlobalLanguage = lang;
|
|
92
|
+
localStorage.setItem(globalTaonLanguageLocalKeyLocalStor, lang);
|
|
93
|
+
try {
|
|
94
|
+
await Promise.all([...this.instances].map(c => c.useGlobalFileLang()));
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error(error);
|
|
98
|
+
}
|
|
99
|
+
this.loadingLangsSubjectSrc.next(false);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* TAON READONLY SOURCE
|
|
4
|
+
* DO NOT MODIFY THIS FILE.
|
|
5
|
+
* Changes may be overwritten.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import { UtilsI18n__NS__CommonLocaleCode, UtilsI18n__NS__CommonLocaleCodeEnum, UtilsI18n__NS__commonLocales, UtilsI18n__NS__defaultLangLocale, UtilsI18n__NS__detectLocale, UtilsI18n__NS__GettextExtracted, UtilsI18n__NS__GettextFile, UtilsI18n__NS__LangOption, UtilsI18n__NS__LangOptionArr } from 'tnp-core/websql-prod';
|
|
9
|
+
import type { Translation } from './translation';
|
|
10
|
+
export type TranslationLookup = Record<string, string>;
|
|
11
|
+
export type TranslationParams = Record<string, unknown> | null;
|
|
12
|
+
type FileRelativeLocation = string;
|
|
13
|
+
export type TaonTranslationsMapImport = Record<FileRelativeLocation, {
|
|
14
|
+
[lang in UtilsI18n__NS__CommonLocaleCode]?: () => Promise<UtilsI18n__NS__GettextFile>;
|
|
15
|
+
}>;
|
|
16
|
+
export type TaonTranslationsMap = Record<FileRelativeLocation, {
|
|
17
|
+
[lang in UtilsI18n__NS__CommonLocaleCode]?: UtilsI18n__NS__GettextFile;
|
|
18
|
+
}>;
|
|
19
|
+
export interface TranslationBinding {
|
|
20
|
+
text: string;
|
|
21
|
+
params?: TranslationParams;
|
|
22
|
+
context?: string;
|
|
23
|
+
update(value: string): void;
|
|
24
|
+
}
|
|
25
|
+
export interface Translatable {
|
|
26
|
+
t: Translation;
|
|
27
|
+
}
|