UNPKG

@bespunky/angular-zen

Version:

The Angular tools you always wished were there.

40 lines (39 loc) 1.51 kB
import { UrlReflectionService } from '@bespunky/angular-zen/router-x'; import * as i0 from "@angular/core"; /** * The base class for url localization implementors. This can be used as an injectable token to get a hold of the currently * configured url localizer class. * * @export * @abstract * @class UrlLocalizer */ export declare abstract class UrlLocalizer { protected urlReflection: UrlReflectionService; /** * Creates an instance of UrlLocalizer. * * @param {UrlReflectionService} urlReflection The url reflection service. */ constructor(urlReflection: UrlReflectionService); /** * Reads the currently navigated url and localizes it to the specified language. * If the url is already localized with a different language, updates the language. * If the url is already localized with the specified language, returns the url unchanged. * * @abstract * @param {string} lang The language code to use for localization (e.g. 'en', 'fr', 'en-US', 'es-CL'). * @returns {string} The localized url. */ abstract localize(lang: string): string; /** * Reads the Currently navigated url and delocalizes it. * If the url is already delocalized, return the url unchanged. * * @abstract * @returns {string} The delocalized url. */ abstract delocalize(): string; static ɵfac: i0.ɵɵFactoryDeclaration<UrlLocalizer, never>; static ɵprov: i0.ɵɵInjectableDeclaration<UrlLocalizer>; }