Reference · Rolls and exact odds
cliLanguagefunction
The language the command line speaks: --lang, or the environment's, or the system's; Japanese for ja…, English for anything else.
Import it
import { cliLanguage } from "@johnmorrisdotca/korokoro";
Definition
function cliLanguage(flag: string | undefined, env?: Record<string, string | undefined>, locale?: string): Language
Parameters
| Name | Type | Description |
|---|---|---|
flag | string | undefined | Explicit language flag, when supplied. |
env (optional) | Record<string, string | undefined> | Environment variables used to choose the language. |
locale (optional) | string | undefined | Locale to use when no explicit language is supplied. |
Returns
Language
The language the command line speaks: --lang, or the environment's, or the system's; Japanese for ja…, English for anything else.
Examples
import { cliLanguage } from "@johnmorrisdotca/korokoro";
console.log(cliLanguage(undefined, { LANG: "ja_JP.UTF-8" }));jaWhat it prints (run when this page was built)