Skip to the content

Kotoba言葉

Load only the word lists you need, mark repeated letters correctly and play a daily or seeded word game.

Kotoba is the Japanese word for words. About the name

Contents

Reference · Command line

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

NameTypeDescription
flagstring | 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"));
ja

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kotoba 1.2.0.