-
Notifications
You must be signed in to change notification settings - Fork 87
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 machine translators skip fields #819
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #819 +/- ##
==========================================
- Coverage 93.07% 93.02% -0.05%
==========================================
Files 47 47
Lines 4144 4146 +2
Branches 704 705 +1
==========================================
Hits 3857 3857
- Misses 173 174 +1
- Partials 114 115 +1 ☔ View full report in Codecov by Sentry. |
Any chance you could add a test or two? |
To add tests I would need to add a machine translator that could fail. |
You could mock patch https://github.com/wagtail/wagtail-localize/blob/main/wagtail_localize/machine_translators/dummy.py#L23 for your test only |
For my first implementation I would need to patch the translate method in the DummyTranslator class. I've extended the implementation to check if the StringValue data is null. Added tests for both of them and it seems to be working. |
Currently there is no way to keep a field not translated in case of issues with the machine translator.
Setting the value to an empty StringValue will show the field as translated in the admin.
This patch will let machine translators omit the key value pair to keep the field not translated.
(Sorry for the double PR, had issues with my linter)