You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
184 lines
4.0 KiB
184 lines
4.0 KiB
4 years ago
|
|
||
|
|
||
|
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}?",
|
||
|
"DEEPL": "https://api.deepl.com/{version}/"
|
||
|
}
|
||
|
|
||
|
GOOGLE_CODES_TO_LANGUAGES = {
|
||
|
'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',
|
||
|
'fil': 'Filipino',
|
||
|
'he': 'Hebrew'
|
||
|
}
|
||
|
|
||
|
GOOGLE_LANGUAGES_TO_CODES = {v: k for k, v in GOOGLE_CODES_TO_LANGUAGES.items()}
|
||
|
|
||
|
PONS_CODES_TO_LANGUAGES = {
|
||
|
'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'
|
||
|
}
|
||
|
|
||
|
PONS_LANGUAGES_TO_CODES = {v: k for k, v in PONS_CODES_TO_LANGUAGES.items()}
|
||
|
|
||
|
LINGUEE_LANGUAGES_TO_CODES = {
|
||
|
"maltese": "mt",
|
||
|
"english": "en",
|
||
|
"german": "de",
|
||
|
"bulgarian": "bg",
|
||
|
"polish": "pl",
|
||
|
"portuguese": "pt",
|
||
|
"hungarian": "hu",
|
||
|
"romanian": "ro",
|
||
|
"russian": "ru",
|
||
|
#"serbian": "sr",
|
||
|
"dutch": "nl",
|
||
|
"slovakian": "sk",
|
||
|
"greek": "el",
|
||
|
"slovenian": "sl",
|
||
|
"danish": "da",
|
||
|
"italian": "it",
|
||
|
"spanish": "es",
|
||
|
"finnish": "fi",
|
||
|
"chinese": "zh",
|
||
|
"french": "fr",
|
||
|
#"croatian": "hr",
|
||
|
"czech": "cs",
|
||
|
"laotian": "lo",
|
||
|
"swedish": "sv",
|
||
|
"latvian": "lv",
|
||
|
"estonian": "et",
|
||
|
"japanese": "ja"
|
||
|
}
|
||
|
|
||
|
LINGUEE_CODE_TO_LANGUAGE = {v: k for k, v in LINGUEE_LANGUAGES_TO_CODES.items()}
|
||
|
|
||
|
# "72e9e2cc7c992db4dcbdd6fb9f91a0d1"
|