@jsverse/transloco-locale
Version:
The localization (l10n) library plugin for Transloco
55 lines (54 loc) • 2.27 kB
TypeScript
import { OnDestroy } from '@angular/core';
import { DateFormatOptions, Locale, NumberStyles, ValidDate } from './transloco-locale.types';
import * as i0 from "@angular/core";
export declare class TranslocoLocaleService implements OnDestroy {
private translocoService;
private langLocaleMapping;
private defaultLocale;
private defaultCurrency;
private localeCurrencyMapping;
private numberTransformer;
private dateTransformer;
private localeConfig;
private _locale;
private locale;
private subscription;
localeChanges$: import("rxjs").Observable<string>;
getLocale(): string;
setLocale(locale: Locale): void;
/**
* Get the currency symbol for the currently set locale.
*/
getCurrencySymbol(locale?: string): string | undefined;
/**
* Transform a date into the locale's date format.
*
* The date expression: a `Date` object, a number
* (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).
*
* @example
*
* localizeDate(new Date(2019, 9, 7, 12, 0, 0)) // 10/7/2019
* localizeDate(date, 'en-US', { dateStyle: 'medium', timeStyle: 'medium' }) // Sep 10, 2019, 10:46:12 PM
* localizeDate(date) 'en-US', { timeZone: 'UTC', timeStyle: 'full' } // 7:40:32 PM Coordinated Universal Time
* localizeDate(1, 'en-US', { dateStyle: 'medium' }) // Jan 1, 1970
* localizeDate('2019-02-08', 'en-US', { dateStyle: 'medium' }) // Feb 8, 2019
*/
localizeDate(date: ValidDate, locale?: Locale, options?: DateFormatOptions): string;
/**
* Transform a number into the locale's number format according to the number type.
*
* localizeNumber(1234567890, 'decimal') // 1,234,567,890
* localizeNumber(0.5, 'percent') // 50%
* localizeNumber(1000, 'currency') // $1,000.00
*/
localizeNumber(value: number | string, style: NumberStyles, locale?: Locale, options?: Intl.NumberFormatOptions): string;
/**
* @internal
*/
_resolveCurrencyCode(locale?: Locale): string;
ngOnDestroy(): void;
private toLocale;
static ɵfac: i0.ɵɵFactoryDeclaration<TranslocoLocaleService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TranslocoLocaleService>;
}