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
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1 Stars
102 Commits
7 Forks
10 Watching
18 Branches
172 Contributors
Updated on 19 Nov 2024
TypeScript (98.51%)
JavaScript (1.49%)
Cumulative downloads
Total Downloads
Last day
-28.9%
54
Compared to previous day
Last week
-20%
248
Compared to previous week
Last month
7,111.8%
1,226
Compared to previous month
Last year
-13%
2,726
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
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
all changesets reviewed
Reason
license file detected
Details
Reason
8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
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
10 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
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