Show raw api
{
"functions": [
{
"name": "toCommonwealthSpelling",
"desc": "`text` in Commonwealth English spelling: metre for meter, litre for liter, tonne for metric ton.",
"params": [
{
"name": "text",
"desc": "",
"lua_type": "string"
}
],
"returns": [
{
"desc": "",
"lua_type": "string"
}
],
"function_type": "static",
"source": {
"line": 134,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "hasLocale",
"desc": "Whether a locale has its own unit names here, directly or through a locale of the same language.",
"params": [
{
"name": "locale",
"desc": "",
"lua_type": "string?"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "static",
"source": {
"line": 218,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "getLocale",
"desc": "Returns the read-only [UnitLocale] for a locale, defaulting to American English. Warns once per unknown locale.",
"params": [
{
"name": "locale",
"desc": "",
"lua_type": "string?"
}
],
"returns": [
{
"desc": "",
"lua_type": "UnitLocale"
}
],
"function_type": "static",
"source": {
"line": 228,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "getUnitNames",
"desc": "The [UnitNames] of `unit` in a locale: the locale's own, or, for a unit a game's own [MetricUnitSystem] declares,\nits English names and symbol from its definition.",
"params": [
{
"name": "locale",
"desc": "",
"lua_type": "string?"
},
{
"name": "unit",
"desc": "",
"lua_type": "UnitDefinition"
}
],
"returns": [
{
"desc": "",
"lua_type": "UnitNames"
}
],
"function_type": "static",
"source": {
"line": 256,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "getUnitStringsForLocale",
"desc": "Returns the read-only [UnitStrings] for a locale, defaulting to American English. Each unit's names are built the\nfirst time they are read.",
"params": [
{
"name": "locale",
"desc": "",
"lua_type": "string?"
}
],
"returns": [
{
"desc": "",
"lua_type": "UnitStrings"
}
],
"function_type": "static",
"source": {
"line": 275,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "getPerStringsForLocale",
"desc": "Returns the read-only [PerStrings] for a locale, defaulting to American English.",
"params": [
{
"name": "locale",
"desc": "",
"lua_type": "string?"
}
],
"returns": [
{
"desc": "",
"lua_type": "PerStrings"
}
],
"function_type": "static",
"source": {
"line": 285,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
}
],
"properties": [],
"types": [
{
"name": "UnitPhrase",
"desc": "A unit phrase with `%s` for the already formatted number: a singular and plural pair, or a function of the\nrounded amount and the formatted number for languages with more plural forms.",
"lua_type": "{ one: string, other: string } | (amount: number, numberText: string) -> string",
"source": {
"line": 30,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "UnitNames",
"desc": "The short and long phrase for one unit, such as `\"%s km\"` and `\"%s kilometers\"`.",
"fields": [
{
"name": "short",
"lua_type": "UnitPhrase",
"desc": ""
},
{
"name": "long",
"lua_type": "UnitPhrase",
"desc": ""
}
],
"source": {
"line": 40,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "UnitStrings",
"desc": "[UnitNames] for every unit written by name, keyed by unit id: every unit [MetricUnitDefinitions] gives `names`. Time\nunits are written with [TimeLocalizationUtils]' duration words instead, and bare rates with [PerStrings].",
"lua_type": "{ [UnitId]: UnitNames }",
"source": {
"line": 49,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "PerNames",
"desc": "How to write something per a time unit, with `%s` for the numerator already written: `\"%s/h\"` and\n`\"%s per hour\"`.",
"fields": [
{
"name": "short",
"lua_type": "string",
"desc": ""
},
{
"name": "long",
"lua_type": "string",
"desc": ""
}
],
"source": {
"line": 60,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "PerStrings",
"desc": "[PerNames] for every time unit a rate can be written per.",
"fields": [
{
"name": "second",
"lua_type": "PerNames",
"desc": ""
},
{
"name": "minute",
"lua_type": "PerNames",
"desc": ""
},
{
"name": "hour",
"lua_type": "PerNames",
"desc": ""
},
{
"name": "day",
"lua_type": "PerNames",
"desc": ""
},
{
"name": "week",
"lua_type": "PerNames",
"desc": ""
},
{
"name": "month",
"lua_type": "PerNames",
"desc": ""
},
{
"name": "year",
"lua_type": "PerNames",
"desc": ""
}
],
"source": {
"line": 75,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "UnitStringOverrides",
"desc": "Unit phrases a caller passes to override a locale's, keyed by unit id: `{ kilometer = { short = \"%s klicks\" } }`.",
"lua_type": "{ [string]: { short: UnitPhrase?, long: UnitPhrase? } }",
"source": {
"line": 91,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "PerStringOverrides",
"desc": "Per phrases a caller passes to override a locale's, keyed by time unit id.",
"lua_type": "{ [string]: { short: string?, long: string? } }",
"source": {
"line": 99,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
},
{
"name": "UnitLocale",
"desc": "Everything one locale needs.",
"fields": [
{
"name": "units",
"lua_type": "UnitStrings",
"desc": ""
},
{
"name": "per",
"lua_type": "PerStrings",
"desc": ""
}
],
"source": {
"line": 109,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
}
],
"name": "MetricUnitFallbackStrings",
"desc": "English unit names for [MetricUnitFormatUtils] when no translator is given. They need no translator, so specs,\nservers and anything formatting before a translator loads always get readable text. Translated names stream to clients through [MetricUnitTranslator], a\n`JSONTranslator` holding the same keys.\n\nLookups resolve through [ResolveLocaleUtils], so `en-us` lands on American English and `en-au` on Commonwealth\nEnglish. Without a translator, short phrases are the symbols in [MetricUnitDefinitions]; with one, they are the player's language's\n(`5 км`, `5公里`). A no-break space joins a number to its unit either way.",
"source": {
"line": 13,
"path": "src/metricutils/src/Shared/Localization/MetricUnitFallbackStrings.lua"
}
}