
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
iso-languages
Advanced tools
Helpers for manipuling RFC4646 locales. Purpose is to have for each locale, the ISO639, ISO3166, ISO15924 and m49 references associated.
Helpers for manipuling RFC4646 locales. Purpose is to have for each locale, the ISO639, ISO3166, ISO15924 and m49 references associated.
npm install iso-locales
This library manages a collection of ISOLocale/s, completed with differents sources (see dependencies below). The main index is coming from: https://github.com/TiagoDanin/Windows-Locale
interface ISOLocale {
tag: string;
tag_bcp47?: BCP47Data;
lcid: number;
lcid_parts: LCIDParts;
language: string; // UI Friendly name (EN)
language_local?: string; // UI Native name
language_iso639?: ISO639Data;
region?: string; // UI Friendly name (EN)
region_iso3166?: ISO3166Data;
script?: string;
script_iso15924?: ISO15924Data;
}
// return all locales
function getLocales(): ISOLocale[];
You can search for a locale:
function findByLanguage(text: string): ISOLocale | null;
function findByLanguageLocal(text: string): ISOLocale | null;
function findByRegion(text: string): ISOLocale | null;
function findByTag(text: string): ISOLocale | null;
function findByLCID(id: number): ISOLocale | null;
...
A language ID is a 16 bit value which is the combination of a primary language ID and a secondary language ID. The bits are allocated as follows:
+-----------------------+-------------------------+
| Sublanguage ID | Primary Language ID |
+-----------------------+-------------------------+
15 10 9 0 bit
A locale ID (LCID) is a 32 bit value which is the combination of a language ID, a sort ID, and a reserved area. The bits are allocated as follows:
+-------------+---------+-------------------------+
| Reserved | Sort ID | Language ID |
+-------------+---------+-------------------------+
31 20 19 16 15 0 bit
interface LCIDParts {
language: number;
primary: number;
sub: number;
sort: number;
}
const SUBLANG_NEUTRAL = 0x00;
const SUBLANG_DEFAULT = 0x01;
const SORT_DEFAULT = 0x00;
function parse(lcid: number): LCIDParts;
langtag = language
["-" script]
["-" region]
*("-" variant)
*("-" extension)
["-" privateuse]
interface ISO639Data {
name: string;
name_local: string;
'1-alpha2': string; // ISO639.1 alpha-2
'2-alpha3': string; // ISO639.2 alpha-3
'2T-alpha3'?: string; // ISO639.2 alpha-3 Terminology
'2B-alpha3'?: string; // ISO639.2 alpha-3 Bibliographic
'3-alpha3': string; // ISO639.3 alpha-3 (OBSOLETE)
}
function getList(): ISO639Data[];
function find(text: string): ISO639Data | null;
interface ISO15924Data {
name: string; // Script name
code: string; // alpha4 ISO 15924 code
numeric: string; // num3 ISO 15924 code
pva: string; // Property Value Alias
date: string; // Date of addition
}
function getList(): ISO15924Data[];
function find(text: string): ISO15924Data | null;
interface ISO3166Data {
name_en: string;
'1-alpha2': string; // ISO3166.1 alpha-2
'1-alpha3': string; // ISO3166.1 alpha-3
'1-num3': number; // ISO3166.1 numeric-3 M49
'1-num3-m49'?: UNM49Data;
}
function getList(): ISO3166Data[];
function find(text: string): ISO3166Data | null;
enum UNM49Type {
Global = 0, // (example: 001 World)
Region = 1, // (example: 002 Africa)
Subregion = 2, // (example: 202 Sub-Saharan Africa)
Intermediate = 3, // region (example: 017 Middle Africa)
Country = 4, // or area (example: 024 Angola)
}
interface UNM49Data {
type: UNM49Type; // Script name
code: string; // num3 ISO 15924 code
parent?: string; // Property Value Alias
}
function getList(): ISO3166Data[];
function find(text: string): ISO3166Data | null;
Copyright (c) 2020 Emmanuel Kimmerlin
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Helpers for manipuling RFC4646 locales. Purpose is to have for each locale, the ISO639, ISO3166, ISO15924 and m49 references associated.
We found that iso-languages demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.