{"id":18926790,"url":"https://github.com/ladjs/country-language","last_synced_at":"2025-04-15T13:33:23.482Z","repository":{"id":47448127,"uuid":"510206371","full_name":"ladjs/country-language","owner":"ladjs","description":"Query any country's spoken languages or countries where a language is spoken.","archived":false,"fork":false,"pushed_at":"2023-11-28T16:56:21.000Z","size":165,"stargazers_count":16,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T02:01:53.756Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ladjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-04T04:03:52.000Z","updated_at":"2024-11-14T07:49:16.000Z","dependencies_parsed_at":"2024-06-18T16:54:21.459Z","dependency_job_id":"13c288ae-9a21-4564-a3b7-9b77196d2da4","html_url":"https://github.com/ladjs/country-language","commit_stats":{"total_commits":47,"total_committers":7,"mean_commits":6.714285714285714,"dds":"0.46808510638297873","last_synced_commit":"2bab33d08818e12d3ee9a256e936430d9f16d7e6"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fcountry-language","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fcountry-language/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fcountry-language/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ladjs%2Fcountry-language/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ladjs","download_url":"https://codeload.github.com/ladjs/country-language/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249080485,"owners_count":21209535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T11:17:11.606Z","updated_at":"2025-04-15T13:33:23.136Z","avatar_url":"https://github.com/ladjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [**@ladjs/country-language**](https://github.com/ladjs/country-language)\n\n[![build status](https://github.com/ladjs/country-language/actions/workflows/ci.yml/badge.svg)](https://github.com/ladjs/country-language/actions/workflows/ci.yml)\n[![code coverage](https://img.shields.io/codecov/c/github/ladjs/country-language.svg)](https://codecov.io/gh/ladjs/country-language)\n[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)\n[![license](https://img.shields.io/github/license/ladjs/country-language.svg)]()\n\n\u003e **Maintained fork of country-language with zero-dependencies.** Query any country's spoken languages or countries where a language is spoken.\n\n\n## Table of Contents\n\n* [Install](#install)\n* [Usage](#usage)\n  * [.getLanguageCodes (languageCodeType, cb)](#getlanguagecodes-languagecodetype-cb)\n  * [.getCountryCodes (countryCodeType, cb)](#getcountrycodes-countrycodetype-cb)\n  * [.languageCodeExists (languageCode)](#languagecodeexists-languagecode)\n  * [.countryCodeExists (countryCode)](#countrycodeexists-countrycode)\n  * [.getCountry (code, cb)](#getcountry-code-cb)\n  * [.getLanguage (code, cb)](#getlanguage-code-cb)\n  * [.getCountryLanguages (code, cb)](#getcountrylanguages-code-cb)\n  * [.getLanguageCountries (code, cb)](#getlanguagecountries-code-cb)\n  * [.getCountryMsLocales (code, cb)](#getcountrymslocales-code-cb)\n  * [.getLanguageMsLocales (code, cb)](#getlanguagemslocales-code-cb)\n  * [.getCountries ()](#getcountries-)\n  * [.getLanguages ()](#getlanguages-)\n  * [.getLanguageFamilies ()](#getlanguagefamilies-)\n  * [.getLocales (mode)](#getlocales-mode)\n  * [.getLanguageFamilyMembers (family, cb)](#getlanguagefamilymembers-family-cb)\n* [Contributors](#contributors)\n* [License](#license)\n\n\n## Install\n\n[npm][]:\n\n```sh\nnpm install @ladjs/country-language\n```\n\n\n## Usage\n\nOnce you require `@ladjs/country-language`, the following API will be available.\n\n```js\nconst CountryLanguage = require('@ladjs/country-language');\n```\n\n### .getLanguageCodes (languageCodeType, cb)\n\n* **@param** *{String}* language code type. Acceptable values: 1, 2 or 3.\n* **@param** *{Function}* callback on complete or error\n* **@cb** *{Error|null}* if error\n* **@cb** *{Object}* array String with language codes\n\nAcceptable language code type parameter values: 1, 2, 3 for returning ISO-639-1, ISO-639-2, ISO-639-3 codes respectively.\nIf not provided, ISO-639-1 codes will be returned.\n\n```js\nconst allLanguageCodes = CountryLanguage.getLanguageCodes(2);\n```\n\n### .getCountryCodes (countryCodeType, cb)\n\n* **@param** *{String}* country code type. Acceptable values: 1, 2 or 3.\n* **@param** *{Function}* callback on complete or error\n* **@cb** *{Error|null}* if error\n* **@cb** *{Object}* array String with country codes\n\nAcceptable country code type parameter values: 1, 2, 3 for returning numerical code, alpha-2, alpha-3 codes respectively.\nIf not provided, alpha-2 codes will be returned.\n\n```js\nconst allCountryCodes = CountryLanguage.getCountryCodes(2);\n```\n\n### .languageCodeExists (languageCode)\n\n* **@param** *{String}* language code to check.\n\nReturns Boolean indicating language existance.\nLanguage code parameter can be either a ISO-639-1, ISO-639-2 or ISO-639-3 code.\n\n```js\nconst languageExists = CountryLanguage.languageCodeExists('en');\n```\n\n### .countryCodeExists (countryCode)\n\n* **@param** *{String}* country code to check.\n\nReturns Boolean indicating country existance.\nCountry code parameter can be either an alpha-2, alpha-3 or numerical code.\n\n```js\nconst countryExists = CountryLanguage.countryCodeExists('GB');\n```\n\n### .getCountry (code, cb)\n\n* **@param** *{String}* country code\n* **@param** *{Function}* callback on complete or error\n* **@cb** *{Error|null}* if error\n* **@cb** *{Object}* object containing country info\n\nCountry code can be either an Alpha-2 or Alpha-3 code.\nThe returned object includes the following info:\n\n* `code_2`: Country alpha-2 code (2 letters)\n* `code_3`: Country alpha-3 code (3 letters)\n* `numCode`: Country numeric code\n* `name`: Country name\n* `languages`: Array of language objects for each language spoken in the country\n* `langCultureMs`: Array of language cultures for the country supported by Microsoft©\n\nEach language object in `languages` property includes the following info:\n\n* `iso639_1`: language iso639-1 code (2 letters)\n* `iso639_2`: language iso639-2 code (3 letters)\n* `iso639_2en`: language iso639-2 code with some codes derived from English names rather than native names of languages (3 letters)\n* `iso639_3`: language iso639-3 code (3 letters)\n* `name`: String array with one or more language names (in English)\n* `nativeName`: String array with one or more language names (in native language)\n* `direction`: Language script direction (either \"LTR\" or \"RTL\") - Left-to-Right, Right-to-Left\n* `family`: language family\n* `countries`: Array of country objects where this language is spoken\n\nEach Microsoft© language culture object in `langCultureMs` property icludes the following info:\n\n* `langCultureName`: language culture name\n* `displayName`: language culture dispaly name\n* `cultureCode`: language culture code\n\n```js\nCountryLanguage.getCountry('GB', function (err, country) {\n  if (err) {\n    console.log(err);\n  } else {\n    const languagesInGB = country.languages;\n  }\n});\n```\n\n### .getLanguage (code, cb)\n\n* **@param** *{String}* language code\n* **@param** *{Function}* callback on complete or error\n* **@cb** *{Error|null}* if error\n* **@cb** *{Object}* object containing language info\n\nLanguage code can be either iso639-1, iso639-2, iso639-2en or iso639-3 code.\nContents of the returned language object are described in **`.getCountry`** method.\n\n```js\nCountryLanguage.getLanguage('en', function (err, language) {\n  if (err) {\n    console.log(err);\n  } else {\n    const countriesSpeakingEN = language.countries;\n  }\n});\n```\n\n### .getCountryLanguages (code, cb)\n\n* **@param** *{String}* country code\n* **@param** *{Function}* callback on complete or error\n* **@cb** *{Error|null}* if error\n* **@cb** *{Object}* object array containing country languages info\n\nCountry code can be either an Alpha-2 or Alpha-3 code.\nEach language object contains the following info:\n\n* `iso639_1`: language iso639-1 code (2 letters)\n* `iso639_2`: language iso639-2 code with some codes derived from English names rather than native names of languages (3 letters)\n* `iso639_3`: language iso639-3 code (3 letters)\n\n```js\nCountryLanguage.getCountryLanguages('GB', function (err, languages) {\n  if (err) {\n    console.log(err);\n  } else {\n    languages.forEach(function (languageCodes) {\n      console.log(languageCodes.iso639_1);\n    });\n  }\n});\n```\n\n### .getLanguageCountries (code, cb)\n\n* **@param** *{String}* language code\n* **@param** *{Function}* callback on complete or error\n* **@cb** *{Error|null}* if error\n* **@cb** *{Object}* object array containing country info\n\nLanguage code can be either iso639-1, iso639-2, iso639-2en or iso639-3 code.\nEach Country object contains the following info:\n\n* `code_2`: Country alpha-2 code (2 letters)\n* `code_3`: Country alpha-3 code (3 letters)\n* `numCode`: Country numeric code\n\n```js\nCountryLanguage.getLanguageCountries('en', function (err, countries) {\n  if (err) {\n    console.log(err);\n  } else {\n    countries.forEach(function (countryCodes) {\n      console.log(countryCodes.code_3);\n    });\n  }\n});\n```\n\n### .getCountryMsLocales (code, cb)\n\n* **@param** *{String}* country code\n* **@param** *{Function}* callback on complete or error\n* **@cb** *{Error|null}* if error\n* **@cb** *{Object}* object array containing Language Cultures info for the country\n\nCountry code can be either an Alpha-2 or Alpha-3 code.\nContents of each Language Culture object are described in **`.getCountry`** method.\n\n```js\nCountryLanguage.getCountryMsLocales('GB', function (err, locales) {\n  if (err) {\n    console.log(err);\n  } else {\n    locales.forEach(function (locale) {\n      console.log(locale.langCultureName);\n    });\n  }\n});\n```\n\n### .getLanguageMsLocales (code, cb)\n\n* **@param** *{String}* language code\n* **@param** *{Function}* callback on complete or error\n* **@cb** *{Error|null}* if error\n* **@cb** *{Object}* object array containing Language Cultures info for the language\n\nLanguage code can be either iso639-1, iso639-2, iso639-2en or iso639-3 code.\nContents of each Language Culture object are described in **`.getCountry`** method.\n\n```js\nCountryLanguage.getLanguageMsLocales('en', function (err, locales) {\n  if (err) {\n    console.log(err);\n  } else {\n    locales.forEach(function (locale) {\n      console.log(locale.langCultureName);\n    });\n  }\n});\n```\n\n### .getCountries ()\n\nReturns an array object with info for every country in the world having an ISO 3166 code.\nContents of each country object in the array is described in **`.getCountry`** method.\n\n```js\nconst allCountries = CountryLanguage.getCountries();\n```\n\n### .getLanguages ()\n\nReturns an array object with info for every language in the world having an ISO 639-2 code (and a few more).\nContents of each language object in the array is described in **`.getCountry`** method.\n\n```js\nconst allLanguages = CountryLanguage.getLanguages();\n```\n\n### .getLanguageFamilies ()\n\nReturns an array of strings with the names of each language family.\n\n```js\nconst allLanguageFamilies = CountryLanguage.getLanguageFamilies();\n```\n\n### .getLocales (mode)\n\n* **@param** *{Boolean}* locale symbols mode\n\nReturns an array of strings with all locale codes.\nIf mode ommited or false, locales with 3 parts will be returned like: **az-Cyrl-AZ**\n\n```js\nconst localesSymbols = CountryLanguage.getLocales();\n```\n\nIf mode is set to true, they will be returned like: **az-AZ-Cyrl**\n\n```js\nconst localesSymbols = CountryLanguage.getLocales(true);\n```\n\n### .getLanguageFamilyMembers (family, cb)\n\nReturns an array object with info for every language in the world having an ISO 639-2 code (and a few more).\nContents of each language object in the array is described in **`.getCountry`** method.\n\n* **@param** *{String}* language family name (\n* **@param** *{Function}* callback on complete or error\n* **@cb** *{Error|null}* if error\n* **@cb** *{Object}* object array containing languages info for each language member in the family.\n\nContents of the returned language object are described in **`.getCountry`** method.\n\n```js\nCountryLanguage.getLanguageFamilyMembers('Indo-European', function (err, languages) {\n  if (err) {\n    console.log(err);\n  } else {\n    languages.forEach(function (language) {\n      console.log(language.name);\n    });\n  }\n});\n```\n\n\u003cbr /\u003e\n## Notes\n\nFor the following methods:\n\n* **.getLanguageCodes**\n* **.getCountryCodes**\n* **.getCountry**\n* **.getLanguage**\n* **.getCountryLanguages**\n* **.getLanguageCountries**\n* **.getCountryMsLocales**\n* **.getLanguageMsLocales**\n* **.getLanguageFamilyMembers**\n\nthe `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.\n\nAny input parameter (country code, language code, language family name) is case insensitive.\n\n`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).\n\n\n## Contributors\n\n| Name         |\n| ------------ |\n| **titanism** |\n\n\n## License\n\n[MIT](LICENSE) © Tassos Diamantidis\n\n\n##\n\n[npm]: https://www.npmjs.com/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fcountry-language","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fladjs%2Fcountry-language","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fladjs%2Fcountry-language/lists"}