UNPKG

@sixbell-telco/sdk

Version:

A collection of reusable components designed for use in Sixbell Telco Angular projects

63 lines (62 loc) 2.51 kB
import { EnvironmentProviders } from '@angular/core'; import { TranslateLoader, TranslationObject } from '@ngx-translate/core'; import { Observable } from 'rxjs'; import { RuntimeTranslationProviderOptions } from './translation.provider.types'; import * as i0 from "@angular/core"; /** * Custom TranslateLoader that defers injection of TranslationService. * * This loader is instantiated by ngx-translate when first needed. * By deferring the inject() call until getTranslation is called, * we avoid circular dependency issues during DI setup. * * Key: DO NOT use providedIn: 'root' - let ngx-translate manage the lifecycle. */ export declare class RuntimeTranslationCustomLoader implements TranslateLoader { private readonly injector; getTranslation(lang: string): Observable<TranslationObject>; static ɵfac: i0.ɵɵFactoryDeclaration<RuntimeTranslationCustomLoader, never>; static ɵprov: i0.ɵɵInjectableDeclaration<RuntimeTranslationCustomLoader>; } /** * Configuration options for the runtime translation provider (like themes). * * @property appId - Optional namespace to avoid cache collisions across MFEs * @property sse - Optional SSE config for runtime update checks (disabled by default) * @property updateStream - Optional Observable for runtime update checks (disabled by default) * * @example * ```typescript * // Default mode * provideRuntimeTranslation('/assets/config/translation-config.json') * * // SSE updates (optional) * provideRuntimeTranslation('/assets/config/translation-config.json', { * sse: { url: '/api/updates' } * }) * ``` */ /** * Build runtime translation loader options with defaults */ /** * Provide Translation service with configuration loaded from a JSON file at runtime (like themes). * * This is the ONLY provider that sets up ngx-translate. It: * - Loads translation configuration from a JSON file * - Sets up ngx-translate with custom loader that loads from multiple paths * - Supports hot-reload on navigation * - Supports offline scenarios with caching * * @param configPath - Path to translation configuration JSON file * @param options - Optional loader configuration * @returns Environment providers * * @example * ```typescript * bootstrapApplication(AppComponent, [ * provideRuntimeTranslation('/assets/translation/translation-config.json') * ]); * ``` */ export declare function provideRuntimeTranslation(configPath: string, options?: RuntimeTranslationProviderOptions): EnvironmentProviders;