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

Language auto detecting is broken in MyMemory #75

Closed
ZhymabekRoman opened this issue Jan 24, 2023 · 3 comments
Closed

Language auto detecting is broken in MyMemory #75

ZhymabekRoman opened this issue Jan 24, 2023 · 3 comments

Comments

@ZhymabekRoman
Copy link
Contributor

➜  translate git:(main) ✗ ipython
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
Type 'copyright', 'credits' or 'license' for more information
IPython 8.8.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from translatepy.translators import MyMemoryTranslate
In [2]: dl = MyMemoryTranslate()
In [3]: dl.language("hello")

# server response
ic| request.json(): {'exception_code': None,
                     'matches': '',
                     'mtLangSupported': None,
                     'quotaFinished': None,
                     'responderId': None,
                     'responseData': {'translatedText': "'AUTODETECT' IS AN INVALID SOURCE LANGUAGE . "
                                                        'EXAMPLE: LANGPAIR=EN|IT USING 2 LETTER '
                                                        'ISO OR RFC3066 LIKE ZH-CN. ALMOST ALL '
                                                        'LANGUAGES SUPPORTED BUT SOME MAY HAVE NO '
                                                        'CONTENT'},
                     'responseDetails': "'AUTODETECT' IS AN INVALID SOURCE LANGUAGE . EXAMPLE: "
                                        'LANGPAIR=EN|IT USING 2 LETTER ISO OR RFC3066 LIKE ZH-CN. '
                                        'ALMOST ALL LANGUAGES SUPPORTED BUT SOME MAY HAVE NO '
                                        'CONTENT',
                     'responseStatus': '403'}

Same issues:
terryyin/translate-python#69
terryyin/translate-python#77
terryyin/translate-python#53

@ZhymabekRoman
Copy link
Contributor Author

I have only one solution - write own MyMemory page parser, instead of using API, because in web version of MyMemory auto detection works properly

@Animenosekai
Copy link
Owner

Screenshot 0005-01-26 at 12 36 18

The autotranslation does seem to work but it returns an "Auto" language response as the source language...

This might be the reason why there is a problem with the language method

@ZhymabekRoman
Copy link
Contributor Author

Closed in #95:

In [1]: from translatepy.translators.mymemory import MyMemoryTranslate

In [2]: dl = MyMemoryTranslate()

In [3]: dl.language("language")
Out[3]: LanguageResult(service=Translator(MyMemory), source='language', source_lang=Language(English))

In [4]: dl.language("Bonjour")
Out[4]: LanguageResult(service=Translator(MyMemory), source='Bonjour', source_lang=Language(French))

In [5]:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants