import * as i0 from '@angular/core'; import { InjectionToken, PipeTransform, OnDestroy, Injector, Provider } from '@angular/core'; import { Observable } from 'rxjs'; import { TranslatableString } from '@siemens/element-translate-ng/translate-types'; export * from '@siemens/element-translate-ng/translate-types'; /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ declare const SI_TRANSLATABLE_VALUES: InjectionToken[]>; /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ /** * Translates keys by using the {@link SiTranslateService}. * Within Element this pipe should be used instead of ngx-translates `translate` pipe. * Outside Element, this pipe should NOT be used. * * @internal */ declare class SiTranslatePipe implements PipeTransform, OnDestroy { private lastKeyParams?; private value; private subscription?; private siTranslateService; private cdRef; /** * Method which is called on any data passed to the pipe. * Called by Angular, should not be called directly. */ transform(key: string, params?: any): string; transform(key: string | null | undefined, params?: any): string | null | undefined; ngOnDestroy(): void; private updateValue; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵpipe: i0.ɵɵPipeDeclaration; } /** * This provides declares SiTranslatePipe and provides a respective SiTranslateService. * It should be used internally of Element but NOT by any application. * * @deprecated This module is no longer needed. * Replace it with the {@link SiTranslatePipe} if needed, otherwise drop it without replacement. * * @internal */ declare class SiTranslateModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } type TranslationResult = T extends string ? string : Record; /** * @returns The culture language code of the browser, e.g. "en-US". */ declare const getBrowserCultureLanguage: () => string | undefined; /** * @returns The language code of the browser, e.g. "en". */ declare const getBrowserLanguage: () => string | undefined; /** * Wrapper around an actual translation framework which is meant to be used internally by Element. * Applications must not use this service. * * Use {@link injectSiTranslateService} to get an instance of the translation service. * * @internal */ declare abstract class SiTranslateService { protected translationChange$: Observable; private documentRef; prevent$LocalizeInit?: boolean; /** * The currently used language. */ abstract currentLanguage: string | null; /** * Sets a new language to be used. If needed, loads the language file. * @param lang - The language to be used. * @returns An observable that emits when the new language is loaded and activated. */ abstract setCurrentLanguage(lang: string): Observable; /** * The language to be used as default. * @param lang - The language code. */ abstract setDefaultLanguage(lang: string): void; /** * The language to be used as default. * @returns The code of the default language. */ abstract getDefaultLanguage(): string | null; /** * The available languages. */ abstract get availableLanguages(): readonly string[]; abstract set availableLanguages(languages: string[]); /** * If the underlying translation library supports switching the language * and/or updating the translation texts, this observable will emit. * There is no initial emit. */ get translationChange(): Observable; /** * Translates the key(s) by using the underlying translation library. * * @param keys - A single translation key or an array of keys. * @param params - Parameters to be replaced within the translation text. * * @returns Returns the translated key or an object with the translated keys. * Depending on the underlying translation library (sync/async) the result will * be wrapped in an Observable. */ abstract translate(keys: T, params?: Record): Observable> | TranslationResult; /** * Translates the key(s) by using the underlying translation library in an asynchronous manner. * It will emit each time the active language is changed. * * @param keys - A single translation key or an array of keys. * @param params - Parameters to be replaced within the translation text. * * @returns Returns the translated key or an object with the translated keys wrapped in an Observable. */ abstract translateAsync(keys: T, params?: Record): Observable>; /** * Translates the key(s) by using the underlying translation library in a synchronous manner. * * Warning: The caller of this function needs to make sure the translation file(s) are already loaded. * It is generally not recommended to use this function unless you know exactly what you are doing. * * @param keys - A single translation key or an array of keys. * @param params - Parameters to be replaced within the translation text. * * @returns Returns the translated key or an object with the translated keys. */ abstract translateSync(keys: T, params?: Record): TranslationResult; /** * If supported by the underlying translation library, this method can be used to add a translation for a specific key. * It is intended to be used for adding the english default value. * It will be called whenever a key within element is resolved. * An implementation of this method must check that it does not override an existing translation. */ setTranslation?(key: string, value: string): void; setDocumentLanguage(lang: string): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ /** * Provide this class to build a custom translation service. * * @internal */ declare abstract class SiTranslateServiceBuilder { /** * Returns a translation service instance. * @param injector - Is used to retrieve dependencies needed to create the translation service. */ abstract buildService(injector: Injector): SiTranslateService; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Pass through implementation of the {@link SiTranslateService} which is used as a default. * * @internal */ declare class SiNoTranslateService extends SiTranslateService { private readonly lang; get currentLanguage(): string; get availableLanguages(): string[]; set availableLanguages(lang: string[]); setCurrentLanguage(lang: string): Observable; getDefaultLanguage(): string; setDefaultLanguage(lang: string): void; translate(keys: T, _params?: Record): TranslationResult; translateSync(keys: T, params?: Record): TranslationResult; translateAsync(keys: T, params?: Record): Observable>; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ declare const provideMockTranslateServiceBuilder: (buildService: (injector: Injector) => SiTranslateService) => Provider; declare const injectSiTranslateService: () => SiTranslateService; /** * Always wrap `$localize` calls in this function within element components. * It may patch the global $localize based on the current translation framework. * * This function requires an `InjectionContext.` * * @internal * * @example * ```ts * class MyComponent { * readonly myText = t(() => $localize`:@@my-text:This is a default text`); * } * ``` */ declare const t: (localizeWrapperFunction: () => string) => TranslatableString; export { SI_TRANSLATABLE_VALUES, SiNoTranslateService, SiTranslateModule, SiTranslatePipe, SiTranslateService, SiTranslateServiceBuilder, getBrowserCultureLanguage, getBrowserLanguage, injectSiTranslateService, provideMockTranslateServiceBuilder, t }; export type { TranslationResult };