Class Locale

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

See the Rust documentation for Locale for more information.

Constructors

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 ffiValue(): number
  • Returns number

  • get language(): string
  • Returns a string representation of [Locale] language.

    See the Rust documentation for id for more information.

    Returns string

  • set language(s): void
  • Set the language part of the [Locale].

    See the Rust documentation for try_from_str for more information.

    Parameters

    • s: string

    Returns void

  • get region(): string
  • Returns a string representation of [Locale] region.

    See the Rust documentation for id for more information.

    Returns string

  • set region(s): void
  • Set the region part of the [Locale].

    See the Rust documentation for try_from_str for more information.

    Parameters

    • s: string

    Returns void

  • 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

  • Returns a string representation of the unicode extension.

    See the Rust documentation for extensions for more information.

    Parameters

    • s: string

    Returns string

  • Returns a string representation of [Locale].

    See the Rust documentation for write_to for more information.

    Returns string

  • 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

""