YarnCldrPluralRules
Unicode CLDR plural rules (cardinal and ordinal) for the `plural` and `ordinal` markup replacement markers.
class_name YarnCldrPluralRules
extends RefCountedInherits 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) -> StringParameters
language_codeStringvaluefloat
Returns String
#get_operands(float)
Returns the CLDR operand set for a number.
static func get_operands(value: float) -> DictionaryParameters
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) -> StringParameters
language_codeStringvaluefloat
Returns String
#normalise_language(String)
Normalises a locale/language code: lowercase, region and script stripped.
static func normalise_language(language_code: String) -> StringParameters
language_codeString
Returns String
Generated from Yarn Spinner for Godot GDScript 3.3.