Machine translation display priority#6385
Merged
mrcasals merged 16 commits intofeat/machine-translationfrom Aug 14, 2020
Merged
Machine translation display priority#6385mrcasals merged 16 commits intofeat/machine-translationfrom
mrcasals merged 16 commits intofeat/machine-translationfrom
Conversation
Presenteers weree not properly setting the `current_organization` helper method, but we can access the `resource.organization` anyway, so this commit does that.
We need to use RequestStore because we translate things from inside presenters, which don't have any access to the request status and instance variables. With RequestStore we can store info per request. It's a dependeency of another dependency (PaperTrial), so this commit is just promoting it as a base dependency.
Contributor
Author
|
@decidim/core can you review this PR, please? It adds a button to toggle the translations (only shown if translations are active) and adds some tests ensuring the whole workflow works as expected. |
mrcasals
added a commit
that referenced
this pull request
Aug 14, 2020
mrcasals
added a commit
that referenced
this pull request
Aug 14, 2020
tramuntanal
pushed a commit
that referenced
this pull request
Aug 17, 2020
* Base branch * remove file * Base branch * remove file * Identify translatable resources (#6145) * Base branch * remove file * Require confirmation on exiting a survey mid-answering (#6118) * Require confirmation on exit * Add specs * Use path instead of url * Fix changelog * Trigger build * Fix expected path on test * Fix method call * Take textareas and selects into account * WIP adding concern * Adding concern in all the models which have translatable fields * removed :extended_data as translatable field * WIP adding concern * Adding concern in all the models which have translatable fields * Revert "Require confirmation on exiting a survey mid-answering (#6118)" This reverts commit bdeb933. * Revert "remove file" This reverts commit 2565dbb. * Revert "Base branch" This reverts commit 2a09cc4. Co-authored-by: Marc Riera Casals <mrc2407@gmail.com> * Add Decidim global and organization config for machine translation (#6128) * Adding setting to organizations table and creating global config * Adding config accessor to core.rb * Base branch * Added a check to display machine translation settings and changed initializer value * Fixing lint issue in migration file * Adding test and removing test file Co-authored-by: decidim-bot <decidim-bot@users.noreply.github.com> Co-authored-by: anagha <anagha1996@gmail.com> * Identifying translatable fields in meetings and comments (#6333) * Base branch * remove file * Idenifying translatable fields in meetings and comments Co-authored-by: Marc Riera Casals <mrc2407@gmail.com> * Identifying translatable fields for proposals (#6346) * Add machine translation service (#6179) Co-authored-by: Marc Riera Casals <mrc2407@gmail.com> Co-authored-by: Marc Riera <mrc2407@gmail.com> * Make some fields non-translatable * Improve spec * Don't run job if class is not defined * Improvee method naming * Machine translation display priority (#6385) * Add docs on how to enable the integration * Add docs on how to write a machine translation service * Improve code strength * Fix specs * Fix specs Co-authored-by: anagha vl <44900292+anaghavl@users.noreply.github.com> Co-authored-by: decidim-bot <decidim-bot@users.noreply.github.com> Co-authored-by: anagha <anagha1996@gmail.com>
This file contains hidden or 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
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.
🎩 What? Why?
This PR adds a new configuration to organizations: whether to show the machine-translated or the original text first.
Depending on the installation, admins might want to show the translations first, or the original teext first, so we want to make this configurable. This PR does just that.
It also shows a button to toggle translations. This means that if the user is seeing the machine translations, then the button will allow the user to see the original texts, and the other way around.
For the button, I had to introduce a new dependency:
RequestStore. This dependency is already a dependency ofPaperTrail, so there's not much change here. It is needed to solve one bug: when the user clicks the toggle translations button, we'd usually save this in an instance variable in the controller. But when we use presenters to render the translations, we don't have access to the controller instance variables, and we're never aware of that toggle request. WithRequestStorewee can save parameters per request, in a global way, so we can access them from the presenters. I tried different options and considered moving the presenters to some other gem, but it seemed like a lot of work right now.RequestStoreended up being the simplest solution.This PR is part of the work done at #6127.
📌 Related Issues
📋 Subtasks
📷 Screenshots (optional)