npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

os-locale

8.0.0

@sindresorhus

npmHomeRepoSnykSocket
Downloads:25017677
$ npm install os-locale
DailyWeeklyMonthlyYearly

os-locale

Get the system locale

[!NOTE] You may want new Intl.DateTimeFormat().resolvedOptions().locale instead. This package is useful for CLI tools as it also reads locale from environment variables (LC_ALL, LC_MESSAGES, LANG, LANGUAGE), which the Intl API does not fully support (it only respects LC_ALL).

Useful for localizing your module or app.

POSIX systems: The returned locale refers to the LC_MESSAGES category, suitable for selecting the language used in the user interface for message translation.

Install

npm install os-locale

Usage

import osLocale from 'os-locale';

console.log(osLocale());
//=> 'en-US'

API

osLocale()

Returns the locale.