Interface mozIMozIntlType

This is a set of APIs that are of general usefulness for user interface internationalization.

They're all in various stages of the standardization process through ECMA402, so they are exposed to privileged content only but are written in the way to allow for easy migration to standard Intl object once the appropriate stage of the ECMA402 is achieved.

The exact structure of the code is a little bit complex because of that:

  1. The core is in SpiderMonkey together with other Intl APIs

This allows us to write the code once, stick to the spec language of the proposal, reuse our ICU bindings in Spidermonkey and use the code to inform us on refining the spec proposal for the given API itself.

  1. The MozIntlHelper API exposes the SpiderMonkey APIs

This helper API allows attaching the new APIs on any regular object.

  1. The MozIntl API provides the access to those APIs

This API exposes the actual functionality and wraps around the MozIntlHelper lazily retrieving and setting the accessors. On top of that, the API also binds additional functionality like using current application locale by default, and fetching OS regional preferences for date time format.

Hierarchy

Properties

Collator: any
DateTimeFormat: any
DisplayNames: any
ListFormat: any
Locale: any
NumberFormat: any
PluralRules: any
RelativeTimeFormat: any

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Returns a list of locale codes for a given type. At the moment only type="region" is supported.

    Example: let codes = getAvailableLocaleDisplayNames("region"); codes === ["ar", "ae", "af", ...]

    Parameters

    • type: any

    Returns any

  • Parameters

    • locales: any

    Returns any

  • Helper for IntlUtils.webidl, will be removed once Intl.DisplayNames supports date-time types in non-privileged code.

    Parameters

    • locales: any
    • options: any

    Returns any

  • Returns a list of language names formatted for display.

    Example: let langs = getLanguageDisplayNames(["pl"], ["fr", "de", "en"]); langs === ["Francuski", "Niemiecki", "Angielski"]

    Parameters

    • locales: any
    • langCodes: any

    Returns any

  • Returns a list of locale names formatted for display.

    Example: let locs = getLocaleDisplayNames(["pl"], ["sr-RU", "es-MX", "fr-CA"]); locs === ["Serbski (Rosja)", "HiszpaƄski (Meksyk)", "Francuski (Kanada)"]

    Parameters

    • locales: any
    • localeCodes: any
    • options: any

    Returns any

  • Returns a list of region names formatted for display.

    Example: let regs = getRegionDisplayNames(["pl"], ["US", "CA", "MX"]); regs === ["Stany Zjednoczone", "Kanada", "Meksyk"]

    Parameters

    • locales: any
    • regionCodes: any

    Returns any

  • Returns the assumed script directionality for known Firefox locales. This is somewhat crude, but should work until Bug 1750781 lands.

    TODO (Bug 1750781) - Callers should use Intl.LocaleInfo once it is standardized (see Bug 1693576), rather than maintaining a hardcoded list of RTL locales.

    Parameters

    • locale: any

    Returns any

Generated using TypeDoc