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/kotoba/cli";
Definition
function cliLanguage(flag: string | undefined, env?: Record<string, string | undefined>, locale?: string): Language
Parameters
| Name | Type | Description |
|---|---|---|
flag | string | undefined | The explicit CLI language flag, if supplied. |
env (optional) | Record<string, string | undefined> | Language environment values such as LC_ALL, LC_MESSAGES and LANG. |
locale (optional) | string | undefined | The system locale used when no flag or environment 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/kotoba/cli";
console.log(cliLanguage(undefined,{LANG:"ja_JP.UTF-8"},"en-US"));jaWhat it prints (run when this page was built)