Skip to content

locale ​

locale returns the current locale tag (e.g. "en-US", "pt-BR").

Signaturelocale(): string
tyrus
import { locale } from "tyrus:os";

const currentLocale: string = locale();
print(currentLocale); // e.g. "en-US"

Never fails the program

Falls back to "und", the standard "undetermined locale" subtag, if the OS-reported locale cannot be read, rather than aborting the program.

See also language, which returns just the leading language subtag.