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

Let installations delay TranslatorJob initialization #7507

Merged
merged 2 commits into from Mar 3, 2021

Conversation

alecslupu
Copy link
Contributor

@alecslupu alecslupu commented Mar 2, 2021

🎩 What? Why?

Added a translation delay seeting, as sometimes the translation fails with the following output.

2021-03-02T13:50:48.118Z pid=1 tid=abwx class=Decidim::MachineTranslationResourceJob jid=a57362e645ca56706d9865b9 INFO: start
D, [2021-03-02T13:50:48.138439 #1] DEBUG -- :   Decidim::Comments::Comment Load (6.3ms)  SELECT "decidim_comments_comments".* FROM "decidim_comments_comments" WHERE "decidim_comments_comments"."id" = $1 LIMIT $2  [["id", 300], ["LIMIT", 1]]
E, [2021-03-02T13:50:48.139238 #1] ERROR -- : Discarded Decidim::MachineTranslationResourceJob due to a ActiveJob::DeserializationError.
2021-03-02T13:50:48.139Z pid=1 tid=abwx class=Decidim::MachineTranslationResourceJob jid=a57362e645ca56706d9865b9 elapsed=0.022 INFO: done

This is caused mainly due to fact that sidekiq is attempting to run the job before the transaction from enqueue is finished.

When submitting translatable content in non default language it fails due to missing keys. The content can be sent as:

title: { I18n.locale => parsed_title },

Yet, the translation will check for the default locale which is not set. Therefore the MachineTranslationFieldsJob may be set as :

Decidim::MachineTranslationFieldsJob.perform_later( @resource , "title", nil, "ca", "es")

📌 Related Issues

Link your PR to an issue

  • Related to #?
  • Fixes #?

Testing

  1. Visit and login to the test platform
  2. Change the language to a non default language
  3. Visit any Participatory Process add a new ( Proposal, Meeting) from the interface
  4. Observe that there is no translation there
  5. Apply the patch
  6. Repeat steps 3 + 4

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

📷 Screenshots

Please add screenshots of the changes you're proposing
Description

♥️ Thank you!

@alecslupu alecslupu changed the title Adding translation delay Translator not working for localized content Mar 2, 2021
@alecslupu alecslupu marked this pull request as ready for review March 2, 2021 21:20
@alecslupu
Copy link
Contributor Author

@mrcasals please retrigger the failing spec. I have run it locally, and there is no failing test on my host.

@mrcasals
Copy link
Contributor

mrcasals commented Mar 3, 2021

@alecslupu this is a random test that I can't seem to reproduce in my local machine :(((

@mrcasals mrcasals changed the title Translator not working for localized content Let installations delay TranslatorJob initialization Mar 3, 2021
@mrcasals mrcasals added module: core type: feature PRs or issues that implement a new feature labels Mar 3, 2021
@mrcasals mrcasals merged commit 1059b50 into decidim:develop Mar 3, 2021
@mrcasals mrcasals deleted the ale-fix-translator branch March 3, 2021 07:58
entantoencuanto added a commit that referenced this pull request Mar 4, 2021
* develop:
  Update the workflow cleanup action to the latest version (#7535)
  Don't schedule CI jobs for locales PRs (#7534)
  Fix record encryptor trying to decrypt or decode non-String values (#7536)
  Add Votings landing page to the design app (#7527)
  New Crowdin updates (#7530)
  Fix non-unique IDs element in filter hash cash (#7531)
  New Crowdin updates (#7485)
  Add statistics cell to votings landing page and reuse it in other places (#7413)
  Add Votings landing page layout (#7440)
  Add share modal to budgets (#7519)
  Do not change the global test app configs during specs (#7525)
  Change the order of attachments in budgets (#7524)
  Remove console warnings from the conversations views (#7523)
  Don't allow filtering meetings by user group if setting is disabled (#7514)
  Remove duplicated migration (#7517)
  New Admin users cannot accept Terms and conditions (#7516)
  Let installations delay TranslatorJob initialization (#7507)
  Exit on CI workflow dispatch failures (#7502)
  Invalidate all user sessions when destroying the account (#7506)
  Audit vote (#7442)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: core type: feature PRs or issues that implement a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants