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

Fix mozhi engine language code #459

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

GitGitro
Copy link

Hi!

currently the Mozhi engine tries to query the api with the language code of 3 chars long while it should be of 2.
I implemented this so that if it's 3 chars long it removes the last without breaking the languages that have 2 chars as code.

Tested and working on my end

@Bnyro
Copy link
Member

Bnyro commented Oct 29, 2024

I couldn't reproduce that Mozhi uses 3 char language codes, every Mozhi engine I tested returned 2 char language codes.

Have you used a specific Mozhi engine to reproduce that?

@GitGitro
Copy link
Author

ok yeah sorry i tested it in a bad way, it happens only with reverso through mozhi

can the code be modified to check against only reverso maybe?

@Bnyro
Copy link
Member

Bnyro commented Oct 29, 2024

ok yeah sorry i tested it in a bad way, it happens only with reverso through mozhi

can the code be modified to check against only reverso maybe?

Theoretically yes, but I don't think it makes much sense. Reverso probably expects 3 character language codes, so it wouldn't work if we send 2 characters instead.

Generally, the app should automatically refresh the list of available languages when you change the Mozhi engine to Reverso, so you should never run into the issue this PR aims to address, except if there's an API error at Mozhi when fetching the languages.

Or do you have found any other ways where this issue happens too?

@Bnyro
Copy link
Member

Bnyro commented Oct 29, 2024

For the text to speech at Mozhi however, we should certainly use your patch to only use the first two chars, since the text to speech from Mozhi always uses Google as engine, and thus needs two character language codes.

@GitGitro
Copy link
Author

Theoretically yes, but I don't think it makes much sense. Reverso probably expects 3 character language codes, so it wouldn't work if we send 2 characters instead.

the thing is reverso expect 3 but mozhi thorugh reverso 2
if you try to translate from mozhi from the browser you get this engine=reverso&from=en&to=de&text=hello as form data sent, probably because as you said the tts uses 2 char

also i'm changing the way mozhi handles languages not reverso, it should still work with only reverso as main engine, but correct me if i'm wrong here

@Bnyro
Copy link
Member

Bnyro commented Oct 29, 2024

the thing is reverso expect 3 but mozhi thorugh reverso 2

Oh okay, I though Mozhi through Reverso expects 3 chars.

Co-authored-by: Bnyro <bnyro@tutanota.com>
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

Successfully merging this pull request may close these issues.

2 participants