Gathering detailed insights and metrics for @ladjs/country-language
Gathering detailed insights and metrics for @ladjs/country-language
Gathering detailed insights and metrics for @ladjs/country-language
Gathering detailed insights and metrics for @ladjs/country-language
Query any country's spoken languages or countries where a language is spoken.
npm install @ladjs/country-language
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.7
Supply Chain
100
Quality
81.3
Maintenance
100
Vulnerability
100
License
JavaScript (99.41%)
Shell (0.59%)
Total Downloads
16,507,523
Last Day
25,588
Last Week
119,192
Last Month
521,610
Last Year
7,660,860
16 Stars
51 Commits
5 Forks
2 Watching
2 Branches
10 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.3
Package Id
@ladjs/country-language@1.0.3
Unpacked Size
242.49 kB
Size
31.09 kB
File Count
5
NPM Version
8.19.2
Node Version
16.18.1
Cumulative downloads
Total Downloads
Last day
-6.6%
25,588
Compared to previous day
Last week
-16%
119,192
Compared to previous week
Last month
5.6%
521,610
Compared to previous month
Last year
58.1%
7,660,860
Compared to previous year
Maintained fork of country-language with zero-dependencies. Query any country's spoken languages or countries where a language is spoken.
npm:
1npm install @ladjs/country-language
Once you require @ladjs/country-language
, the following API will be available.
1const CountryLanguage = require('@ladjs/country-language');
Acceptable language code type parameter values: 1, 2, 3 for returning ISO-639-1, ISO-639-2, ISO-639-3 codes respectively. If not provided, ISO-639-1 codes will be returned.
1const allLanguageCodes = CountryLanguage.getLanguageCodes(2);
Acceptable country code type parameter values: 1, 2, 3 for returning numerical code, alpha-2, alpha-3 codes respectively. If not provided, alpha-2 codes will be returned.
1const allCountryCodes = CountryLanguage.getCountryCodes(2);
Returns Boolean indicating language existance. Language code parameter can be either a ISO-639-1, ISO-639-2 or ISO-639-3 code.
1const languageExists = CountryLanguage.languageCodeExists('en');
Returns Boolean indicating country existance. Country code parameter can be either an alpha-2, alpha-3 or numerical code.
1const countryExists = CountryLanguage.countryCodeExists('GB');
Country code can be either an Alpha-2 or Alpha-3 code. The returned object includes the following info:
code_2
: Country alpha-2 code (2 letters)code_3
: Country alpha-3 code (3 letters)numCode
: Country numeric codename
: Country namelanguages
: Array of language objects for each language spoken in the countrylangCultureMs
: Array of language cultures for the country supported by Microsoft©Each language object in languages
property includes the following info:
iso639_1
: language iso639-1 code (2 letters)iso639_2
: language iso639-2 code (3 letters)iso639_2en
: language iso639-2 code with some codes derived from English names rather than native names of languages (3 letters)iso639_3
: language iso639-3 code (3 letters)name
: String array with one or more language names (in English)nativeName
: String array with one or more language names (in native language)direction
: Language script direction (either "LTR" or "RTL") - Left-to-Right, Right-to-Leftfamily
: language familycountries
: Array of country objects where this language is spokenEach Microsoft© language culture object in langCultureMs
property icludes the following info:
langCultureName
: language culture namedisplayName
: language culture dispaly namecultureCode
: language culture code1CountryLanguage.getCountry('GB', function (err, country) { 2 if (err) { 3 console.log(err); 4 } else { 5 const languagesInGB = country.languages; 6 } 7});
Language code can be either iso639-1, iso639-2, iso639-2en or iso639-3 code.
Contents of the returned language object are described in .getCountry
method.
1CountryLanguage.getLanguage('en', function (err, language) {
2 if (err) {
3 console.log(err);
4 } else {
5 const countriesSpeakingEN = language.countries;
6 }
7});
Country code can be either an Alpha-2 or Alpha-3 code. Each language object contains the following info:
iso639_1
: language iso639-1 code (2 letters)iso639_2
: language iso639-2 code with some codes derived from English names rather than native names of languages (3 letters)iso639_3
: language iso639-3 code (3 letters)1CountryLanguage.getCountryLanguages('GB', function (err, languages) { 2 if (err) { 3 console.log(err); 4 } else { 5 languages.forEach(function (languageCodes) { 6 console.log(languageCodes.iso639_1); 7 }); 8 } 9});
Language code can be either iso639-1, iso639-2, iso639-2en or iso639-3 code. Each Country object contains the following info:
code_2
: Country alpha-2 code (2 letters)code_3
: Country alpha-3 code (3 letters)numCode
: Country numeric code1CountryLanguage.getLanguageCountries('en', function (err, countries) { 2 if (err) { 3 console.log(err); 4 } else { 5 countries.forEach(function (countryCodes) { 6 console.log(countryCodes.code_3); 7 }); 8 } 9});
Country code can be either an Alpha-2 or Alpha-3 code.
Contents of each Language Culture object are described in .getCountry
method.
1CountryLanguage.getCountryMsLocales('GB', function (err, locales) { 2 if (err) { 3 console.log(err); 4 } else { 5 locales.forEach(function (locale) { 6 console.log(locale.langCultureName); 7 }); 8 } 9});
Language code can be either iso639-1, iso639-2, iso639-2en or iso639-3 code.
Contents of each Language Culture object are described in .getCountry
method.
1CountryLanguage.getLanguageMsLocales('en', function (err, locales) { 2 if (err) { 3 console.log(err); 4 } else { 5 locales.forEach(function (locale) { 6 console.log(locale.langCultureName); 7 }); 8 } 9});
Returns an array object with info for every country in the world having an ISO 3166 code.
Contents of each country object in the array is described in .getCountry
method.
1const allCountries = CountryLanguage.getCountries();
Returns an array object with info for every language in the world having an ISO 639-2 code (and a few more).
Contents of each language object in the array is described in .getCountry
method.
1const allLanguages = CountryLanguage.getLanguages();
Returns an array of strings with the names of each language family.
1const allLanguageFamilies = CountryLanguage.getLanguageFamilies();
Returns an array of strings with all locale codes. If mode ommited or false, locales with 3 parts will be returned like: az-Cyrl-AZ
1const localesSymbols = CountryLanguage.getLocales();
If mode is set to true, they will be returned like: az-AZ-Cyrl
1const localesSymbols = CountryLanguage.getLocales(true);
Returns an array object with info for every language in the world having an ISO 639-2 code (and a few more).
Contents of each language object in the array is described in .getCountry
method.
Contents of the returned language object are described in .getCountry
method.
1CountryLanguage.getLanguageFamilyMembers('Indo-European', function (err, languages) { 2 if (err) { 3 console.log(err); 4 } else { 5 languages.forEach(function (language) { 6 console.log(language.name); 7 }); 8 } 9});
For the following methods:
the cb
parameter is optional. When not provided, each method returns either an Object when there is no error, or a String in case of an error.
Any input parameter (country code, language code, language family name) is case insensitive.
Language#nativeName
string is not displayed correclty on the console for Right-to-Left (RTL) languages. However, there is no issue on string rendering (either on the browser or any text editor).
Name |
---|
titanism |
MIT © Tassos Diamantidis
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
security policy file detected
Details
Reason
Found 2/28 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-27
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