icu
    Preparing search index...

    Class Locale

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

    See the Rust documentation for Locale for more information.

    Index
    • 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

    • Adds a variant to the Locale.

      Returns an error if the variant string is invalid. Returns true if the variant was added, false if already present.

      See the Rust documentation for push for more information.

      Parameters

      • s: string

      Returns boolean

    • Returns a string representation of the unicode extension.

      See the Rust documentation for extensions for more information.

      Parameters

      • s: string

      Returns string | null

    • Removes a variant from the Locale.

      Returns true if the variant was removed, false if not present. Returns false for invalid variant strings (they cannot exist in the locale).

      See the Rust documentation for remove for more information.

      Parameters

      • s: string

      Returns boolean

    • Returns the variant at the given index, or nothing if the index is out of bounds.

      See the Rust documentation for Variants for more information.

      Parameters

      • index: number

      Returns string | null