/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Format styles that can be used to represent numbers. * @see {@link getLocaleNumberFormat} * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare enum NumberFormatStyle { Decimal = 0, Percent = 1, Currency = 2, Scientific = 3 } /** * Plurality cases used for translating plurals to different languages. * * @see {@link NgPlural} * @see {@link NgPluralCase} * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare enum Plural { Zero = 0, One = 1, Two = 2, Few = 3, Many = 4, Other = 5 } /** * Context-dependant translation forms for strings. * Typically the standalone version is for the nominative form of the word, * and the format version is used for the genitive case. * @see [CLDR website](http://cldr.unicode.org/translation/date-time-1/date-time#TOC-Standalone-vs.-Format-Styles) * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare enum FormStyle { Format = 0, Standalone = 1 } /** * String widths available for translations. * The specific character widths are locale-specific. * Examples are given for the word "Sunday" in English. * * @publicApi */ export declare enum TranslationWidth { /** 1 character for `en-US`. For example: 'S' */ Narrow = 0, /** 3 characters for `en-US`. For example: 'Sun' */ Abbreviated = 1, /** Full length for `en-US`. For example: "Sunday" */ Wide = 2, /** 2 characters for `en-US`, For example: "Su" */ Short = 3 } /** * String widths available for date-time formats. * The specific character widths are locale-specific. * Examples are given for `en-US`. * * @see {@link getLocaleDateFormat} * @see {@link getLocaleTimeFormat} * @see {@link getLocaleDateTimeFormat} * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * @publicApi */ export declare enum FormatWidth { /** * For `en-US`, 'M/d/yy, h:mm a'` * (Example: `6/15/15, 9:03 AM`) */ Short = 0, /** * For `en-US`, `'MMM d, y, h:mm:ss a'` * (Example: `Jun 15, 2015, 9:03:01 AM`) */ Medium = 1, /** * For `en-US`, `'MMMM d, y, h:mm:ss a z'` * (Example: `June 15, 2015 at 9:03:01 AM GMT+1`) */ Long = 2, /** * For `en-US`, `'EEEE, MMMM d, y, h:mm:ss a zzzz'` * (Example: `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00`) */ Full = 3 } /** * Symbols that can be used to replace placeholders in number patterns. * Examples are based on `en-US` values. * * @see {@link getLocaleNumberSymbol} * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi * @object-literal-as-enum */ export declare const NumberSymbol: { /** * Decimal separator. * For `en-US`, the dot character. * Example: 2,345`.`67 */ readonly Decimal: 0; /** * Grouping separator, typically for thousands. * For `en-US`, the comma character. * Example: 2`,`345.67 */ readonly Group: 1; /** * List-item separator. * Example: "one, two, and three" */ readonly List: 2; /** * Sign for percentage (out of 100). * Example: 23.4% */ readonly PercentSign: 3; /** * Sign for positive numbers. * Example: +23 */ readonly PlusSign: 4; /** * Sign for negative numbers. * Example: -23 */ readonly MinusSign: 5; /** * Computer notation for exponential value (n times a power of 10). * Example: 1.2E3 */ readonly Exponential: 6; /** * Human-readable format of exponential. * Example: 1.2x103 */ readonly SuperscriptingExponent: 7; /** * Sign for permille (out of 1000). * Example: 23.4‰ */ readonly PerMille: 8; /** * Infinity, can be used with plus and minus. * Example: ∞, +∞, -∞ */ readonly Infinity: 9; /** * Not a number. * Example: NaN */ readonly NaN: 10; /** * Symbol used between time units. * Example: 10:52 */ readonly TimeSeparator: 11; /** * Decimal separator for currency values (fallback to `Decimal`). * Example: $2,345.67 */ readonly CurrencyDecimal: 12; /** * Group separator for currency values (fallback to `Group`). * Example: $2,345.67 */ readonly CurrencyGroup: 13; }; export type NumberSymbol = (typeof NumberSymbol)[keyof typeof NumberSymbol]; /** * The value for each day of the week, based on the `en-US` locale * * @publicApi */ export declare enum WeekDay { Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6 } /** * Retrieves the locale ID from the currently loaded locale. * The loaded locale could be, for example, a global one rather than a regional one. * @param locale A locale code, such as `fr-FR`. * @returns The locale code. For example, `fr`. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleId(locale: string): string; /** * Retrieves day period strings for the given locale. * * @param locale A locale code for the locale format rules to use. * @param formStyle The required grammatical form. * @param width The required character width. * @returns An array of localized period strings. For example, `[AM, PM]` for `en-US`. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleDayPeriods(locale: string, formStyle: FormStyle, width: TranslationWidth): Readonly<[string, string]>; /** * Retrieves days of the week for the given locale, using the Gregorian calendar. * * @param locale A locale code for the locale format rules to use. * @param formStyle The required grammatical form. * @param width The required character width. * @returns An array of localized name strings. * For example,`[Sunday, Monday, ... Saturday]` for `en-US`. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleDayNames(locale: string, formStyle: FormStyle, width: TranslationWidth): ReadonlyArray; /** * Retrieves months of the year for the given locale, using the Gregorian calendar. * * @param locale A locale code for the locale format rules to use. * @param formStyle The required grammatical form. * @param width The required character width. * @returns An array of localized name strings. * For example, `[January, February, ...]` for `en-US`. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleMonthNames(locale: string, formStyle: FormStyle, width: TranslationWidth): ReadonlyArray; /** * Retrieves Gregorian-calendar eras for the given locale. * @param locale A locale code for the locale format rules to use. * @param width The required character width. * @returns An array of localized era strings. * For example, `[AD, BC]` for `en-US`. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleEraNames(locale: string, width: TranslationWidth): Readonly<[string, string]>; /** * Retrieves the first day of the week for the given locale. * * @param locale A locale code for the locale format rules to use. * @returns A day index number, using the 0-based week-day index for `en-US` * (Sunday = 0, Monday = 1, ...). * For example, for `fr-FR`, returns 1 to indicate that the first day is Monday. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleFirstDayOfWeek(locale: string): WeekDay; /** * Range of week days that are considered the week-end for the given locale. * * @param locale A locale code for the locale format rules to use. * @returns The range of day values, `[startDay, endDay]`. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleWeekEndRange(locale: string): [WeekDay, WeekDay]; /** * Retrieves a localized date-value formatting string. * * @param locale A locale code for the locale format rules to use. * @param width The format type. * @returns The localized formatting string. * @see {@link FormatWidth} * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleDateFormat(locale: string, width: FormatWidth): string; /** * Retrieves a localized time-value formatting string. * * @param locale A locale code for the locale format rules to use. * @param width The format type. * @returns The localized formatting string. * @see {@link FormatWidth} * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * @publicApi */ export declare function getLocaleTimeFormat(locale: string, width: FormatWidth): string; /** * Retrieves a localized date-time formatting string. * * @param locale A locale code for the locale format rules to use. * @param width The format type. * @returns The localized formatting string. * @see {@link FormatWidth} * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleDateTimeFormat(locale: string, width: FormatWidth): string; /** * Retrieves a localized number symbol that can be used to replace placeholders in number formats. * @param locale The locale code. * @param symbol The symbol to localize. Must be one of `NumberSymbol`. * @returns The character for the localized symbol. * @see {@link NumberSymbol} * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleNumberSymbol(locale: string, symbol: NumberSymbol): string; /** * Retrieves a number format for a given locale. * * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00` * when used to format the number 12345.678 could result in "12'345,678". That would happen if the * grouping separator for your language is an apostrophe, and the decimal separator is a comma. * * Important: The characters `.` `,` `0` `#` (and others below) are special placeholders * that stand for the decimal separator, and so on, and are NOT real characters. * You must NOT "translate" the placeholders. For example, don't change `.` to `,` even though in * your language the decimal point is written with a comma. The symbols should be replaced by the * local equivalents, using the appropriate `NumberSymbol` for your language. * * Here are the special characters used in number patterns: * * | Symbol | Meaning | * |--------|---------| * | . | Replaced automatically by the character used for the decimal point. | * | , | Replaced by the "grouping" (thousands) separator. | * | 0 | Replaced by a digit (or zero if there aren't enough digits). | * | # | Replaced by a digit (or nothing if there aren't enough). | * | ¤ | Replaced by a currency symbol, such as $ or USD. | * | % | Marks a percent format. The % symbol may change position, but must be retained. | * | E | Marks a scientific format. The E symbol may change position, but must be retained. | * | ' | Special characters used as literal characters are quoted with ASCII single quotes. | * * @param locale A locale code for the locale format rules to use. * @param type The type of numeric value to be formatted (such as `Decimal` or `Currency`.) * @returns The localized format string. * @see {@link NumberFormatStyle} * @see [CLDR website](http://cldr.unicode.org/translation/number-patterns) * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleNumberFormat(locale: string, type: NumberFormatStyle): string; /** * Retrieves the symbol used to represent the currency for the main country * corresponding to a given locale. For example, '$' for `en-US`. * * @param locale A locale code for the locale format rules to use. * @returns The localized symbol character, * or `null` if the main country cannot be determined. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleCurrencySymbol(locale: string): string | null; /** * Retrieves the name of the currency for the main country corresponding * to a given locale. For example, 'US Dollar' for `en-US`. * @param locale A locale code for the locale format rules to use. * @returns The currency name, * or `null` if the main country cannot be determined. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleCurrencyName(locale: string): string | null; /** * Retrieves the default currency code for the given locale. * * The default is defined as the first currency which is still in use. * * @param locale The code of the locale whose currency code we want. * @returns The code of the default currency for the given locale. * * @publicApi */ export declare function getLocaleCurrencyCode(locale: string): string | null; /** * @alias core/ɵgetLocalePluralCase * @publicApi */ export declare const getLocalePluralCase: (locale: string) => (value: number) => Plural; /** * Retrieves locale-specific rules used to determine which day period to use * when more than one period is defined for a locale. * * There is a rule for each defined day period. The * first rule is applied to the first day period and so on. * Fall back to AM/PM when no rules are available. * * A rule can specify a period as time range, or as a single time value. * * This functionality is only available when you have loaded the full locale data. * See the ["I18n guide"](guide/i18n-common-format-data-locale). * * @param locale A locale code for the locale format rules to use. * @returns The rules for the locale, a single time value or array of *from-time, to-time*, * or null if no periods are available. * * @see {@link getLocaleExtraDayPeriods} * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleExtraDayPeriodRules(locale: string): (Time | [Time, Time])[]; /** * Retrieves locale-specific day periods, which indicate roughly how a day is broken up * in different languages. * For example, for `en-US`, periods are morning, noon, afternoon, evening, and midnight. * * This functionality is only available when you have loaded the full locale data. * See the ["I18n guide"](guide/i18n-common-format-data-locale). * * @param locale A locale code for the locale format rules to use. * @param formStyle The required grammatical form. * @param width The required character width. * @returns The translated day-period strings. * @see {@link getLocaleExtraDayPeriodRules} * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getLocaleExtraDayPeriods(locale: string, formStyle: FormStyle, width: TranslationWidth): string[]; /** * Retrieves the writing direction of a specified locale * @param locale A locale code for the locale format rules to use. * @publicApi * @returns 'rtl' or 'ltr' * @see [Internationalization (i18n) Guide](/guide/i18n-overview) */ export declare function getLocaleDirection(locale: string): 'ltr' | 'rtl'; /** * Represents a time value with hours and minutes. * * @publicApi */ export type Time = { hours: number; minutes: number; }; /** * Retrieves the currency symbol for a given currency code. * * For example, for the default `en-US` locale, the code `USD` can * be represented by the narrow symbol `$` or the wide symbol `US$`. * * @param code The currency code. * @param format The format, `wide` or `narrow`. * @param locale A locale code for the locale format rules to use. * * @returns The symbol, or the currency code if no symbol is available. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getCurrencySymbol(code: string, format: 'wide' | 'narrow', locale?: string): string; /** * Reports the number of decimal digits for a given currency. * The value depends upon the presence of cents in that particular currency. * * @param code The currency code. * @returns The number of decimal digits, typically 0 or 2. * @see [Internationalization (i18n) Guide](/guide/i18n-overview) * * @publicApi */ export declare function getNumberOfCurrencyDigits(code: string): number;