@phensley/cldr-core
Version:
Core library for @phensley/cldr
36 lines (35 loc) • 2.15 kB
TypeScript
import { CurrenciesSchema, CurrencyType, DigitsArrow, NumbersSchema, PluralType } from '@phensley/cldr-schema';
import { CurrencyFormatOptions, CurrencySymbolWidthType, DecimalFormatOptions } from '../../common';
import { Decimal, Part } from '../../types';
import { NumberContext } from './context';
import { NumberParams } from '../../common/private';
import { NumberPattern } from '../../parsing/patterns/number';
import { Cache } from '../../utils/cache';
import { Bundle } from '../../resource';
import { Internals, NumberInternals, NumberRenderer } from '..';
/**
* Number internal engine singleton, shared across all locales.
*/
export declare class NumberInternalsImpl implements NumberInternals {
readonly internals: Internals;
readonly currencies: CurrenciesSchema;
readonly numbers: NumbersSchema;
protected readonly numberPatternCache: Cache<NumberPattern[]>;
constructor(internals: Internals, cacheSize?: number);
stringRenderer(params: NumberParams): NumberRenderer<string>;
partsRenderer(params: NumberParams): NumberRenderer<Part[]>;
getCurrencySymbol(bundle: Bundle, code: CurrencyType, width?: CurrencySymbolWidthType): string;
getCurrencyDisplayName(bundle: Bundle, code: CurrencyType): string;
getCurrencyPluralName(bundle: Bundle, code: string, plural: PluralType): string;
getNumberPattern(raw: string, negative: boolean): NumberPattern;
formatDecimal<T>(bundle: Bundle, renderer: NumberRenderer<T>, n: Decimal, options: DecimalFormatOptions, params: NumberParams): [T, PluralType];
formatCurrency<T>(bundle: Bundle, renderer: NumberRenderer<T>, n: Decimal, code: string, options: CurrencyFormatOptions, params: NumberParams): T;
/**
* Setup for a compact pattern. Returns the adjusted number and digits for
* selecting the pluralized pattern.
*
* The extra complexity here is to deal with rounding up and selecting the
* correct pluralized pattern for the final rounded form.
*/
protected setupCompact(bundle: Bundle, n: Decimal, ctx: NumberContext, standardRaw: string, patternImpl: DigitsArrow<PluralType>): [Decimal, number];
}