Repository navigation
API Variable Locale
const Locale: object;Defined in: src/engine/localisation/Locale.ts:254
Localised text and formatting (ADR 0356 §6). Locale.t("menu.start") is the message in the current language, the key
itself (with one warning) when no language of its chain has it; Locale.setLanguage("fr") switches every text.
get direction(): "ltr" | "rtl";The current language's text direction.
"ltr" | "rtl"
get epoch(): number;Rises whenever resolved text can change: a language switch, a table edit in the editor, hot reload.
number
get language(): string;The current text language.
string
get languages(): readonly LocaleLanguage[];The shipped languages, in project.json's order.
readonly LocaleLanguage[]
get pendingLanguage(): string | null;The language a switch in progress is loading, else null.
string | null
debug(): LocaleDebug;The current and pending language and the keys that fell back or were missing lately (the profiler, tests).
LocaleDebug
format(message, args?): string;An ICU message written at runtime (mod data, a server's text), formatted in the current language.
string
Readonly<Record<string, MessageArg>>
string
formatDate(value, options?): string;number | Date
DateTimeFormatOptions
string
formatList(items, options?): string;readonly string[]
ListFormatOptions
string
formatNumber(value, options?): string;number | bigint
NumberFormatOptions
string
formatRelativeTime(
value,
unit,
options?
): string;number
RelativeTimeFormatUnit
RelativeTimeFormatOptions
string
has(key): boolean;True when a language of the current chain has a message for key.
string
boolean
onChange(fn): () => void;Call fn after every language change; returns the unsubscribe function.
(e) => void
() => void
setLanguage(code): Promise<void>;Switch to a shipped language: its strings and fonts load first, then language, epoch and the onChange
listeners change together, and the choice is remembered for the next start (when the project remembers it). An
unknown or unshipped code rejects with one warning and changes nothing; a later switch supersedes this one (which
then resolves without switching). Switching to the current language changes nothing and calls no listener (it still
supersedes a pending switch, and is remembered).
string
Promise<void>
t(key, args?): string;The message of key in the current language, with args; the key itself (warned once) when it is missing.
string
Readonly<Record<string, MessageArg>>
string
text(key, args?): LocalText;key and args as a LocalText, which resolves in whatever language is current when it is read.
string
Readonly<Record<string, MessageArg>>
This wiki is generated from docs/wiki/ and the myco module's source on every push to master. Change pages there in a pull request: edits made here are not kept.
Basics
Gameplay
Rendering
Audio
- Playing sound
- Why is there no sound?
- Playlists
- Interactive music
- Sound generators
- Spatial audio
- Audio mixer
- Live mixing
- Loudness
- Audio profiler
- Audio takes
Reference