2021-02-02 21:05:09 +00:00
|
|
|
BASE_URLS = {
|
|
|
|
"GOOGLE_TRANSLATE": "https://translate.google.com/m",
|
|
|
|
"PONS": "https://en.pons.com/translate/",
|
|
|
|
"YANDEX": "https://translate.yandex.net/api/{version}/tr.json/{endpoint}",
|
|
|
|
"LINGUEE": "https://www.linguee.com/",
|
|
|
|
"MYMEMORY": "http://api.mymemory.translated.net/get",
|
|
|
|
"QCRI": "https://mt.qcri.org/api/v1/{endpoint}?",
|
2021-11-29 19:28:30 +00:00
|
|
|
"DEEPL": "https://api.deepl.com/{version}/",
|
2022-05-01 12:00:20 +00:00
|
|
|
"DEEPL_FREE": "https://api-free.deepl.com/{version}/",
|
2021-11-29 19:28:30 +00:00
|
|
|
"MICROSOFT_TRANSLATE": "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0",
|
|
|
|
"PAPAGO": "https://papago.naver.com/",
|
2022-01-24 04:07:52 +00:00
|
|
|
"PAPAGO_API": "https://openapi.naver.com/v1/papago/n2mt",
|
|
|
|
"LIBRE": "https://libretranslate.com/",
|
|
|
|
"LIBRE_FREE": "https://libretranslate.de/",
|
2021-02-02 21:05:09 +00:00
|
|
|
}
|
|
|
|
|
2022-05-01 12:00:20 +00:00
|
|
|
GOOGLE_LANGUAGES_TO_CODES = {
|
|
|
|
"afrikaans": "af",
|
|
|
|
"albanian": "sq",
|
|
|
|
"amharic": "am",
|
|
|
|
"arabic": "ar",
|
|
|
|
"armenian": "hy",
|
2022-11-07 18:06:49 +00:00
|
|
|
"assamese": "as",
|
|
|
|
"aymara": "ay",
|
2022-05-01 12:00:20 +00:00
|
|
|
"azerbaijani": "az",
|
2022-11-07 18:06:49 +00:00
|
|
|
"bambara": "bm",
|
2022-05-01 12:00:20 +00:00
|
|
|
"basque": "eu",
|
|
|
|
"belarusian": "be",
|
|
|
|
"bengali": "bn",
|
2022-11-07 18:06:49 +00:00
|
|
|
"bhojpuri": "bho",
|
2022-05-01 12:00:20 +00:00
|
|
|
"bosnian": "bs",
|
|
|
|
"bulgarian": "bg",
|
|
|
|
"catalan": "ca",
|
|
|
|
"cebuano": "ceb",
|
|
|
|
"chichewa": "ny",
|
|
|
|
"chinese (simplified)": "zh-CN",
|
|
|
|
"chinese (traditional)": "zh-TW",
|
|
|
|
"corsican": "co",
|
|
|
|
"croatian": "hr",
|
|
|
|
"czech": "cs",
|
|
|
|
"danish": "da",
|
2022-11-07 18:06:49 +00:00
|
|
|
"dhivehi": "dv",
|
|
|
|
"dogri": "doi",
|
2022-05-01 12:00:20 +00:00
|
|
|
"dutch": "nl",
|
|
|
|
"english": "en",
|
|
|
|
"esperanto": "eo",
|
|
|
|
"estonian": "et",
|
2022-11-07 18:06:49 +00:00
|
|
|
"ewe": "ee",
|
2022-05-01 12:00:20 +00:00
|
|
|
"filipino": "tl",
|
|
|
|
"finnish": "fi",
|
|
|
|
"french": "fr",
|
|
|
|
"frisian": "fy",
|
|
|
|
"galician": "gl",
|
|
|
|
"georgian": "ka",
|
|
|
|
"german": "de",
|
|
|
|
"greek": "el",
|
2022-11-07 18:06:49 +00:00
|
|
|
"guarani": "gn",
|
2022-05-01 12:00:20 +00:00
|
|
|
"gujarati": "gu",
|
|
|
|
"haitian creole": "ht",
|
|
|
|
"hausa": "ha",
|
|
|
|
"hawaiian": "haw",
|
|
|
|
"hebrew": "iw",
|
|
|
|
"hindi": "hi",
|
|
|
|
"hmong": "hmn",
|
|
|
|
"hungarian": "hu",
|
|
|
|
"icelandic": "is",
|
|
|
|
"igbo": "ig",
|
2022-11-07 18:06:49 +00:00
|
|
|
"ilocano": "ilo",
|
2022-05-01 12:00:20 +00:00
|
|
|
"indonesian": "id",
|
|
|
|
"irish": "ga",
|
|
|
|
"italian": "it",
|
|
|
|
"japanese": "ja",
|
|
|
|
"javanese": "jw",
|
|
|
|
"kannada": "kn",
|
|
|
|
"kazakh": "kk",
|
|
|
|
"khmer": "km",
|
|
|
|
"kinyarwanda": "rw",
|
2022-11-07 18:06:49 +00:00
|
|
|
"konkani": "gom",
|
2022-05-01 12:00:20 +00:00
|
|
|
"korean": "ko",
|
2022-11-07 18:06:49 +00:00
|
|
|
"krio": "kri",
|
|
|
|
"kurdish (kurmanji)": "ku",
|
|
|
|
"kurdish (sorani)": "ckb",
|
2022-05-01 12:00:20 +00:00
|
|
|
"kyrgyz": "ky",
|
|
|
|
"lao": "lo",
|
|
|
|
"latin": "la",
|
|
|
|
"latvian": "lv",
|
2022-11-07 18:06:49 +00:00
|
|
|
"lingala": "ln",
|
2022-05-01 12:00:20 +00:00
|
|
|
"lithuanian": "lt",
|
2022-11-07 18:06:49 +00:00
|
|
|
"luganda": "lg",
|
2022-05-01 12:00:20 +00:00
|
|
|
"luxembourgish": "lb",
|
|
|
|
"macedonian": "mk",
|
2022-11-07 18:06:49 +00:00
|
|
|
"maithili": "mai",
|
2022-05-01 12:00:20 +00:00
|
|
|
"malagasy": "mg",
|
|
|
|
"malay": "ms",
|
|
|
|
"malayalam": "ml",
|
|
|
|
"maltese": "mt",
|
|
|
|
"maori": "mi",
|
|
|
|
"marathi": "mr",
|
2022-11-07 18:06:49 +00:00
|
|
|
"meiteilon (manipuri)": "mni-Mtei",
|
|
|
|
"mizo": "lus",
|
2022-05-01 12:00:20 +00:00
|
|
|
"mongolian": "mn",
|
|
|
|
"myanmar": "my",
|
|
|
|
"nepali": "ne",
|
|
|
|
"norwegian": "no",
|
2022-11-07 18:06:49 +00:00
|
|
|
"odia (oriya)": "or",
|
|
|
|
"oromo": "om",
|
2022-05-01 12:00:20 +00:00
|
|
|
"pashto": "ps",
|
|
|
|
"persian": "fa",
|
|
|
|
"polish": "pl",
|
|
|
|
"portuguese": "pt",
|
|
|
|
"punjabi": "pa",
|
2022-11-07 18:06:49 +00:00
|
|
|
"quechua": "qu",
|
2022-05-01 12:00:20 +00:00
|
|
|
"romanian": "ro",
|
|
|
|
"russian": "ru",
|
|
|
|
"samoan": "sm",
|
2022-11-07 18:06:49 +00:00
|
|
|
"sanskrit": "sa",
|
2022-05-01 12:00:20 +00:00
|
|
|
"scots gaelic": "gd",
|
2022-11-07 18:06:49 +00:00
|
|
|
"sepedi": "nso",
|
2022-05-01 12:00:20 +00:00
|
|
|
"serbian": "sr",
|
|
|
|
"sesotho": "st",
|
|
|
|
"shona": "sn",
|
|
|
|
"sindhi": "sd",
|
|
|
|
"sinhala": "si",
|
|
|
|
"slovak": "sk",
|
|
|
|
"slovenian": "sl",
|
|
|
|
"somali": "so",
|
|
|
|
"spanish": "es",
|
|
|
|
"sundanese": "su",
|
|
|
|
"swahili": "sw",
|
|
|
|
"swedish": "sv",
|
|
|
|
"tajik": "tg",
|
|
|
|
"tamil": "ta",
|
|
|
|
"tatar": "tt",
|
|
|
|
"telugu": "te",
|
|
|
|
"thai": "th",
|
2022-11-07 18:06:49 +00:00
|
|
|
"tigrinya": "ti",
|
|
|
|
"tsonga": "ts",
|
2022-05-01 12:00:20 +00:00
|
|
|
"turkish": "tr",
|
|
|
|
"turkmen": "tk",
|
2022-11-07 18:06:49 +00:00
|
|
|
"twi": "ak",
|
2022-05-01 12:00:20 +00:00
|
|
|
"ukrainian": "uk",
|
|
|
|
"urdu": "ur",
|
|
|
|
"uyghur": "ug",
|
|
|
|
"uzbek": "uz",
|
|
|
|
"vietnamese": "vi",
|
|
|
|
"welsh": "cy",
|
|
|
|
"xhosa": "xh",
|
|
|
|
"yiddish": "yi",
|
|
|
|
"yoruba": "yo",
|
|
|
|
"zulu": "zu",
|
2022-01-24 04:07:52 +00:00
|
|
|
}
|
|
|
|
|
2021-02-02 21:05:09 +00:00
|
|
|
PONS_CODES_TO_LANGUAGES = {
|
2022-05-01 12:00:20 +00:00
|
|
|
"ar": "arabic",
|
|
|
|
"bg": "bulgarian",
|
|
|
|
"zh-cn": "chinese",
|
|
|
|
"cs": "czech",
|
|
|
|
"da": "danish",
|
|
|
|
"nl": "dutch",
|
|
|
|
"en": "english",
|
|
|
|
"fr": "french",
|
|
|
|
"de": "german",
|
|
|
|
"el": "greek",
|
|
|
|
"hu": "hungarian",
|
|
|
|
"it": "italian",
|
|
|
|
"la": "latin",
|
|
|
|
"no": "norwegian",
|
|
|
|
"pl": "polish",
|
|
|
|
"pt": "portuguese",
|
|
|
|
"ru": "russian",
|
|
|
|
"sl": "slovenian",
|
|
|
|
"es": "spanish",
|
|
|
|
"sv": "swedish",
|
|
|
|
"tr": "turkish",
|
|
|
|
"elv": "elvish",
|
2021-02-02 21:05:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LINGUEE_LANGUAGES_TO_CODES = {
|
|
|
|
"maltese": "mt",
|
|
|
|
"english": "en",
|
|
|
|
"german": "de",
|
|
|
|
"bulgarian": "bg",
|
|
|
|
"polish": "pl",
|
|
|
|
"portuguese": "pt",
|
|
|
|
"hungarian": "hu",
|
|
|
|
"romanian": "ro",
|
|
|
|
"russian": "ru",
|
2021-11-29 19:28:30 +00:00
|
|
|
# "serbian": "sr",
|
2021-02-02 21:05:09 +00:00
|
|
|
"dutch": "nl",
|
|
|
|
"slovakian": "sk",
|
|
|
|
"greek": "el",
|
|
|
|
"slovenian": "sl",
|
|
|
|
"danish": "da",
|
|
|
|
"italian": "it",
|
|
|
|
"spanish": "es",
|
|
|
|
"finnish": "fi",
|
|
|
|
"chinese": "zh",
|
|
|
|
"french": "fr",
|
2021-11-29 19:28:30 +00:00
|
|
|
# "croatian": "hr",
|
2021-02-02 21:05:09 +00:00
|
|
|
"czech": "cs",
|
|
|
|
"laotian": "lo",
|
|
|
|
"swedish": "sv",
|
|
|
|
"latvian": "lv",
|
|
|
|
"estonian": "et",
|
2022-05-01 12:00:20 +00:00
|
|
|
"japanese": "ja",
|
2021-02-02 21:05:09 +00:00
|
|
|
}
|
|
|
|
|
2021-11-29 19:28:30 +00:00
|
|
|
DEEPL_LANGUAGE_TO_CODE = {
|
|
|
|
"bulgarian": "bg",
|
|
|
|
"czech": "cs",
|
|
|
|
"danish": "da",
|
|
|
|
"german": "de",
|
|
|
|
"greek": "el",
|
|
|
|
"english": "en",
|
|
|
|
"spanish": "es",
|
|
|
|
"estonian": "et",
|
|
|
|
"finnish": "fi",
|
|
|
|
"french": "fr",
|
|
|
|
"hungarian": "hu",
|
|
|
|
"italian": "it",
|
|
|
|
"japanese": "ja",
|
|
|
|
"lithuanian": "lt",
|
|
|
|
"latvian": "lv",
|
|
|
|
"dutch": "nl",
|
|
|
|
"polish": "pl",
|
|
|
|
"portuguese": "pt",
|
|
|
|
"romanian": "ro",
|
|
|
|
"russian": "ru",
|
|
|
|
"slovak": "sk",
|
|
|
|
"slovenian": "sl",
|
|
|
|
"swedish": "sv",
|
2022-05-01 12:00:20 +00:00
|
|
|
"chinese": "zh",
|
2021-11-29 19:28:30 +00:00
|
|
|
}
|
|
|
|
|
2022-05-01 12:00:20 +00:00
|
|
|
PAPAGO_LANGUAGE_TO_CODE = {
|
|
|
|
"ko": "Korean",
|
|
|
|
"en": "English",
|
|
|
|
"ja": "Japanese",
|
|
|
|
"zh-CN": "Chinese",
|
|
|
|
"zh-TW": "Chinese traditional",
|
|
|
|
"es": "Spanish",
|
|
|
|
"fr": "French",
|
|
|
|
"vi": "Vietnamese",
|
|
|
|
"th": "Thai",
|
|
|
|
"id": "Indonesia",
|
2022-01-24 04:07:52 +00:00
|
|
|
}
|
|
|
|
|
2022-05-01 12:00:20 +00:00
|
|
|
QCRI_LANGUAGE_TO_CODE = {"Arabic": "ar", "English": "en", "Spanish": "es"}
|
2022-01-24 04:07:52 +00:00
|
|
|
|
|
|
|
LIBRE_LANGUAGES_TO_CODES = {
|
2022-05-01 12:00:20 +00:00
|
|
|
"English": "en",
|
|
|
|
"Arabic": "ar",
|
|
|
|
"Chinese": "zh",
|
|
|
|
"French": "fr",
|
|
|
|
"German": "de",
|
|
|
|
"Hindi": "hi",
|
|
|
|
"Indonesian": "id",
|
|
|
|
"Irish": "ga",
|
|
|
|
"Italian": "it",
|
|
|
|
"Japanese": "ja",
|
|
|
|
"Korean": "ko",
|
|
|
|
"Polish": "pl",
|
|
|
|
"Portuguese": "pt",
|
|
|
|
"Russian": "ru",
|
|
|
|
"Spanish": "es",
|
|
|
|
"Turkish": "tr",
|
|
|
|
"Vietnamese": "vi",
|
2022-01-24 04:07:52 +00:00
|
|
|
}
|