Fan

 

const class

sys::Locale

sys::Obj
  sys::Locale

@simple

Locale models a cultural language and region/country. See docLang::Localization for details.

Slots

countrySource

Str? country()

Get the country/region as an uppercase ISO 3166 two letter code. Return null if the country is unspecified.

currentSource

static Locale current()

Get the current thread's locale.

equalsSource

override Bool equals(Obj? obj)

Overrides sys::Obj.equals

Equality is based on the normalized toStr format.

fromStrSource

static Locale? fromStr(Str s, Bool checked := true)

Parse a locale according to the toStr format. If invalid format and checked is false return null, otherwise throw ParseErr.

getSource

Str? get(Str pod, Str key, Str? def := "key")

Resolve a localized property for the specified pod/key pair. The following rules are used for resolution:

  1. Find the pod and use its resource files
  2. Lookup via /locale/{Locale.toStr}.props
  3. Lookup via /locale/{Locale.lang}.props
  4. Lookup via /locale/en.props
  5. If all else fails return the def parameter which defaults to pod::key

Also see Pod.loc and Type.loc.

hashSource

override Int hash()

Overrides sys::Obj.hash

Compute hash code base on normalized toStr format.

langSource

Str lang()

Get the language as a lowercase ISO 639 two letter code.

setCurrentSource

static Void setCurrent(Locale locale)

Set the current thread's locale. Throw NullErr if null is passed.

toStrSource

override Str toStr()

Overrides sys::Obj.toStr

Return string representation:

<locale>  := <lang> ["-" <country>]
<lang>    := lowercase ISO 636 two letter code
<country> := uppercase ISO 3166 two letter code
useSource

This use(|Locale| func)

Run the specified function using this locale as the the actor's current locale. This method guarantees that upon return the actor current's locale remains unchanged.