Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fluent/langneg

Package Overview
Dependencies
Maintainers
6
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluent/langneg - npm Package Compare versions

Comparing version 0.5.2 to 0.6.0

esm/package.json

11

CHANGELOG.md
# Changelog
## @fluent/langneg 0.6.0 (September 13, 2021)
- Remove `"type": "commonjs"` from the package's root `package.json`, but add
`"type": "module"` to the `esm/` directory.
([#556](https://github.com/projectfluent/fluent.js/pull/556),
[#567](https://github.com/projectfluent/fluent.js/pull/567))
- Set Node.js 12 as the minimum supported version
([#557](https://github.com/projectfluent/fluent.js/pull/557))
- Remove circular dependency
([#545](https://github.com/projectfluent/fluent.js/pull/545))
## @fluent/langneg 0.5.2 (April 17, 2021)

@@ -4,0 +15,0 @@

61

esm/locale.js
/* eslint no-magic-numbers: 0 */
import { getLikelySubtagsMin } from "./subtags";
const languageCodeRe = "([a-z]{2,3}|\\*)";

@@ -92,1 +91,61 @@ const scriptCodeRe = "(?:-([a-z]{4}|\\*))";

}
/**
* Below is a manually a list of likely subtags corresponding to Unicode
* CLDR likelySubtags list.
* This list is curated by the maintainers of Project Fluent and is
* intended to be used in place of the full likelySubtags list in use cases
* where full list cannot be (for example, due to the size).
*
* This version of the list is based on CLDR 30.0.3.
*/
const likelySubtagsMin = {
"ar": "ar-arab-eg",
"az-arab": "az-arab-ir",
"az-ir": "az-arab-ir",
"be": "be-cyrl-by",
"da": "da-latn-dk",
"el": "el-grek-gr",
"en": "en-latn-us",
"fa": "fa-arab-ir",
"ja": "ja-jpan-jp",
"ko": "ko-kore-kr",
"pt": "pt-latn-br",
"sr": "sr-cyrl-rs",
"sr-ru": "sr-latn-ru",
"sv": "sv-latn-se",
"ta": "ta-taml-in",
"uk": "uk-cyrl-ua",
"zh": "zh-hans-cn",
"zh-hant": "zh-hant-tw",
"zh-hk": "zh-hant-hk",
"zh-gb": "zh-hant-gb",
"zh-us": "zh-hant-us",
};
const regionMatchingLangs = [
"az",
"bg",
"cs",
"de",
"es",
"fi",
"fr",
"hu",
"it",
"lt",
"lv",
"nl",
"pl",
"ro",
"ru",
];
function getLikelySubtagsMin(loc) {
if (Object.prototype.hasOwnProperty.call(likelySubtagsMin, loc)) {
return new Locale(likelySubtagsMin[loc]);
}
const locale = new Locale(loc);
if (locale.language && regionMatchingLangs.includes(locale.language)) {
locale.region = locale.language.toUpperCase();
return locale;
}
return null;
}

2

esm/matches.js
/* eslint no-magic-numbers: 0 */
import { Locale } from "./locale";
import { Locale } from "./locale.js";
/**

@@ -4,0 +4,0 @@ * Negotiates the languages between the list of requested locales against

@@ -1,2 +0,2 @@

import { filterMatches } from "./matches";
import { filterMatches } from "./matches.js";
/**

@@ -3,0 +3,0 @@ * Negotiates the languages between the list of requested locales against

@@ -1,2 +0,2 @@

/* @fluent/langneg@0.5.2 */
/* @fluent/langneg@0.6.0 */
(function (global, factory) {

@@ -8,63 +8,2 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

/**
* Below is a manually a list of likely subtags corresponding to Unicode
* CLDR likelySubtags list.
* This list is curated by the maintainers of Project Fluent and is
* intended to be used in place of the full likelySubtags list in use cases
* where full list cannot be (for example, due to the size).
*
* This version of the list is based on CLDR 30.0.3.
*/
const likelySubtagsMin = {
"ar": "ar-arab-eg",
"az-arab": "az-arab-ir",
"az-ir": "az-arab-ir",
"be": "be-cyrl-by",
"da": "da-latn-dk",
"el": "el-grek-gr",
"en": "en-latn-us",
"fa": "fa-arab-ir",
"ja": "ja-jpan-jp",
"ko": "ko-kore-kr",
"pt": "pt-latn-br",
"sr": "sr-cyrl-rs",
"sr-ru": "sr-latn-ru",
"sv": "sv-latn-se",
"ta": "ta-taml-in",
"uk": "uk-cyrl-ua",
"zh": "zh-hans-cn",
"zh-hant": "zh-hant-tw",
"zh-hk": "zh-hant-hk",
"zh-gb": "zh-hant-gb",
"zh-us": "zh-hant-us",
};
const regionMatchingLangs = [
"az",
"bg",
"cs",
"de",
"es",
"fi",
"fr",
"hu",
"it",
"lt",
"lv",
"nl",
"pl",
"ro",
"ru",
];
function getLikelySubtagsMin(loc) {
if (Object.prototype.hasOwnProperty.call(likelySubtagsMin, loc)) {
return new Locale(likelySubtagsMin[loc]);
}
const locale = new Locale(loc);
if (locale.language && regionMatchingLangs.includes(locale.language)) {
locale.region = locale.language.toUpperCase();
return locale;
}
return null;
}
/* eslint no-magic-numbers: 0 */

@@ -160,2 +99,62 @@ const languageCodeRe = "([a-z]{2,3}|\\*)";

}
/**
* Below is a manually a list of likely subtags corresponding to Unicode
* CLDR likelySubtags list.
* This list is curated by the maintainers of Project Fluent and is
* intended to be used in place of the full likelySubtags list in use cases
* where full list cannot be (for example, due to the size).
*
* This version of the list is based on CLDR 30.0.3.
*/
const likelySubtagsMin = {
"ar": "ar-arab-eg",
"az-arab": "az-arab-ir",
"az-ir": "az-arab-ir",
"be": "be-cyrl-by",
"da": "da-latn-dk",
"el": "el-grek-gr",
"en": "en-latn-us",
"fa": "fa-arab-ir",
"ja": "ja-jpan-jp",
"ko": "ko-kore-kr",
"pt": "pt-latn-br",
"sr": "sr-cyrl-rs",
"sr-ru": "sr-latn-ru",
"sv": "sv-latn-se",
"ta": "ta-taml-in",
"uk": "uk-cyrl-ua",
"zh": "zh-hans-cn",
"zh-hant": "zh-hant-tw",
"zh-hk": "zh-hant-hk",
"zh-gb": "zh-hant-gb",
"zh-us": "zh-hant-us",
};
const regionMatchingLangs = [
"az",
"bg",
"cs",
"de",
"es",
"fi",
"fr",
"hu",
"it",
"lt",
"lv",
"nl",
"pl",
"ro",
"ru",
];
function getLikelySubtagsMin(loc) {
if (Object.prototype.hasOwnProperty.call(likelySubtagsMin, loc)) {
return new Locale(likelySubtagsMin[loc]);
}
const locale = new Locale(loc);
if (locale.language && regionMatchingLangs.includes(locale.language)) {
locale.region = locale.language.toUpperCase();
return locale;
}
return null;
}

@@ -162,0 +161,0 @@ /* eslint no-magic-numbers: 0 */

{
"name": "@fluent/langneg",
"description": "Language Negotiation API for Fluent",
"version": "0.5.2",
"version": "0.6.0",
"homepage": "https://projectfluent.org",

@@ -18,3 +18,2 @@ "author": "Mozilla <l10n-drivers@mozilla.org>",

],
"type": "commonjs",
"main": "./index.js",

@@ -36,5 +35,12 @@ "module": "./esm/index.js",

],
"scripts": {
"build": "tsc",
"postbuild": "rollup -c ../rollup.config.mjs",
"docs": "typedoc --options ../typedoc.config.cjs",
"test": "mocha 'test/*_test.js'"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0",
"npm": ">=7.0.0"
}
}

@@ -1,2 +0,2 @@

# @fluent/langneg ![](https://github.com/projectfluent/fluent.js/workflows/@fluent/langneg/badge.svg)
# @fluent/langneg ![](https://github.com/projectfluent/fluent.js/workflows/test/badge.svg)

@@ -3,0 +3,0 @@ `@fluent/langneg` provides an API for negotiating languages. It's part of

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc