Gathering detailed insights and metrics for @tradeshift/g11n-langneg
Gathering detailed insights and metrics for @tradeshift/g11n-langneg
Gathering detailed insights and metrics for @tradeshift/g11n-langneg
Gathering detailed insights and metrics for @tradeshift/g11n-langneg
npm install @tradeshift/g11n-langneg
Typescript
Module System
Node Version
NPM Version
TypeScript (98.51%)
JavaScript (1.49%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1 Stars
102 Commits
7 Forks
7 Watchers
18 Branches
114 Contributors
Updated on Nov 19, 2024
Latest Version
1.3.2
Package Id
@tradeshift/g11n-langneg@1.3.2
Unpacked Size
69.52 kB
Size
17.26 kB
File Count
40
NPM Version
8.19.4
Node Version
16.20.2
Published on
Oct 31, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Language negotiation helpers
1import { Locale, match } from "@tradeshift/g11n-langneg"; 2 3const result: Locale = match("pt-Latn-BR", ["da", "en", "es", "pt"]); 4// result == Locale.parse('pt')` 5 6// also accepts `Locale` objects as inputs 7const result2: Locale = match(Locale.parse("pt-Latn-BR"), [ 8 Locale.parse("da"), 9 Locale.parse("pt"), 10]); 11// result2 == Locale.parse('pt')`
If there's no match, it will return the first candidate in the list, so the first element should always be your preferred/default locale.
1const result: Locale = match("pt", ["en", "da", "es"]); 2// result == Locale.parse('en')`
1import { Locale } from "@tradeshift/g11n-langneg"; 2 3// lenient parsing of locales, invalid locales will parse to `und` 4const locale: Locale = Locale.parse("pt-BR"); 5 6// strict parsing of locales will throw errors for invalid locales 7try { 8 const invalid = Locale.parseStrict("abcdefghijklmnopq"); 9} catch (e) { 10 throw e; 11}
Note: g11n-langneg uses a small subset of the likely subtags CLDR data
1const locale: Locale = Locale.parse("pt-BR"); 2const maximized: Locale = locale.maximize(); // equivalent to 'pt-Latn-BR'
1const locale: Locale = Locale.parse("pt-Latn-BR"); 2 3const language: string = locale.getLanguage(); // pt 4const script: string = locale.getScript(); // Latn 5const region: string = locale.getRegion(); // BR 6 7const ptCyrl: Locale = locale.setScript("Cyrl"); // pt-Cyrl-BR 8const ptPT: Locale = locale.setRegion("PT"); // pt-Latn-PT
Semantic release: (Commit conventions)
No new version will be released unless specific commit message is used. See Commit conventions for details. If a release is expected, please fix commit messages to align with appropriate format
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More