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

Stop modifying locale before sending to Google Translate #558

Merged
merged 1 commit into from
Mar 30, 2024

Conversation

jqr
Copy link
Contributor

@jqr jqr commented Mar 29, 2024

In #292 the from/to locales were modified to be limited to just the language portion of a locale tag except if it was within one of the listed set of langague-REGION tags. This was to fix #286.

That change no longer seems to be required by the underlying API:

EasyTranslate.translate("horse", to: "es")       # => "caballo"
EasyTranslate.translate("horse", to: "es-es")    # => "caballo"
EasyTranslate.translate("horse", to: "es-ES")    # => "caballo"

EasyTranslate.translate("caballo", to: "en")     # => "horse"
EasyTranslate.translate("caballo", to: "en-us")  # => "horse"
EasyTranslate.translate("caballo", to: "en-US")  # => "horse"

And maintaining that list directly in code causes several small issues, #555 #556, and #557 which actually is translating things into the incorrect language altogether.

Given that, it seems worthy of removing the vestigial locale modification code entirely and just relying on new improved behavior of the Google Translate API and EasyTranslate.

@glebm glebm merged commit 3bfe80c into glebm:main Mar 30, 2024
0 of 7 checks passed
@glebm
Copy link
Owner

glebm commented Mar 30, 2024

Thanks!

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.

Invalid Value (EasyTranslate::EasyTranslateException)
2 participants