-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use Bing Translator instead of TranslatorText #5089
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We were including it in the Object class, making its methods available everywhere.
We usually use this approach because methods are easier to override and stub.
TranslatorText isn't compatible with Ruby 3, so we need to use a different gem. The 'translator-text' gem response was an array of one or more objects. Now with the 'bing_translator' gem the response is an array with one or several translated texts. We remove the concept of object in the code. And we also remove the "create_response" method from the specs since it is no longer necessary to emulate that object and we can simply use arrays with texts to emulate the new response.
javierm
reviewed
Mar 10, 2023
spec/components/layout/remote_translations_button_component_spec.rb
Outdated
Show resolved
Hide resolved
spec/lib/remote_translations/microsoft/available_locales_spec.rb
Outdated
Show resolved
Hide resolved
javierm
reviewed
Mar 14, 2023
spec/lib/remote_translations/microsoft/available_locales_spec.rb
Outdated
Show resolved
Hide resolved
spec/lib/remote_translations/microsoft/available_locales_spec.rb
Outdated
Show resolved
Hide resolved
spec/lib/remote_translations/microsoft/available_locales_spec.rb
Outdated
Show resolved
Hide resolved
It has been detected that for the :pt-BR, :zh-CN and :zh-TW locales, the translate button was being displayed, but when requesting the translation, the remote translation validation failed due to: ''' validates :locale, inclusion: { in: ->(_) { RemoteTranslations::Microsoft::AvailableLocales.available_locales }} ''' That available_locales method did not contemplate these 3 languages in the format used by the application. To solve this problem the api response is mapped to return all locales in the format expected by the application. Add remote translation model test to ensure that a remote translation is valid when its locale is pt-BR. Co-Authored-By: Javi Martín <[email protected]>
javierm
approved these changes
Mar 15, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Upgrade Ruby to version 3.0.5 #5074
Objectives
:pt-BR
,:zh-CN
and:zh-TW
:gl
(Galego) and:sq
(Shqip). The only locale (of all the locales supported by consul) that is currently not supported by this translator is:val
(Valencià).Notes
This PR involves some changes in the documentation: Update remote translation docs #119