Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for kurdish sorani language (ckb). #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iamtraction/google-translate",
"version": "2.0.1",
"name": "@hamakh11/google-translate",
"version": "2.0.2",
"description": "A Node.JS library to consume Google Translate API for free.",
"main": "src/index.js",
"typings": "typings/index.d.ts",
Expand All @@ -9,7 +9,7 @@
"test": "npm run test:lint",
"start": "node ."
},
"repository": "https://github.com/iamtraction/google-translate",
"repository": "https://github.com/hamakh11/free-google-translate-api",
"keywords": [
"google translate api",
"google translate",
Expand All @@ -30,4 +30,4 @@
"devDependencies": {
"eslint": "^8.27.0"
}
}
}
229 changes: 115 additions & 114 deletions src/languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,111 +8,112 @@
*/

const languages = {
"auto": "Automatic",
"af": "Afrikaans",
"sq": "Albanian",
"am": "Amharic",
"ar": "Arabic",
"hy": "Armenian",
"az": "Azerbaijani",
"eu": "Basque",
"be": "Belarusian",
"bn": "Bengali",
"bs": "Bosnian",
"bg": "Bulgarian",
"ca": "Catalan",
"ceb": "Cebuano",
"ny": "Chichewa",
"zh-cn": "Chinese Simplified",
"zh-tw": "Chinese Traditional",
"co": "Corsican",
"hr": "Croatian",
"cs": "Czech",
"da": "Danish",
"nl": "Dutch",
"en": "English",
"eo": "Esperanto",
"et": "Estonian",
"tl": "Filipino",
"fi": "Finnish",
"fr": "French",
"fy": "Frisian",
"gl": "Galician",
"ka": "Georgian",
"de": "German",
"el": "Greek",
"gu": "Gujarati",
"ht": "Haitian Creole",
"ha": "Hausa",
"haw": "Hawaiian",
"iw": "Hebrew",
"hi": "Hindi",
"hmn": "Hmong",
"hu": "Hungarian",
"is": "Icelandic",
"ig": "Igbo",
"id": "Indonesian",
"ga": "Irish",
"it": "Italian",
"ja": "Japanese",
"jw": "Javanese",
"kn": "Kannada",
"kk": "Kazakh",
"km": "Khmer",
"ko": "Korean",
"ku": "Kurdish (Kurmanji)",
"ky": "Kyrgyz",
"lo": "Lao",
"la": "Latin",
"lv": "Latvian",
"lt": "Lithuanian",
"lb": "Luxembourgish",
"mk": "Macedonian",
"mg": "Malagasy",
"ms": "Malay",
"ml": "Malayalam",
"mt": "Maltese",
"mi": "Maori",
"mr": "Marathi",
"mn": "Mongolian",
"my": "Myanmar (Burmese)",
"ne": "Nepali",
"no": "Norwegian",
"ps": "Pashto",
"fa": "Persian",
"pl": "Polish",
"pt": "Portuguese",
"pa": "Punjabi",
"ro": "Romanian",
"ru": "Russian",
"sm": "Samoan",
"gd": "Scots Gaelic",
"sr": "Serbian",
"st": "Sesotho",
"sn": "Shona",
"sd": "Sindhi",
"si": "Sinhala",
"sk": "Slovak",
"sl": "Slovenian",
"so": "Somali",
"es": "Spanish",
"su": "Sundanese",
"sw": "Swahili",
"sv": "Swedish",
"tg": "Tajik",
"ta": "Tamil",
"te": "Telugu",
"th": "Thai",
"tr": "Turkish",
"uk": "Ukrainian",
"ur": "Urdu",
"uz": "Uzbek",
"vi": "Vietnamese",
"cy": "Welsh",
"xh": "Xhosa",
"yi": "Yiddish",
"yo": "Yoruba",
"zu": "Zulu"
auto: "Automatic",
af: "Afrikaans",
sq: "Albanian",
am: "Amharic",
ar: "Arabic",
hy: "Armenian",
az: "Azerbaijani",
eu: "Basque",
be: "Belarusian",
bn: "Bengali",
bs: "Bosnian",
bg: "Bulgarian",
ca: "Catalan",
ceb: "Cebuano",
ny: "Chichewa",
"zh-cn": "Chinese Simplified",
"zh-tw": "Chinese Traditional",
co: "Corsican",
hr: "Croatian",
cs: "Czech",
da: "Danish",
nl: "Dutch",
en: "English",
eo: "Esperanto",
et: "Estonian",
tl: "Filipino",
fi: "Finnish",
fr: "French",
fy: "Frisian",
gl: "Galician",
ka: "Georgian",
de: "German",
el: "Greek",
gu: "Gujarati",
ht: "Haitian Creole",
ha: "Hausa",
haw: "Hawaiian",
iw: "Hebrew",
hi: "Hindi",
hmn: "Hmong",
hu: "Hungarian",
is: "Icelandic",
ig: "Igbo",
id: "Indonesian",
ga: "Irish",
it: "Italian",
ja: "Japanese",
jw: "Javanese",
kn: "Kannada",
kk: "Kazakh",
km: "Khmer",
ko: "Korean",
ku: "Kurdish (Kurmanji)",
ckb: "Kurdish (Sorani)",
ky: "Kyrgyz",
lo: "Lao",
la: "Latin",
lv: "Latvian",
lt: "Lithuanian",
lb: "Luxembourgish",
mk: "Macedonian",
mg: "Malagasy",
ms: "Malay",
ml: "Malayalam",
mt: "Maltese",
mi: "Maori",
mr: "Marathi",
mn: "Mongolian",
my: "Myanmar (Burmese)",
ne: "Nepali",
no: "Norwegian",
ps: "Pashto",
fa: "Persian",
pl: "Polish",
pt: "Portuguese",
pa: "Punjabi",
ro: "Romanian",
ru: "Russian",
sm: "Samoan",
gd: "Scots Gaelic",
sr: "Serbian",
st: "Sesotho",
sn: "Shona",
sd: "Sindhi",
si: "Sinhala",
sk: "Slovak",
sl: "Slovenian",
so: "Somali",
es: "Spanish",
su: "Sundanese",
sw: "Swahili",
sv: "Swedish",
tg: "Tajik",
ta: "Tamil",
te: "Telugu",
th: "Thai",
tr: "Turkish",
uk: "Ukrainian",
ur: "Urdu",
uz: "Uzbek",
vi: "Vietnamese",
cy: "Welsh",
xh: "Xhosa",
yi: "Yiddish",
yo: "Yoruba",
zu: "Zulu",
};

/**
Expand All @@ -123,17 +124,17 @@ const languages = {
* language is not supported
*/
function getISOCode(language) {
if (!language) return false;
language = language.toLowerCase();
if (language in languages) return language;
if (!language) return false;
language = language.toLowerCase();
if (language in languages) return language;

let keys = Object.keys(languages).filter((key) => {
if (typeof languages[key] !== "string") return false;
let keys = Object.keys(languages).filter((key) => {
if (typeof languages[key] !== "string") return false;

return languages[key].toLowerCase() === language;
});
return languages[key].toLowerCase() === language;
});

return keys[0] || null;
return keys[0] || null;
}

/**
Expand All @@ -142,7 +143,7 @@ function getISOCode(language) {
* @returns {boolean} If the language is supported or not.
*/
function isSupported(language) {
return Boolean(getISOCode(language));
return Boolean(getISOCode(language));
}

module.exports = languages;
Expand Down