Skip to content

language ​

language returns the current locale's language subtag (e.g. "en", "pt"), the leading part of locale's full tag.

Signaturelanguage(): string
tyrus
import { language } from "tyrus:os";

const currentLanguage: string = language();
print(currentLanguage); // e.g. "en"

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.