os-locale

  • Version 6.0.1
  • Published
  • 8.11 kB
  • 1 dependency
  • MIT license

Install

npm i os-locale
yarn add os-locale
pnpm add os-locale

Overview

Get the system locale

Index

Functions

function osLocale

osLocale: (options?: Options) => Promise<string>;
  • Get the system [locale](https://en.wikipedia.org/wiki/Locale_(computer_software)).

    Returns

    The locale.

    Example 1

    import {osLocale} from 'os-locale';
    console.log(await osLocale());
    //=> 'en-US'

function osLocaleSync

osLocaleSync: (options?: Options) => string;
  • Synchronously get the system [locale](https://en.wikipedia.org/wiki/Locale_(computer_software)).

    Returns

    The locale.

    Example 1

    import {osLocaleSync} from 'os-locale';
    console.log(osLocaleSync());
    //=> 'en-US'

Interfaces

interface Options

interface Options {}

    property spawn

    readonly spawn?: boolean;
    • Set to false to avoid spawning subprocesses and instead only resolve the locale from environment variables.

      true

    Package Files (1)

    Dependencies (1)

    Dev Dependencies (4)

    Peer Dependencies (0)

    No peer dependencies.

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/os-locale.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/os-locale)
    • HTML
      <a href="https://www.jsdocs.io/package/os-locale"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>