Class Locale

An ICU4X Locale, capable of representing strings like "en-US".

See the Rust documentation for Locale for more information.

Accessors

  • get basename(): string
  • Returns a string representation of the LanguageIdentifier part of Locale.

    See the Rust documentation for id for more information.

    Returns string

  • get script(): string
  • Returns a string representation of Locale script.

    See the Rust documentation for id for more information.

    Returns string

  • set script(s): void
  • Set the script part of the Locale. Pass an empty string to remove the script.

    See the Rust documentation for try_from_str for more information.

    Parameters

    • s: string

    Returns void

Methods

  • Construct an Locale from an locale identifier.

    This will run the complete locale parsing algorithm. If code size and performance are critical and the locale is of a known shape (such as aa-BB) use create_und, set_language, set_script, and set_region.

    See the Rust documentation for try_from_str for more information.

    Parameters

    • name: string

    Returns Locale

  • Normalizes a locale string.

    See the Rust documentation for normalize for more information.

    Parameters

    • s: string

    Returns string

  • Returns a string representation of the unicode extension.

    See the Rust documentation for extensions for more information.

    Parameters

    • s: string

    Returns string