@jsverse/transloco 7.0.0
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/CHANGELOG.md +1005 -0
- package/LICENSE +22 -0
- package/README.md +44 -0
- package/esm2022/index.mjs +20 -0
- package/esm2022/jsverse-transloco.mjs +5 -0
- package/esm2022/lib/browser-lang.mjs +28 -0
- package/esm2022/lib/get-fallbacks-loaders.mjs +13 -0
- package/esm2022/lib/helpers.mjs +104 -0
- package/esm2022/lib/lang-resolver.mjs +54 -0
- package/esm2022/lib/loader-component.component.mjs +21 -0
- package/esm2022/lib/resolve-loader.mjs +13 -0
- package/esm2022/lib/scope-resolver.mjs +24 -0
- package/esm2022/lib/shared.mjs +73 -0
- package/esm2022/lib/template-handler.mjs +28 -0
- package/esm2022/lib/transloco-fallback-strategy.mjs +26 -0
- package/esm2022/lib/transloco-lang.mjs +3 -0
- package/esm2022/lib/transloco-loading-template.mjs +3 -0
- package/esm2022/lib/transloco-missing-handler.mjs +18 -0
- package/esm2022/lib/transloco-scope.mjs +3 -0
- package/esm2022/lib/transloco-testing.module.mjs +76 -0
- package/esm2022/lib/transloco.config.mjs +37 -0
- package/esm2022/lib/transloco.directive.mjs +169 -0
- package/esm2022/lib/transloco.interceptor.mjs +17 -0
- package/esm2022/lib/transloco.loader.mjs +13 -0
- package/esm2022/lib/transloco.module.mjs +18 -0
- package/esm2022/lib/transloco.pipe.mjs +97 -0
- package/esm2022/lib/transloco.providers.mjs +92 -0
- package/esm2022/lib/transloco.service.mjs +579 -0
- package/esm2022/lib/transloco.transpiler.mjs +145 -0
- package/esm2022/lib/types.mjs +2 -0
- package/fesm2022/jsverse-transloco.mjs +1580 -0
- package/fesm2022/jsverse-transloco.mjs.map +1 -0
- package/index.d.ts +19 -0
- package/lib/browser-lang.d.ts +8 -0
- package/lib/get-fallbacks-loaders.d.ts +14 -0
- package/lib/helpers.d.ts +21 -0
- package/lib/lang-resolver.d.ts +32 -0
- package/lib/loader-component.component.d.ts +6 -0
- package/lib/resolve-loader.d.ts +10 -0
- package/lib/scope-resolver.d.ts +12 -0
- package/lib/shared.d.ts +17 -0
- package/lib/template-handler.d.ts +9 -0
- package/lib/transloco-fallback-strategy.d.ts +14 -0
- package/lib/transloco-lang.d.ts +2 -0
- package/lib/transloco-loading-template.d.ts +3 -0
- package/lib/transloco-missing-handler.d.ts +16 -0
- package/lib/transloco-scope.d.ts +3 -0
- package/lib/transloco-testing.module.d.ts +27 -0
- package/lib/transloco.config.d.ts +27 -0
- package/lib/transloco.directive.d.ts +50 -0
- package/lib/transloco.interceptor.d.ts +14 -0
- package/lib/transloco.loader.d.ts +15 -0
- package/lib/transloco.module.d.ts +8 -0
- package/lib/transloco.pipe.d.ts +23 -0
- package/lib/transloco.providers.d.ts +30 -0
- package/lib/transloco.service.d.ts +199 -0
- package/lib/transloco.transpiler.d.ts +58 -0
- package/lib/types.d.ts +45 -0
- package/package.json +54 -0
- package/schematics/src/assets/i18n/en.json +1 -0
- package/schematics/src/collection.json +59 -0
- package/schematics/src/component/index.d.ts +2 -0
- package/schematics/src/component/index.js +21 -0
- package/schematics/src/component/index.js.map +1 -0
- package/schematics/src/join/index.d.ts +3 -0
- package/schematics/src/join/index.js +79 -0
- package/schematics/src/join/index.js.map +1 -0
- package/schematics/src/join/schema.d.ts +28 -0
- package/schematics/src/join/schema.js +3 -0
- package/schematics/src/join/schema.js.map +1 -0
- package/schematics/src/join/schema.json +43 -0
- package/schematics/src/keys-manager/index.d.ts +5 -0
- package/schematics/src/keys-manager/index.js +97 -0
- package/schematics/src/keys-manager/index.js.map +1 -0
- package/schematics/src/keys-manager/schema.d.ts +19 -0
- package/schematics/src/keys-manager/schema.js +3 -0
- package/schematics/src/keys-manager/schema.js.map +1 -0
- package/schematics/src/keys-manager/schema.json +33 -0
- package/schematics/src/migrate/index.d.ts +3 -0
- package/schematics/src/migrate/index.js +21 -0
- package/schematics/src/migrate/index.js.map +1 -0
- package/schematics/src/migrate/ngx-translate-migration.d.ts +3 -0
- package/schematics/src/migrate/ngx-translate-migration.js +169 -0
- package/schematics/src/migrate/ngx-translate-migration.js.map +1 -0
- package/schematics/src/migrate/schema.d.ts +10 -0
- package/schematics/src/migrate/schema.js +3 -0
- package/schematics/src/migrate/schema.js.map +1 -0
- package/schematics/src/migrate/schema.json +23 -0
- package/schematics/src/ng-add/files/transloco-loader/transloco-loader.__ts__ +12 -0
- package/schematics/src/ng-add/files/transloco-module/transloco-root.module.__ts__ +24 -0
- package/schematics/src/ng-add/generators/http-loader.gen.d.ts +4 -0
- package/schematics/src/ng-add/generators/http-loader.gen.js +15 -0
- package/schematics/src/ng-add/generators/http-loader.gen.js.map +1 -0
- package/schematics/src/ng-add/generators/root-module.gen.d.ts +9 -0
- package/schematics/src/ng-add/generators/root-module.gen.js +31 -0
- package/schematics/src/ng-add/generators/root-module.gen.js.map +1 -0
- package/schematics/src/ng-add/generators/translation-files.gen.d.ts +4 -0
- package/schematics/src/ng-add/generators/translation-files.gen.js +23 -0
- package/schematics/src/ng-add/generators/translation-files.gen.js.map +1 -0
- package/schematics/src/ng-add/index.d.ts +3 -0
- package/schematics/src/ng-add/index.js +103 -0
- package/schematics/src/ng-add/index.js.map +1 -0
- package/schematics/src/ng-add/schema.d.ts +42 -0
- package/schematics/src/ng-add/schema.js +14 -0
- package/schematics/src/ng-add/schema.js.map +1 -0
- package/schematics/src/ng-add/schema.json +53 -0
- package/schematics/src/ng-migrate/index.d.ts +3 -0
- package/schematics/src/ng-migrate/index.js +14 -0
- package/schematics/src/ng-migrate/index.js.map +1 -0
- package/schematics/src/ng-migrate/ng-migrate.d.ts +5 -0
- package/schematics/src/ng-migrate/ng-migrate.js +106 -0
- package/schematics/src/ng-migrate/ng-migrate.js.map +1 -0
- package/schematics/src/ng-migrate/schema.d.ts +14 -0
- package/schematics/src/ng-migrate/schema.js +3 -0
- package/schematics/src/ng-migrate/schema.js.map +1 -0
- package/schematics/src/ng-migrate/schema.json +27 -0
- package/schematics/src/schematics.consts.d.ts +4 -0
- package/schematics/src/schematics.consts.js +8 -0
- package/schematics/src/schematics.consts.js.map +1 -0
- package/schematics/src/scope/index.d.ts +3 -0
- package/schematics/src/scope/index.js +101 -0
- package/schematics/src/scope/index.js.map +1 -0
- package/schematics/src/scope/schema.d.ts +28 -0
- package/schematics/src/scope/schema.js +3 -0
- package/schematics/src/scope/schema.js.map +1 -0
- package/schematics/src/scope/schema.json +84 -0
- package/schematics/src/split/index.d.ts +3 -0
- package/schematics/src/split/index.js +66 -0
- package/schematics/src/split/index.js.map +1 -0
- package/schematics/src/split/schema.d.ts +20 -0
- package/schematics/src/split/schema.js +3 -0
- package/schematics/src/split/schema.js.map +1 -0
- package/schematics/src/split/schema.json +35 -0
- package/schematics/src/types.d.ts +5 -0
- package/schematics/src/types.js +10 -0
- package/schematics/src/types.js.map +1 -0
- package/schematics/src/upgrade/index.d.ts +3 -0
- package/schematics/src/upgrade/index.js +19 -0
- package/schematics/src/upgrade/index.js.map +1 -0
- package/schematics/src/upgrade/schema.d.ts +6 -0
- package/schematics/src/upgrade/schema.js +3 -0
- package/schematics/src/upgrade/schema.js.map +1 -0
- package/schematics/src/upgrade/schema.json +16 -0
- package/schematics/src/upgrade/v2.d.ts +1 -0
- package/schematics/src/upgrade/v2.js +89 -0
- package/schematics/src/upgrade/v2.js.map +1 -0
- package/schematics/src/utils/array.d.ts +3 -0
- package/schematics/src/utils/array.js +12 -0
- package/schematics/src/utils/array.js.map +1 -0
- package/schematics/src/utils/config.d.ts +2 -0
- package/schematics/src/utils/config.js +13 -0
- package/schematics/src/utils/config.js.map +1 -0
- package/schematics/src/utils/find-module.d.ts +23 -0
- package/schematics/src/utils/find-module.js +110 -0
- package/schematics/src/utils/find-module.js.map +1 -0
- package/schematics/src/utils/package.d.ts +5 -0
- package/schematics/src/utils/package.js +19 -0
- package/schematics/src/utils/package.js.map +1 -0
- package/schematics/src/utils/projects.d.ts +8 -0
- package/schematics/src/utils/projects.js +56 -0
- package/schematics/src/utils/projects.js.map +1 -0
- package/schematics/src/utils/translations.d.ts +7 -0
- package/schematics/src/utils/translations.js +31 -0
- package/schematics/src/utils/translations.js.map +1 -0
- package/schematics/src/utils/transloco.d.ts +24 -0
- package/schematics/src/utils/transloco.js +93 -0
- package/schematics/src/utils/transloco.js.map +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Translation } from './types';
|
|
4
|
+
export interface TranslocoLoader {
|
|
5
|
+
getTranslation(lang: string, data?: TranslocoLoaderData): Observable<Translation> | Promise<Translation>;
|
|
6
|
+
}
|
|
7
|
+
export type TranslocoLoaderData = {
|
|
8
|
+
scope: string;
|
|
9
|
+
};
|
|
10
|
+
export declare class DefaultLoader implements TranslocoLoader {
|
|
11
|
+
private translations;
|
|
12
|
+
constructor(translations: Map<string, Translation>);
|
|
13
|
+
getTranslation(lang: string): Observable<Translation>;
|
|
14
|
+
}
|
|
15
|
+
export declare const TRANSLOCO_LOADER: InjectionToken<TranslocoLoader>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./transloco.directive";
|
|
3
|
+
import * as i2 from "./transloco.pipe";
|
|
4
|
+
export declare class TranslocoModule {
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TranslocoModule, never>;
|
|
6
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<TranslocoModule, never, [typeof i1.TranslocoDirective, typeof i2.TranslocoPipe], [typeof i1.TranslocoDirective, typeof i2.TranslocoPipe]>;
|
|
7
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<TranslocoModule>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ChangeDetectorRef, OnDestroy, PipeTransform } from '@angular/core';
|
|
2
|
+
import { TranslocoService } from './transloco.service';
|
|
3
|
+
import { HashMap, OrArray, TranslocoScope } from './types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class TranslocoPipe implements PipeTransform, OnDestroy {
|
|
6
|
+
private service;
|
|
7
|
+
private providerScope;
|
|
8
|
+
private providerLang;
|
|
9
|
+
private cdr;
|
|
10
|
+
private subscription;
|
|
11
|
+
private lastValue;
|
|
12
|
+
private lastKey;
|
|
13
|
+
private path;
|
|
14
|
+
private langResolver;
|
|
15
|
+
private scopeResolver;
|
|
16
|
+
constructor(service: TranslocoService, providerScope: OrArray<TranslocoScope> | undefined, providerLang: string | undefined, cdr: ChangeDetectorRef);
|
|
17
|
+
transform(key?: string | null, params?: HashMap, inlineLang?: string): string;
|
|
18
|
+
ngOnDestroy(): void;
|
|
19
|
+
private updateValue;
|
|
20
|
+
private resolveScope;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TranslocoPipe, [null, { optional: true; }, { optional: true; }, null]>;
|
|
22
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<TranslocoPipe, "transloco", true>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { EnvironmentProviders, Provider, Type } from '@angular/core';
|
|
2
|
+
import { TranslocoLoader } from './transloco.loader';
|
|
3
|
+
import { PartialTranslocoConfig } from './transloco.config';
|
|
4
|
+
import { TranslocoScope } from './types';
|
|
5
|
+
import { TranslocoTranspiler } from './transloco.transpiler';
|
|
6
|
+
import { TranslocoMissingHandler } from './transloco-missing-handler';
|
|
7
|
+
import { TranslocoInterceptor } from './transloco.interceptor';
|
|
8
|
+
import { TranslocoFallbackStrategy } from './transloco-fallback-strategy';
|
|
9
|
+
import { Content } from './template-handler';
|
|
10
|
+
export interface TranslocoOptions {
|
|
11
|
+
config: PartialTranslocoConfig;
|
|
12
|
+
loader?: Type<TranslocoLoader>;
|
|
13
|
+
}
|
|
14
|
+
export declare function provideTransloco(options: TranslocoOptions): EnvironmentProviders[];
|
|
15
|
+
export declare function provideTranslocoConfig(config: PartialTranslocoConfig): EnvironmentProviders;
|
|
16
|
+
export declare function provideTranslocoLoader(loader: Type<TranslocoLoader>): EnvironmentProviders;
|
|
17
|
+
export declare function provideTranslocoScope(scope: TranslocoScope): {
|
|
18
|
+
provide: import("@angular/core").InjectionToken<TranslocoScope>;
|
|
19
|
+
useValue: TranslocoScope;
|
|
20
|
+
multi: boolean;
|
|
21
|
+
};
|
|
22
|
+
export declare function provideTranslocoLoadingTpl(content: Content): {
|
|
23
|
+
provide: import("@angular/core").InjectionToken<Content>;
|
|
24
|
+
useValue: Content;
|
|
25
|
+
};
|
|
26
|
+
export declare function provideTranslocoTranspiler(transpiler: Type<TranslocoTranspiler>): EnvironmentProviders;
|
|
27
|
+
export declare function provideTranslocoFallbackStrategy(strategy: Type<TranslocoFallbackStrategy>): EnvironmentProviders;
|
|
28
|
+
export declare function provideTranslocoMissingHandler(handler: Type<TranslocoMissingHandler>): EnvironmentProviders;
|
|
29
|
+
export declare function provideTranslocoInterceptor(interceptor: Type<TranslocoInterceptor>): EnvironmentProviders;
|
|
30
|
+
export declare function provideTranslocoLang(lang: string): Provider;
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { TranslocoLoader } from './transloco.loader';
|
|
4
|
+
import { TranslocoTranspiler } from './transloco.transpiler';
|
|
5
|
+
import { AvailableLangs, HashMap, InlineLoader, LoadOptions, SetTranslationOptions, TranslateParams, Translation, TranslocoEvents, TranslocoScope } from './types';
|
|
6
|
+
import { TranslocoConfig } from './transloco.config';
|
|
7
|
+
import { TranslocoMissingHandler } from './transloco-missing-handler';
|
|
8
|
+
import { TranslocoInterceptor } from './transloco.interceptor';
|
|
9
|
+
import { TranslocoFallbackStrategy } from './transloco-fallback-strategy';
|
|
10
|
+
import * as i0 from "@angular/core";
|
|
11
|
+
export declare function translate<T = string>(key: TranslateParams, params?: HashMap, lang?: string): T;
|
|
12
|
+
export declare function translateObject<T>(key: TranslateParams, params?: HashMap, lang?: string): T | T[];
|
|
13
|
+
export declare class TranslocoService implements OnDestroy {
|
|
14
|
+
private loader;
|
|
15
|
+
private parser;
|
|
16
|
+
private missingHandler;
|
|
17
|
+
private interceptor;
|
|
18
|
+
private fallbackStrategy;
|
|
19
|
+
langChanges$: Observable<string>;
|
|
20
|
+
private subscription;
|
|
21
|
+
private translations;
|
|
22
|
+
private cache;
|
|
23
|
+
private firstFallbackLang;
|
|
24
|
+
private defaultLang;
|
|
25
|
+
private availableLangs;
|
|
26
|
+
private isResolvedMissingOnce;
|
|
27
|
+
private lang;
|
|
28
|
+
private failedLangs;
|
|
29
|
+
private events;
|
|
30
|
+
events$: Observable<TranslocoEvents>;
|
|
31
|
+
readonly config: TranslocoConfig & {
|
|
32
|
+
scopeMapping?: HashMap<string>;
|
|
33
|
+
};
|
|
34
|
+
constructor(loader: TranslocoLoader, parser: TranslocoTranspiler, missingHandler: TranslocoMissingHandler, interceptor: TranslocoInterceptor, userConfig: TranslocoConfig, fallbackStrategy: TranslocoFallbackStrategy);
|
|
35
|
+
getDefaultLang(): string;
|
|
36
|
+
setDefaultLang(lang: string): void;
|
|
37
|
+
getActiveLang(): string;
|
|
38
|
+
setActiveLang(lang: string): this;
|
|
39
|
+
setAvailableLangs(langs: AvailableLangs): void;
|
|
40
|
+
/**
|
|
41
|
+
* Gets the available languages.
|
|
42
|
+
*
|
|
43
|
+
* @returns
|
|
44
|
+
* An array of the available languages. Can be either a `string[]` or a `{ id: string; label: string }[]`
|
|
45
|
+
* depending on how the available languages are set in your module.
|
|
46
|
+
*/
|
|
47
|
+
getAvailableLangs(): AvailableLangs;
|
|
48
|
+
load(path: string, options?: LoadOptions): Observable<Translation>;
|
|
49
|
+
/**
|
|
50
|
+
* Gets the instant translated value of a key
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
*
|
|
54
|
+
* translate<string>('hello')
|
|
55
|
+
* translate('hello', { value: 'value' })
|
|
56
|
+
* translate<string[]>(['hello', 'key'])
|
|
57
|
+
* translate('hello', { }, 'en')
|
|
58
|
+
* translate('scope.someKey', { }, 'en')
|
|
59
|
+
*/
|
|
60
|
+
translate<T = string>(key: TranslateParams, params?: HashMap, lang?: string): T;
|
|
61
|
+
/**
|
|
62
|
+
* Gets the translated value of a key as observable
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
*
|
|
66
|
+
* selectTranslate<string>('hello').subscribe(value => ...)
|
|
67
|
+
* selectTranslate<string>('hello', {}, 'es').subscribe(value => ...)
|
|
68
|
+
* selectTranslate<string>('hello', {}, 'todos').subscribe(value => ...)
|
|
69
|
+
* selectTranslate<string>('hello', {}, { scope: 'todos' }).subscribe(value => ...)
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
selectTranslate<T = any>(key: TranslateParams, params?: HashMap, lang?: string | TranslocoScope | TranslocoScope[], _isObject?: boolean): Observable<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Whether the scope with lang
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
*
|
|
78
|
+
* todos/en => true
|
|
79
|
+
* todos => false
|
|
80
|
+
*/
|
|
81
|
+
private isScopeWithLang;
|
|
82
|
+
/**
|
|
83
|
+
* Translate the given path that returns an object
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
*
|
|
87
|
+
* service.translateObject('path.to.object', {'subpath': { value: 'someValue'}}) => returns translated object
|
|
88
|
+
*
|
|
89
|
+
*/
|
|
90
|
+
translateObject<T = any>(key: string, params?: HashMap, lang?: string): T;
|
|
91
|
+
translateObject<T = any>(key: string[], params?: HashMap, lang?: string): T[];
|
|
92
|
+
translateObject<T = any>(key: TranslateParams, params?: HashMap, lang?: string): T | T[];
|
|
93
|
+
translateObject<T = any>(key: HashMap | Map<string, HashMap>, params?: null, lang?: string): T[];
|
|
94
|
+
selectTranslateObject<T = any>(key: string, params?: HashMap, lang?: string): Observable<T>;
|
|
95
|
+
selectTranslateObject<T = any>(key: string[], params?: HashMap, lang?: string): Observable<T[]>;
|
|
96
|
+
selectTranslateObject<T = any>(key: TranslateParams, params?: HashMap, lang?: string): Observable<T> | Observable<T[]>;
|
|
97
|
+
selectTranslateObject<T = any>(key: HashMap | Map<string, HashMap>, params?: null, lang?: string): Observable<T[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Gets an object of translations for a given language
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
*
|
|
103
|
+
* getTranslation()
|
|
104
|
+
* getTranslation('en')
|
|
105
|
+
* getTranslation('admin-page/en')
|
|
106
|
+
*/
|
|
107
|
+
getTranslation(): Map<string, Translation>;
|
|
108
|
+
getTranslation(langOrScope: string): Translation;
|
|
109
|
+
/**
|
|
110
|
+
* Gets an object of translations for a given language
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
*
|
|
114
|
+
* selectTranslation().subscribe() - will return the current lang translation
|
|
115
|
+
* selectTranslation('es').subscribe()
|
|
116
|
+
* selectTranslation('admin-page').subscribe() - will return the current lang scope translation
|
|
117
|
+
* selectTranslation('admin-page/es').subscribe()
|
|
118
|
+
*/
|
|
119
|
+
selectTranslation(lang?: string): Observable<Translation>;
|
|
120
|
+
/**
|
|
121
|
+
* Sets or merge a given translation object to current lang
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
*
|
|
125
|
+
* setTranslation({ ... })
|
|
126
|
+
* setTranslation({ ... }, 'en')
|
|
127
|
+
* setTranslation({ ... }, 'es', { merge: false } )
|
|
128
|
+
* setTranslation({ ... }, 'todos/en', { merge: false } )
|
|
129
|
+
*/
|
|
130
|
+
setTranslation(translation: Translation, lang?: string, options?: SetTranslationOptions): void;
|
|
131
|
+
/**
|
|
132
|
+
* Sets translation key with given value
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
*
|
|
136
|
+
* setTranslationKey('key', 'value')
|
|
137
|
+
* setTranslationKey('key.nested', 'value')
|
|
138
|
+
* setTranslationKey('key.nested', 'value', 'en')
|
|
139
|
+
* setTranslationKey('key.nested', 'value', 'en', { emitChange: false } )
|
|
140
|
+
*/
|
|
141
|
+
setTranslationKey(key: string, value: string, options?: Omit<SetTranslationOptions, 'merge'>): void;
|
|
142
|
+
/**
|
|
143
|
+
* Sets the fallback lang for the currently active language
|
|
144
|
+
* @param fallbackLang
|
|
145
|
+
*/
|
|
146
|
+
setFallbackLangForMissingTranslation({ fallbackLang, }: Pick<TranslocoConfig, 'fallbackLang'>): void;
|
|
147
|
+
/**
|
|
148
|
+
* @internal
|
|
149
|
+
*/
|
|
150
|
+
_handleMissingKey(key: string, value: any, params?: HashMap): any;
|
|
151
|
+
/**
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
154
|
+
_isLangScoped(lang: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Checks if a given string is one of the specified available languages.
|
|
157
|
+
* @returns
|
|
158
|
+
* True if the given string is an available language.
|
|
159
|
+
* False if the given string is not an available language.
|
|
160
|
+
*/
|
|
161
|
+
isLang(lang: string): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* @internal
|
|
164
|
+
*
|
|
165
|
+
* We always want to make sure the global lang is loaded
|
|
166
|
+
* before loading the scope since you can access both via the pipe/directive.
|
|
167
|
+
*/
|
|
168
|
+
_loadDependencies(path: string, inlineLoader?: InlineLoader): Observable<Translation | Translation[]>;
|
|
169
|
+
/**
|
|
170
|
+
* @internal
|
|
171
|
+
*/
|
|
172
|
+
_completeScopeWithLang(langOrScope: string): string;
|
|
173
|
+
/**
|
|
174
|
+
* @internal
|
|
175
|
+
*/
|
|
176
|
+
_setScopeAlias(scope: string, alias: string): void;
|
|
177
|
+
ngOnDestroy(): void;
|
|
178
|
+
private isLoadedTranslation;
|
|
179
|
+
private getAvailableLangsIds;
|
|
180
|
+
private getMissingHandlerData;
|
|
181
|
+
/**
|
|
182
|
+
* Use a fallback translation set for missing keys of the primary language
|
|
183
|
+
* This is unrelated to the fallback language (which changes the active language)
|
|
184
|
+
*/
|
|
185
|
+
private useFallbackTranslation;
|
|
186
|
+
private handleSuccess;
|
|
187
|
+
private handleFailure;
|
|
188
|
+
private getMappedScope;
|
|
189
|
+
/**
|
|
190
|
+
* If lang is scope we need to check the following cases:
|
|
191
|
+
* todos/es => in this case we should take `es` as lang
|
|
192
|
+
* todos => in this case we should set the active lang as lang
|
|
193
|
+
*/
|
|
194
|
+
private resolveLangAndScope;
|
|
195
|
+
private getObjectByKey;
|
|
196
|
+
private getEntries;
|
|
197
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TranslocoService, [{ optional: true; }, null, null, null, null, null]>;
|
|
198
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<TranslocoService>;
|
|
199
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { InjectionToken, Injector } from '@angular/core';
|
|
2
|
+
import { HashMap, Translation } from './types';
|
|
3
|
+
import { TranslocoConfig } from './transloco.config';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare const TRANSLOCO_TRANSPILER: InjectionToken<TranslocoTranspiler>;
|
|
6
|
+
export interface TranslocoTranspiler {
|
|
7
|
+
transpile(params: TranspileParams): any;
|
|
8
|
+
onLangChanged?(lang: string): void;
|
|
9
|
+
}
|
|
10
|
+
export interface TranspileParams<V = unknown> {
|
|
11
|
+
value: V;
|
|
12
|
+
params?: HashMap;
|
|
13
|
+
translation: Translation;
|
|
14
|
+
key: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class DefaultTranspiler implements TranslocoTranspiler {
|
|
17
|
+
protected config: TranslocoConfig;
|
|
18
|
+
protected get interpolationMatcher(): RegExp;
|
|
19
|
+
transpile({ value, params, translation, key }: TranspileParams): any;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
*
|
|
24
|
+
* const en = {
|
|
25
|
+
* a: {
|
|
26
|
+
* b: {
|
|
27
|
+
* c: "Hello {{ value }}"
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* const params = {
|
|
33
|
+
* "b.c": { value: "Transloco "}
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* service.selectTranslate('a', params);
|
|
37
|
+
*
|
|
38
|
+
* // the first param will be the result of `en.a`.
|
|
39
|
+
* // the second param will be `params`.
|
|
40
|
+
* parser.transpile(value, params, {});
|
|
41
|
+
*
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
protected handleObject({ value, params, translation, key }: TranspileParams<Record<any, any>>): Record<any, any>;
|
|
45
|
+
protected handleArray({ value, ...rest }: TranspileParams<unknown[]>): any[];
|
|
46
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultTranspiler, never>;
|
|
47
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DefaultTranspiler>;
|
|
48
|
+
}
|
|
49
|
+
export interface TranslocoTranspilerFunction {
|
|
50
|
+
transpile(...args: string[]): any;
|
|
51
|
+
}
|
|
52
|
+
export declare function getFunctionArgs(argsString: string): string[];
|
|
53
|
+
export declare class FunctionalTranspiler extends DefaultTranspiler implements TranslocoTranspiler {
|
|
54
|
+
protected injector: Injector;
|
|
55
|
+
transpile({ value, ...rest }: TranspileParams): any;
|
|
56
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FunctionalTranspiler, never>;
|
|
57
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FunctionalTranspiler>;
|
|
58
|
+
}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type HashMap<T = any> = Record<string, T>;
|
|
2
|
+
export interface LoadedEvent {
|
|
3
|
+
type: 'translationLoadSuccess';
|
|
4
|
+
wasFailure: boolean;
|
|
5
|
+
payload: {
|
|
6
|
+
scope: string | null;
|
|
7
|
+
langName: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface FailedEvent {
|
|
11
|
+
type: 'translationLoadFailure';
|
|
12
|
+
payload: LoadedEvent['payload'];
|
|
13
|
+
}
|
|
14
|
+
export interface LangChangedEvent {
|
|
15
|
+
type: 'langChanged';
|
|
16
|
+
payload: LoadedEvent['payload'];
|
|
17
|
+
}
|
|
18
|
+
export type TranslocoEvents = LoadedEvent | FailedEvent | LangChangedEvent;
|
|
19
|
+
export type Translation = HashMap;
|
|
20
|
+
export type TranslateParams = string | string[];
|
|
21
|
+
export type TranslateObjectParams = TranslateParams | HashMap | Map<string, HashMap>;
|
|
22
|
+
export interface LangDefinition {
|
|
23
|
+
id: string;
|
|
24
|
+
label: string;
|
|
25
|
+
}
|
|
26
|
+
export type AvailableLangs = string[] | LangDefinition[];
|
|
27
|
+
export interface SetTranslationOptions {
|
|
28
|
+
lang?: string;
|
|
29
|
+
merge?: boolean;
|
|
30
|
+
emitChange?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface ProviderScope {
|
|
33
|
+
scope: string;
|
|
34
|
+
loader?: InlineLoader;
|
|
35
|
+
alias?: string;
|
|
36
|
+
}
|
|
37
|
+
export type OrArray<T> = T | T[];
|
|
38
|
+
export type TranslocoScope = ProviderScope | string | undefined;
|
|
39
|
+
export type InlineLoader = HashMap<() => Promise<Translation>>;
|
|
40
|
+
export interface LoadOptions {
|
|
41
|
+
fallbackLangs?: string[] | null;
|
|
42
|
+
/** @internal */
|
|
43
|
+
failedCounter?: number;
|
|
44
|
+
inlineLoader?: InlineLoader;
|
|
45
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jsverse/transloco",
|
|
3
|
+
"version": "7.0.0",
|
|
4
|
+
"description": "The internationalization (i18n) library for Angular",
|
|
5
|
+
"schematics": "./schematics/src/collection.json",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/jsverse/transloco/issues"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://jsverse.github.io/transloco/",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/jsverse/transloco"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"angular",
|
|
19
|
+
"angular 2",
|
|
20
|
+
"i18n",
|
|
21
|
+
"translate",
|
|
22
|
+
"angular translate",
|
|
23
|
+
"angular i18n",
|
|
24
|
+
"transloco"
|
|
25
|
+
],
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@angular/core": ">=16.0.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"fs-extra": "^11.0.0",
|
|
32
|
+
"glob": "^10.0.0",
|
|
33
|
+
"tslib": "^2.2.0",
|
|
34
|
+
"flat": "6.0.1",
|
|
35
|
+
"@jsverse/transloco-utils": "^7.0.0",
|
|
36
|
+
"replace-in-file": "^7.0.1",
|
|
37
|
+
"ora": "^5.4.1",
|
|
38
|
+
"lodash.kebabcase": "^4.1.1"
|
|
39
|
+
},
|
|
40
|
+
"module": "fesm2022/jsverse-transloco.mjs",
|
|
41
|
+
"typings": "index.d.ts",
|
|
42
|
+
"exports": {
|
|
43
|
+
"./package.json": {
|
|
44
|
+
"default": "./package.json"
|
|
45
|
+
},
|
|
46
|
+
".": {
|
|
47
|
+
"types": "./index.d.ts",
|
|
48
|
+
"esm2022": "./esm2022/jsverse-transloco.mjs",
|
|
49
|
+
"esm": "./esm2022/jsverse-transloco.mjs",
|
|
50
|
+
"default": "./fesm2022/jsverse-transloco.mjs"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"sideEffects": false
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["@schematics/angular"],
|
|
3
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
4
|
+
"schematics": {
|
|
5
|
+
"ng-add": {
|
|
6
|
+
"aliases": ["init"],
|
|
7
|
+
"factory": "./ng-add/index",
|
|
8
|
+
"schema": "./ng-add/schema.json",
|
|
9
|
+
"description": "Add transloco configuration for root module."
|
|
10
|
+
},
|
|
11
|
+
"component": {
|
|
12
|
+
"aliases": ["c"],
|
|
13
|
+
"factory": "./component/index",
|
|
14
|
+
"schema": "../../../../@schematics/angular/component/schema.json",
|
|
15
|
+
"description": "Add component with translation."
|
|
16
|
+
},
|
|
17
|
+
"migrate": {
|
|
18
|
+
"aliases": ["m"],
|
|
19
|
+
"factory": "./migrate/index",
|
|
20
|
+
"schema": "./migrate/schema.json",
|
|
21
|
+
"description": "Run a migration script from @ngx-translate."
|
|
22
|
+
},
|
|
23
|
+
"scope": {
|
|
24
|
+
"aliases": ["s"],
|
|
25
|
+
"factory": "./scope/index",
|
|
26
|
+
"schema": "./scope/schema.json",
|
|
27
|
+
"description": "Add transloco scope."
|
|
28
|
+
},
|
|
29
|
+
"upgrade": {
|
|
30
|
+
"aliases": ["up"],
|
|
31
|
+
"factory": "./upgrade/index",
|
|
32
|
+
"schema": "./upgrade/schema.json",
|
|
33
|
+
"description": "Run an upgrade script."
|
|
34
|
+
},
|
|
35
|
+
"keys-manager": {
|
|
36
|
+
"aliases": ["km"],
|
|
37
|
+
"factory": "./keys-manager/index",
|
|
38
|
+
"schema": "./keys-manager/schema.json",
|
|
39
|
+
"description": "Add Transloco Keys Manager plugin to your project."
|
|
40
|
+
},
|
|
41
|
+
"join": {
|
|
42
|
+
"aliases": ["build"],
|
|
43
|
+
"factory": "./join/index",
|
|
44
|
+
"schema": "./join/schema.json",
|
|
45
|
+
"description": "Join the translation files into one."
|
|
46
|
+
},
|
|
47
|
+
"split": {
|
|
48
|
+
"aliases": ["sp"],
|
|
49
|
+
"factory": "./split/index",
|
|
50
|
+
"schema": "./split/schema.json",
|
|
51
|
+
"description": "split the translated files over the project's translation files."
|
|
52
|
+
},
|
|
53
|
+
"ng-migrate": {
|
|
54
|
+
"factory": "./ng-migrate/index",
|
|
55
|
+
"schema": "./ng-migrate/schema.json",
|
|
56
|
+
"description": "split the translated files over the project's translation files."
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
4
|
+
const operators_1 = require("rxjs/operators");
|
|
5
|
+
function default_1(options) {
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
return (host, context) => {
|
|
8
|
+
const template = `<ng-template transloco let-t>
|
|
9
|
+
<h1> {{ t('title') }} </h1>
|
|
10
|
+
</ng-template>
|
|
11
|
+
`;
|
|
12
|
+
const cmpRule = (0, schematics_1.externalSchematic)('@schematics/angular', 'component', options);
|
|
13
|
+
const tree$ = cmpRule(host, context).pipe((0, operators_1.tap)((tree) => {
|
|
14
|
+
const templatePath = tree.actions.find((action) => !!action.path.match(/component.html/)).path;
|
|
15
|
+
tree.overwrite(templatePath, template);
|
|
16
|
+
}));
|
|
17
|
+
return tree$;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
exports.default = default_1;
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/transloco-schematics/src/component/index.ts"],"names":[],"mappings":";;AAAA,2DAKoC;AAEpC,8CAAqC;AAErC,mBAAyB,OAAO;IAC9B,aAAa;IACb,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,MAAM,QAAQ,GAAG;;;CAGpB,CAAC;QAEE,MAAM,OAAO,GAAG,IAAA,8BAAiB,EAC/B,qBAAqB,EACrB,WAAW,EACX,OAAO,CACR,CAAC;QACF,MAAM,KAAK,GAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAiC,CAAC,IAAI,CACxE,IAAA,eAAG,EAAC,CAAC,IAAI,EAAE,EAAE;YACX,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CACpC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAClD,CAAC,IAAI,CAAC;YACP,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACzC,CAAC,CAAC,CACH,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAxBD,4BAwBC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const fs_extra_1 = require("fs-extra");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
const transloco_1 = require("../utils/transloco");
|
|
8
|
+
function reduceTranslations(host, dirPath, translationJson, lang, key = '') {
|
|
9
|
+
const dir = host.getDir(dirPath);
|
|
10
|
+
if (!(0, transloco_1.hasFiles)(dir) && !(0, transloco_1.hasSubdirs)(dir))
|
|
11
|
+
return translationJson;
|
|
12
|
+
dir.subfiles
|
|
13
|
+
.filter((fileName) => fileName.includes(`${lang}.json`))
|
|
14
|
+
.forEach((fileName) => {
|
|
15
|
+
if (translationJson[key]) {
|
|
16
|
+
throw new schematics_1.SchematicsException(`key: ${key} already exist in translation file, please rename it and rerun the command.`);
|
|
17
|
+
}
|
|
18
|
+
translationJson[key] = (0, transloco_1.getJsonFileContent)(fileName, dir);
|
|
19
|
+
});
|
|
20
|
+
if ((0, transloco_1.hasSubdirs)(dir)) {
|
|
21
|
+
dir.subdirs.forEach((subDirName) => {
|
|
22
|
+
const subDir = dir.dir(subDirName);
|
|
23
|
+
const nestedKey = (0, transloco_1.getTranslationKey)(key, subDirName);
|
|
24
|
+
reduceTranslations(host, (0, core_1.normalize)(subDir.path).substr(1), translationJson, lang, nestedKey);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return translationJson;
|
|
28
|
+
}
|
|
29
|
+
function deletePrevFiles(host, options) {
|
|
30
|
+
if ((0, fs_extra_1.existsSync)(options.outDir)) {
|
|
31
|
+
(0, fs_extra_1.removeSync)(options.outDir);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function jsonBuilder(tree, path, content) {
|
|
35
|
+
tree.create(`${path}.json`, JSON.stringify(content, null, 2));
|
|
36
|
+
}
|
|
37
|
+
function builderFactory(format) {
|
|
38
|
+
switch (format) {
|
|
39
|
+
case types_1.TranslationFileFormat.JSON:
|
|
40
|
+
return jsonBuilder;
|
|
41
|
+
case types_1.TranslationFileFormat.PO:
|
|
42
|
+
// TODO:
|
|
43
|
+
return jsonBuilder;
|
|
44
|
+
case types_1.TranslationFileFormat.XLIFF:
|
|
45
|
+
// TODO:
|
|
46
|
+
return jsonBuilder;
|
|
47
|
+
default:
|
|
48
|
+
return jsonBuilder;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function default_1(options) {
|
|
52
|
+
return (host) => {
|
|
53
|
+
deletePrevFiles(host, options);
|
|
54
|
+
const root = (0, transloco_1.getTranslationsRoot)(host, options);
|
|
55
|
+
const defaultLang = (0, transloco_1.getDefaultLang)(options);
|
|
56
|
+
if (options.includeDefaultLang && !defaultLang) {
|
|
57
|
+
throw new schematics_1.SchematicsException(`Please specify the default project's language using --default-Lang or in transloco.config.js file.`);
|
|
58
|
+
}
|
|
59
|
+
let rootTranslations = (0, transloco_1.getTranslationFiles)(host, root);
|
|
60
|
+
const translationEntryPaths = (0, transloco_1.getTranslationEntryPaths)(host, root);
|
|
61
|
+
if (!options.includeDefaultLang) {
|
|
62
|
+
rootTranslations = rootTranslations.filter((t) => t.lang !== defaultLang);
|
|
63
|
+
}
|
|
64
|
+
const output = rootTranslations.map((t) => ({
|
|
65
|
+
lang: t.lang,
|
|
66
|
+
translation: translationEntryPaths.reduce((acc, entryPath) => {
|
|
67
|
+
return reduceTranslations(host, entryPath.path, t.translation, t.lang, entryPath.scope);
|
|
68
|
+
}, t.translation),
|
|
69
|
+
}));
|
|
70
|
+
const treeSource = new schematics_1.EmptyTree();
|
|
71
|
+
const builder = builderFactory(options.format);
|
|
72
|
+
output.forEach((o) => {
|
|
73
|
+
builder(treeSource, `${options.outDir}/${o.lang}`, o.translation);
|
|
74
|
+
});
|
|
75
|
+
return treeSource;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
exports.default = default_1;
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/transloco-schematics/src/join/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Schema } from '@schematics/angular/module/schema';
|
|
2
|
+
import { TranslationFileFormat } from '../types';
|
|
3
|
+
export interface SchemaOptions extends Schema {
|
|
4
|
+
/**
|
|
5
|
+
* The folder that contain the root translation files.
|
|
6
|
+
*/
|
|
7
|
+
translationPath: string;
|
|
8
|
+
/**
|
|
9
|
+
* The default language of the project.
|
|
10
|
+
*/
|
|
11
|
+
defaultLang: string;
|
|
12
|
+
/**
|
|
13
|
+
* Determine rather join also the default language
|
|
14
|
+
*/
|
|
15
|
+
includeDefaultLang: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The output directory.
|
|
18
|
+
*/
|
|
19
|
+
outDir: string;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
format?: TranslationFileFormat;
|
|
24
|
+
/**
|
|
25
|
+
* The root project name.
|
|
26
|
+
*/
|
|
27
|
+
project: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../libs/transloco-schematics/src/join/schema.ts"],"names":[],"mappings":""}
|