import * as i0 from '@angular/core'; import { InjectionToken, EventEmitter } from '@angular/core'; import { BehaviorSubject, ReplaySubject, Observable } from 'rxjs'; import { Directionality, Direction } from '@angular/cdk/bidi'; declare const SI_LOCALE_STORE: InjectionToken; declare const SI_LOCALE_CONFIG: InjectionToken; interface SiLocaleConfig { /** * The default locale to be used, when no user preference * available and the browser language is not part of the * available languages. */ defaultLocale?: string; /** * The list of available locales (e.g. en, fr, de, en-GB, de-AT) */ availableLocales?: string[]; /** * The localeInitializer function is invoked on every locale change. * Make sure to invoke `registerLocaleData` with the locale to enable * the Angular localization. */ localeInitializer?: (localeId: string) => Promise; /** * Set to true to also enable the default language on ngx-translate. When true, * ngx-translate will use a translate value from the default language when a required * value is not available in the current language. But note, this will also enforce * to load the default language translation file into the application, even if a different * locale is active. In other words, the application start time increases. */ fallbackEnabled?: boolean; /** * Default is false and defines that on setting a new locale, the locale is stored and the * browser is reloaded. When changing to true, window reload is not invoked, but angular * pure pipes like DatePipe will not work. */ dynamicLanguageChange?: boolean; } declare class SiLocaleService { /** * Holds the used locale definition like en, de, or en-US. */ readonly locale$: BehaviorSubject; /** * Emits to indicate that the localization package (e.g. \@angular/common/locales/$\{localeId\}) * is loaded and registered. Emits after calling `localeInitializer` from the `config` object. */ readonly localePackageLoaded$: ReplaySubject; private _nextLocale; private isBrowser; private translate; private localeStore; /** * The config for the local service. */ config: SiLocaleConfig; constructor(); /** * Sets a new locale to the locale service and also to the translate * service. * @throws An error if the new value is not configured in the available locales * or if the new locale cannot be saved, an error is thrown. */ set locale(value: string); get locale(): string; private doSetLocale; /** * Test if the given locale is part of the available locales. * @param locale - The locale to be tested. */ hasLocale(locale?: string): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * The SiLocaleId is used to provide a locale id from the translate service * to the angular localization. The Angular services call toString or valueOf * so that the current locale of the translation service is provided. The Intl. * library does not invoke toString() and using the value directly in Intl * formatting results always having the `en` locale. Thus, when using the SiLocaleId * in other services, make sure to use the `toString()` method before. */ declare class SiLocaleId extends String { protected service: SiLocaleService; constructor(); /** * Outputs the locale id as a string. */ toString(): string; valueOf(): string; toLowerCase(): string; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ declare abstract class SiLocaleStore { abstract get locale(): string | undefined; abstract saveLocale(locale: string): Observable; } declare const SI_LOCALE_LOCAL_STORAGE_KEY = "lang"; declare class SiDefaultLocaleStore extends SiLocaleStore { private isBrowser; constructor(isBrowser: boolean); get locale(): string | undefined; saveLocale(locale: string): Observable; } /** * Provider for dynamic CDK directionality. * * CDK per default evaluates directionality once during initialization. This is a problem when * switching language later in the lifecycle. This provider can be used to make this dynamic. * To use, simply provide this in the `ApplicationConfig`: * * ```ts * import { Directionality } from '@angular/cdk/bidi'; * import { SiDirectionality } from '@siemens/element-ng/localization'; * * ... * export const APP_CONFIG: ApplicationConfig = { * providers: [ * { provide: Directionality, useClass: SiDirectionality }, * ... * ] * } * * bootstrapApplication(AppComponent, APP_CONFIG) * ... * * ``` */ declare class SiDirectionality implements Directionality { readonly change: EventEmitter; /** @defaultValue 'ltr' */ readonly valueSignal: i0.WritableSignal; get value(): Direction; /** @internal */ ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } export { SI_LOCALE_CONFIG, SI_LOCALE_LOCAL_STORAGE_KEY, SI_LOCALE_STORE, SiDefaultLocaleStore, SiDirectionality, SiLocaleId, SiLocaleService, SiLocaleStore }; export type { SiLocaleConfig };