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

Improve (default) google translator #110

Open
DankalApps opened this issue Feb 15, 2023 · 3 comments
Open

Improve (default) google translator #110

DankalApps opened this issue Feb 15, 2023 · 3 comments

Comments

@DankalApps
Copy link

Google translator allows to provide 5000 words. It might be good idea to provide many strings at once, separated by semicolon (or a dot?) + space.

I have an example:

    <string name="difficulty_level1">Easy</string>
    <string name="difficulty_level2">Medium</string>
    <string name="difficulty_level3">Hard</string>
    <string name="difficulty_level4">Very hard</string>

converts to
Easy; Medium; Hard; Very hard

and result on translate google:
https://translate.google.com/?sl=en&tl=pl&text=Easy%3BMedium%3BHard%3BVery%20hard&op=translate

It not only requires less api calls but also gives better results. Giving some context to the separated words. In the case above, when translating to my language (and some other languages too) using your plugin hard was translated to a word meaning "solid, firm, rigid", not the correct one meaning "difficult"

@Airsaid
Copy link
Owner

Airsaid commented Feb 16, 2023

Thanks for your feedback. This would have two problems.

1, the separator ";" may appear in the text being translated and it is impossible to assume what the user's text is.

2, For long sentences, this may lead to a reduction in the accuracy of the translated result. This is because there are many words blended together, affecting the judgment of the translation context.

Discussions are welcome.

@DankalApps
Copy link
Author

";" separator is just an example, maybe some other symbol would be better. Take a look on this 😄 :
https://translate.google.com/?sl=en&tl=pl&text=Easy%E2%98%BCMedium%E2%98%BCHard%E2%98%BCVery%20hard&op=translate

One could argue that the translation would be even better - bigger context, better translation. Google translates whole web pages this way. But that would have to be tested of course, either of us might be right.

At the very least this technique could be at least used to translate multiple single word strings.

I am planning to do some simple script in python to check this and share with you my results (for languages I know at least). Could you give me some hint on how to do this? I mean communication with google translate, not python-specific stuff. Or point me to some place where I can get needed info?

@Airsaid
Copy link
Owner

Airsaid commented Feb 17, 2023

To communicate with Google Translate without an API KEY, you mainly need to generate the corresponding token, which may help you: GoogleToken.

Alternatively, the web version can be used directly to compare the translation results of individual sentences and sentences mixed with other words separately.

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