[][src]Module locale_types::string

The LocaleString type provides the a structure for locale identifier strings.

Standards

On POSIX platforms such as Unix, Linux and others, locale identifiers are defined by ISO/IEC 15897, which is similar to the BCP 47 definition of language tags, but the locale variant modifier is defined differently, and the character set is included as a part of the identifier.

Locale identifiers are defined in this format: [language[_territory][.codeset][@modifier]]. For example, Australian English using the UTF-8 encoding is en_AU.UTF-8.

  • language = ISO 639-1 2-character language codes.
  • territory = ISO 3166-1 2-character country codes.
  • codeset = an undefined string value, [a-zA-Z0-9_\-]+.
    • For example, IEC 8859 parts 1 to 16 are usually specified as ISO8859-1 and so on.
    • should be taken from the values in the IANA character sets list.
  • modifier = a semi-colon separated list of identifiers, or name '=' value pairs.
    • Sometimes this is used to indicate the language script in use, as such values from ISO 15924 should be used.

See also:

Structs

LocaleString

A LocaleString is a representation of the POSIX notion of a Locale identifier, used in operating system calls and environment variables. It implements the LocaleIdentifier trait.

Enums

ParseError

Errors possibly returned from from_str().