You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

os-locale

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

os-locale

Get the system locale


Version published
Weekly downloads
5.8M
decreased by-5.72%
Maintainers
3
Install size
23.0 kB
Created
Weekly downloads
 

Package description

What is os-locale?

The os-locale npm package is a utility for getting the system locale information. It is primarily used to determine the locale setting of the operating system where the Node.js application is running. This can be useful for applications that need to perform locale-specific operations, such as formatting dates, numbers, or strings according to the user's regional settings.

What are os-locale's main functionalities?

Get system locale

This feature allows you to asynchronously retrieve the system's current locale setting. The locale is returned as a string, such as 'en-US' for English (United States).

const osLocale = require('os-locale');
osLocale().then(locale => {
  console.log(locale);
});

Get system locale synchronously

This feature provides a synchronous method to get the system locale. This can be useful in scenarios where asynchronous execution may not be ideal.

const osLocale = require('os-locale');
const locale = osLocale.sync();
console.log(locale);

Other packages similar to os-locale

Readme

Source

os-locale

Get the system locale

Useful for localizing your module or app.

POSIX systems: The returned locale refers to the LC_MESSAGE 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(await osLocale());
//=> 'en-US'

API

osLocale(options?)

Returns a Promise for the locale.

osLocaleSync(options?)

Returns the locale.

options

Type: object

spawn

Type: boolean
Default: true

Set to false to avoid spawning subprocesses and instead only resolve the locale from environment variables.

os-locale for enterprise

Available as part of the Tidelift Subscription.

The maintainers of os-locale and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Keywords

FAQs

Package last updated on 23 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc