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

Remote Translation #17

Closed
taitus opened this issue Dec 25, 2018 · 1 comment
Closed

Remote Translation #17

taitus opened this issue Dec 25, 2018 · 1 comment

Comments

@taitus
Copy link
Member

taitus commented Dec 25, 2018

References

Related issues: #14

Objectives

  1. Detect missing translations:
    Create concern to reuse the logic of detection of non-existent translations in Controllers.
Pages Resources where we search missing translations Controller
Proposals index proposals, featured_proposals throught CommentableActions
Proposal show proposal, comments throught CommentableActions
Debates index debates throught CommentableActions
Debate show debate, comments throught CommentableActions
Budget Investments index budget_investments InvestmentsController
Budget Investments show budget_investment, comments InvestmentsController
Home Feeds(proposals), Feeds(debates), Feeds(legislation_processes), recommended_debates, recommended_proposals WelcomeController
  1. Add feature setting to enable/disable:
  • detect missing translations
  • send request to translate
  1. Add a remote translation button to pages where we detect missing translations on current request locale

  2. Create RemoteTranslations Controller and RemoteTranslation model:
    Receive resources without translations and create RemoteTranslation instances when theirs translations are not enqueued. After create a remote translation order missing translations via DelayedJobs.

  3. Create RemoteTranslations Caller:

  • extracting resources associated from RemoteTranslation and preparing its fields to be sent to the MicrosoftTranslateClient.
  • receive the response from MicrosoftTranslateClient and update resource with her translates
  1. Microsoft Translate Client: Create a client for remote translation service that receive array of strings with a locale, and returned these strings translated. Use gem translator-text as API Wrapper for the Microsoft Translator Text API 3.0.

Visual Changes

Desktop version #Index
captura de pantalla 2018-12-27 a las 10 54 14

captura de pantalla 2019-01-03 a las 17 17 07

Notes

  • Use guide:

    • Active Remote Translations Settings: Setting["feature.remote_translations"]
    • API key:
      • You must have an API key and for that you need an Azure account
      • Once logged on your Azure portal, subscribe to the Translator Text API in Microsoft Cognitive Service.
      • You will find two subscription keys available in 'RESOURCE MANAGEMENT > Keys' ('KEY 1' and 'KEY 2').
      • Add to secrets.yml the new api key as microsoft_api_key on api's section.
  • WIP features:

    • MicrosoftTranslateClient:
      • Make sure that DelayedJob in case of an error response from the translation client, re-sends the request correctly.
      • Manage missing remote languages: Not all the application languages are supported by Microsoft Translate Client. We thought as solution of initializing a variable with the available languages of Microsoft Translate Client that is calculated after each reboot, and not display the translation button if the language we are trying to translate is not available.
    • Remote Translations Caller:
      • Update Resources: What happens if we translate a Proposal Title: "Rojo" into English. The title will be "Red" and it will be too short to pass the validations. This same case can occur not only with the minimum size but also with the maximum size). Can you think of a way to solve this problem?
        Currently we have created an error_messages field in RemoteTranslations to save errors when there are validation errors. Would it be convenient to notify administrators that there is a requested translation that could not be saved due to validation errors?
    • User interface: A user will see the translation button whenever the page has untranslated content, regardless of whether those translations are already enqueued. I can't find a good solution for this point.
@taitus
Copy link
Member Author

taitus commented Jul 9, 2019

Close via: consuldemocracy#3237

@taitus taitus closed this as completed Jul 9, 2019
Senen pushed a commit that referenced this issue Jun 29, 2021
taitus pushed a commit that referenced this issue Feb 15, 2023
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

1 participant