Socket
Socket
Sign inDemoInstall

@houlagins/locale

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @houlagins/locale

Locale resolving service


Version published
Weekly downloads
5
increased by400%
Maintainers
1
Install size
815 kB
Created
Weekly downloads
 

Readme

Source

sidebarDepth: 2

Locale Service

Description

Resolves the Locale from as a lowercase 2 letter code:

  1. HTML 5 Locale
<html lang="en"> 
  1. Legacy HTML meta tag
<meta http-equiv="content-language" content="en">
  1. Legacy Browsers
navigator.languages[0] || navigator.userLanguage || navigator.language || navigator.browserLanguage 
  1. Browser
(new Intl.NumberFormat()).resolvedOptions().locale

Install

yarn add @houlagins/locale

#OR 

npm install @houlagins/locale

API

getLocale

import { getLocale } from '@houlagins/locale'

const locale = getLocale()

console.log(locale)

getUnLocale

Returns one of the 6 UN languages or default en.

//[ 'ar', 'en', 'es', 'fr', 'ru', 'zh' ]
import { getUnLocale } from '@houlagins/locale'

const locale = getUnLocale()

console.log(locale)

FAQs

Last updated on 30 Sep 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc