Pardon our dust! Docs for Yarn Spinner for Unity 3.2 and Yarn Spinner for Godot C# are on docs.yarnspinner.dev (the old docs site). Docs for Yarn Spinner for Unity 3.3 (pre-release, out ASAP), Yarn Spinner for Godot GDScript and Yarn Spinner for Unreal Engine (work in progress) are on /docs/ (the new docs site).

YarnCldrPluralRules

Unicode CLDR plural rules (cardinal and ordinal) for the `plural` and `ordinal` markup replacement markers.
class_name YarnCldrPluralRules
extends RefCounted

Inherits from RefCounted

Each locale resolves to one of six plural cases: "zero", "one", "two", "few", "many", or "other". "other" is the only case guaranteed to exist for every locale, and is also the fallback for locales this file doesn't know about. CLDR rules are written in terms of a handful of operands derived from the number being pluralised: n - the absolute value of the number i - the integer digits of n v - the number of visible fraction digits, with trailing zeros f - the visible fraction digits, with trailing zeros, as an integer t - the visible fraction digits, without trailing zeros, as an integer LIMITATION: a Godot float carries no record of how it was authored, so trailing zeros in the fraction (e.g. whether a value was written as "1.50" or "1.5") can never be recovered. This implementation derives the fraction operands from the number's shortest round-trip invariant string, as the reference implementation does, which makes v and w (fraction digits without trailing zeros) identical, and likewise f and t identical.

#Methods

#get_cardinal_case(String, float)

Returns the CLDR cardinal plural case ("zero", "one", "two", "few", "many", or "other") for the given language and number.
static func get_cardinal_case(language_code: String, value: float) -> String

Parameters

  • language_codeString
  • valuefloat

Returns String

#get_operands(float)

Returns the CLDR operand set for a number.
static func get_operands(value: float) -> Dictionary

Parameters

  • valuefloat

Returns Dictionary

#get_ordinal_case(String, float)

Returns the CLDR ordinal plural case ("zero", "one", "two", "few", "many", or "other") for the given language and number.
static func get_ordinal_case(language_code: String, value: float) -> String

Parameters

  • language_codeString
  • valuefloat

Returns String

#normalise_language(String)

Normalises a locale/language code: lowercase, region and script stripped.
static func normalise_language(language_code: String) -> String

Parameters

  • language_codeString

Returns String

Generated from Yarn Spinner for Godot GDScript 3.3.