芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/app.optimyar.com/backend/node_modules/react-intl/src/formatters/plural.ts
import {IntlConfig, Formatters, IntlFormatters} from '../types' import {filterProps} from '../utils' import {ReactIntlErrorCode, ReactIntlError} from '../error' import {FormatError, ErrorCode} from 'intl-messageformat' const PLURAL_FORMAT_OPTIONS: Array
= [ 'localeMatcher', 'type', ] export function formatPlural( {locale, onError}: Pick
, getPluralRules: Formatters['getPluralRules'], value: Parameters
[0], options: Parameters
[1] = {} ): string { if (!Intl.PluralRules) { onError( new FormatError( `Intl.PluralRules is not available in this environment. Try polyfilling it using "@formatjs/intl-pluralrules" `, ErrorCode.MISSING_INTL_API ) ) } const filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS) try { return getPluralRules(locale, filteredOptions).select(value) } catch (e) { onError( new ReactIntlError( ReactIntlErrorCode.FORMAT_ERROR, 'Error formatting plural.', e ) ) } return 'other' }