@taon-dev/i18n 0.0.1 → 0.0.6
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 +2 -2
- 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/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/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/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
package/lib-prod/types.d.ts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { ParamHandler } from './transignal-param-handlers';
|
|
2
|
-
import { ArrayPaths, GetNestedType, ObjectPaths, PluralPaths, SelectPaths, StringKeys, StringPaths } from './utility-types';
|
|
3
|
-
export type TransignalError =
|
|
4
|
-
/** Error when key is not found in translations */
|
|
5
|
-
'missing_key'
|
|
6
|
-
/** Error when translation file for scope and lang has not been found */
|
|
7
|
-
| 'missing_file'
|
|
8
|
-
/** Error plural for a value is not defined for a language */
|
|
9
|
-
| 'missing_plural'
|
|
10
|
-
/** Error when plural used on a non-plural translation */
|
|
11
|
-
| 'invalid_plural'
|
|
12
|
-
/** Error select for a value is not defined for a language */
|
|
13
|
-
| 'missing_select'
|
|
14
|
-
/** Error when select used on a non-select translation */
|
|
15
|
-
| 'invalid_select'
|
|
16
|
-
/** Error when prefix chain is called more then {@link TransignalConfig.maxPrefixDepth} */
|
|
17
|
-
| 'prefix_too_deep';
|
|
18
|
-
export type TranslateParams = Record<string, unknown>;
|
|
19
|
-
export type Marked<K, T> = K & {
|
|
20
|
-
__marker: T;
|
|
21
|
-
};
|
|
22
|
-
export type BasePluralTranslation = Partial<Record<number | 'one' | 'few' | 'many' | 'other', string>>;
|
|
23
|
-
export type PluralTranslation = Marked<BasePluralTranslation, 'plural'>;
|
|
24
|
-
export type BaseSelectTranslation = Partial<Record<string | number | 'null', string>>;
|
|
25
|
-
export type MarkedAsSelect<T extends BaseSelectTranslation> = Marked<T, 'select'>;
|
|
26
|
-
export type SelectTranslation = MarkedAsSelect<BaseSelectTranslation>;
|
|
27
|
-
export type TranslateFn<Keys extends string, Result> = (key: Keys, params?: TranslateParams) => Result;
|
|
28
|
-
export type TranslateObj<Context extends Record<string, any>> = TranslateFn<StringPaths<Context>, string> & {
|
|
29
|
-
/**
|
|
30
|
-
* Returns translating function that returns an array of translations
|
|
31
|
-
* @param key path of translation
|
|
32
|
-
* @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
|
|
33
|
-
*/
|
|
34
|
-
arr: <ArrKey extends ArrayPaths<Context>>(key: ArrKey, params?: TranslateParams) => GetNestedType<Context, ArrKey>;
|
|
35
|
-
/**
|
|
36
|
-
* Returns translating function that returns an object of translations
|
|
37
|
-
* @param key path of translation
|
|
38
|
-
* @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
|
|
39
|
-
*/
|
|
40
|
-
obj: <ObjKey extends ObjectPaths<Context>>(key: ObjKey, params?: TranslateParams) => GetNestedType<Context, ObjKey>;
|
|
41
|
-
/**
|
|
42
|
-
* Returns translating function that returns a string translation depending on a correct plural form
|
|
43
|
-
* @param key path of translation
|
|
44
|
-
* @param count count to determine correct plural form
|
|
45
|
-
* @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
|
|
46
|
-
*/
|
|
47
|
-
plural: <ObjKey extends PluralPaths<Context>>(key: ObjKey, count: number, params?: TranslateParams) => string;
|
|
48
|
-
/**
|
|
49
|
-
* Returns translating function that returns a string translation depending on a selected value
|
|
50
|
-
* @param key path of translation
|
|
51
|
-
* @param value value to determine selected translation
|
|
52
|
-
* @param params parameters of translation in syntax defined by {@link TransignalConfig.paramHandler}
|
|
53
|
-
*/
|
|
54
|
-
select: <ObjKey extends SelectPaths<Context>>(key: ObjKey, value: keyof SelectTranslation | null, params?: TranslateParams) => string;
|
|
55
|
-
/**
|
|
56
|
-
* Returns translating function that is encapsulated in a selected prefix
|
|
57
|
-
* @param prefix path of new root translation
|
|
58
|
-
*/
|
|
59
|
-
prefix: <T extends ObjectPaths<Context>>(prefix: T) => TranslateObj<GetNestedType<Context, T>>;
|
|
60
|
-
};
|
|
61
|
-
export type TranslationFile = Record<string, unknown>;
|
|
62
|
-
export type TransignalConfig<Languages extends string, Translations extends Record<string, Record<string, unknown>>> = {
|
|
63
|
-
/**
|
|
64
|
-
* Default language code
|
|
65
|
-
*/
|
|
66
|
-
defaultLang: NoInfer<Languages>;
|
|
67
|
-
/**
|
|
68
|
-
* An array of available languages that your application supports.
|
|
69
|
-
* These should be unique string identifiers for each language (e.g., ['en', 'fr', 'es']).
|
|
70
|
-
*/
|
|
71
|
-
availableLangs: Languages[];
|
|
72
|
-
/**
|
|
73
|
-
* Defines the type of translations.
|
|
74
|
-
* Please use helper function {@link treeShakedTranslations()}
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* import type translations from './i18n/translations';
|
|
78
|
-
* ...
|
|
79
|
-
* translations: treeShakedTranslations<typeof translations>(),
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
translations: Translations;
|
|
83
|
-
/**
|
|
84
|
-
* A function responsible for dynamically loading translation files.
|
|
85
|
-
* This function is called when a specific translation scope and language is requested
|
|
86
|
-
* It runs in TransignalService injection context so {@link inject()} can be used to e.g. use HttpClient
|
|
87
|
-
*
|
|
88
|
-
* @param scope The string key representing the translation scope (e.g., 'common', 'auth').
|
|
89
|
-
* @param lang The language identifier for which to load translations (e.g., 'en', 'fr').
|
|
90
|
-
* @returns A Promise that resolves to a `TranslationFile` object, which is
|
|
91
|
-
* a record of string keys to unknown values representing the translations for
|
|
92
|
-
* the given scope and language.
|
|
93
|
-
*/
|
|
94
|
-
loader: (scope: StringKeys<Translations>, lang: Languages) => Promise<TranslationFile>;
|
|
95
|
-
/**
|
|
96
|
-
* An optional function that defines how a loading message should be displayed
|
|
97
|
-
* while translations are being loaded.
|
|
98
|
-
*
|
|
99
|
-
* @param key The translation key that is currently being loaded.
|
|
100
|
-
* @returns A string representing the loading message.
|
|
101
|
-
*/
|
|
102
|
-
loadingFn?: (key: string) => string;
|
|
103
|
-
/**
|
|
104
|
-
* An optional function that defines how params should be processed
|
|
105
|
-
* Defaults to {@link simpleParamsHandler}
|
|
106
|
-
* Use {@link noParamsHandler} if you don't want to use params
|
|
107
|
-
* If you want to handle message format then you can install TODO
|
|
108
|
-
*/
|
|
109
|
-
paramHandler?: ParamHandler;
|
|
110
|
-
/**
|
|
111
|
-
* An optional error handler function that will be called when a `TransignalError` occurs.
|
|
112
|
-
* This allows you to implement custom error reporting or logging.
|
|
113
|
-
*
|
|
114
|
-
* @param errorCode Code of an error {@link TransignalError} code that occurred.
|
|
115
|
-
* @param args Any additional arguments relevant to the error.
|
|
116
|
-
*/
|
|
117
|
-
errorHandler?: (errorCode: TransignalError, ...args: unknown[]) => void;
|
|
118
|
-
/**
|
|
119
|
-
* Defines max depth of prefix functions in {@link TranslateObj}
|
|
120
|
-
* Defaults to 3, this means that if prefix function is used more than 3 time on the same t then it will fail
|
|
121
|
-
* Required for performance reasons
|
|
122
|
-
*/
|
|
123
|
-
maxPrefixDepth?: number;
|
|
124
|
-
};
|
package/lib-prod/types.js
DELETED
package/lib-prod/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":[""],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Signal } from '@angular/core';
|
|
2
|
-
import { PluralTranslation, SelectTranslation } from './types';
|
|
3
|
-
export type GetNestedType<T, P extends string> = P extends `${infer Key}.${infer Rest}` ? Key extends keyof T ? GetNestedType<T[Key], Rest> : never : P extends keyof T ? NonNullable<T[P]> : never;
|
|
4
|
-
type DotPrefix<T extends string> = T extends '' ? '' : `.${T}`;
|
|
5
|
-
export type Paths<T> = T extends object ? T extends Array<infer U> ? `${number}${'' | DotPrefix<Paths<U>>}` : {
|
|
6
|
-
[K in keyof T]-?: K extends string | number ? `${K}${'' | DotPrefix<Paths<T[K]>>}` : never;
|
|
7
|
-
}[keyof T] : '';
|
|
8
|
-
export type ArrayPaths<T> = {
|
|
9
|
-
[P in Paths<T>]: GetNestedType<T, P> extends Array<unknown> ? P : never;
|
|
10
|
-
}[Paths<T>];
|
|
11
|
-
export type ObjectPaths<T> = {
|
|
12
|
-
[P in Paths<T>]: GetNestedType<T, P> extends Record<any, unknown> ? P : never;
|
|
13
|
-
}[Paths<T>];
|
|
14
|
-
export type PluralPaths<T> = {
|
|
15
|
-
[P in Paths<T>]: GetNestedType<T, P> extends PluralTranslation ? P : never;
|
|
16
|
-
}[Paths<T>];
|
|
17
|
-
export type SelectPaths<T> = {
|
|
18
|
-
[P in Paths<T>]: GetNestedType<T, P> extends SelectTranslation ? P : never;
|
|
19
|
-
}[Paths<T>];
|
|
20
|
-
export type StringPaths<T> = {
|
|
21
|
-
[P in Paths<T>]: GetNestedType<T, P> extends string ? P : never;
|
|
22
|
-
}[Paths<T>];
|
|
23
|
-
export type StringKeys<T> = Extract<keyof T, string>;
|
|
24
|
-
export type ResourceRefLike<T> = {
|
|
25
|
-
value: Signal<T | undefined>;
|
|
26
|
-
isLoading: Signal<boolean>;
|
|
27
|
-
error: Signal<Error | undefined>;
|
|
28
|
-
};
|
|
29
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utility-types.js","sourceRoot":"","sources":[""],"names":[],"mappings":""}
|
package/lib-prod/utils.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BasePluralTranslation, BaseSelectTranslation, MarkedAsSelect, PluralTranslation } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Utility to create a plural translation that can differ between languages and includes variants of translations for different plurals
|
|
4
|
-
* Can be used with {@link TranslateObj.plural}
|
|
5
|
-
* Translations may use automatic param: `{count}`
|
|
6
|
-
* @param translation plural translation object
|
|
7
|
-
*/
|
|
8
|
-
export declare const plural: (translation: BasePluralTranslation) => PluralTranslation;
|
|
9
|
-
/**
|
|
10
|
-
* Utility to create a select translation
|
|
11
|
-
* Can be used with {@link TranslateObj.select}
|
|
12
|
-
* Translations may use automatic param: `{value}`
|
|
13
|
-
* @param translation select translation object
|
|
14
|
-
*/
|
|
15
|
-
export declare const select: <T extends BaseSelectTranslation>(translation: T) => MarkedAsSelect<T>;
|
package/lib-prod/utils.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility to create a plural translation that can differ between languages and includes variants of translations for different plurals
|
|
3
|
-
* Can be used with {@link TranslateObj.plural}
|
|
4
|
-
* Translations may use automatic param: `{count}`
|
|
5
|
-
* @param translation plural translation object
|
|
6
|
-
*/
|
|
7
|
-
export const plural = (translation) => translation;
|
|
8
|
-
/**
|
|
9
|
-
* Utility to create a select translation
|
|
10
|
-
* Can be used with {@link TranslateObj.select}
|
|
11
|
-
* Translations may use automatic param: `{value}`
|
|
12
|
-
* @param translation select translation object
|
|
13
|
-
*/
|
|
14
|
-
export const select = (translation) => translation;
|
|
15
|
-
//# sourceMappingURL=utils.js.map
|
package/lib-prod/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,WAAkC,EAAqB,EAAE,CAC9E,WAAgC,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAkC,WAAc,EAAE,EAAE,CACxE,WAAgC,CAAC"}
|