
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
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.
$ npm install os-locale
import {osLocale} from 'os-locale';
console.log(await osLocale());
//=> 'en-US'
Returns a Promise for the locale.
Returns the locale.
Type: object
Type: boolean
Default: true
Set to false to avoid spawning subprocesses and instead only resolve the locale from environment variables.
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.
The system-locale package also provides functionality to detect the system's locale. It is similar to os-locale but does not offer a synchronous method, which might make os-locale preferable in scenarios where immediate locale detection is necessary without the complexities of asynchronous code.
Locale2 is another npm package that can be used to get the user's locale. Unlike os-locale, locale2 also tries to detect the locale from the browser environment when used in web contexts, making it a more versatile choice for projects that span both node and browser environments.
FAQs
Get the system locale
The npm package os-locale receives a total of 6,469,018 weekly downloads. As such, os-locale popularity was classified as popular.
We found that os-locale demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.