UNPKG

@wamasimba/ngx-translate-core

Version:
32 lines (31 loc) 1.52 kB
import { InterpolationParameters } from "./translate.service"; import * as i0 from "@angular/core"; export type InterpolateFunction = (params?: InterpolationParameters) => string; export declare abstract class TranslateParser { /** * Interpolates a string to replace parameters * "This is a {{ key }}" ==> "This is a value", with params = { key: "value" } * @param expr * @param params */ abstract interpolate(expr: InterpolateFunction | string, params?: InterpolationParameters): string | undefined; } export declare class TranslateDefaultParser extends TranslateParser { templateMatcher: RegExp; interpolate(expr: InterpolateFunction | string, params?: InterpolationParameters): string | undefined; protected interpolateFunction(fn: InterpolateFunction, params?: InterpolationParameters): string; protected interpolateString(expr: string, params?: InterpolationParameters): string; /** * Returns the replacement for an interpolation parameter * @params: */ protected getInterpolationReplacement(params: InterpolationParameters, key: string): string | undefined; /** * Converts a value into a useful string representation. * @param value The value to format. * @returns A string representation of the value. */ protected formatValue(value: any): string | undefined; static ɵfac: i0.ɵɵFactoryDeclaration<TranslateDefaultParser, never>; static ɵprov: i0.ɵɵInjectableDeclaration<TranslateDefaultParser>; }