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

Translation submit/update form components #491

Merged
merged 17 commits into from
Nov 26, 2021

Conversation

zerolab
Copy link
Collaborator

@zerolab zerolab commented Nov 22, 2021

This PR provides a mechanism to add new form components to the submit/update translations views.

It takes the existing mechanism used on the locale edit forms

When submitting a translation we can get one or more translation sources with at least one corresponding translation sources. This should be accounted for by hte new TranslationComponentManager.

New component registration can be done using the new register_translation_component decorator

@register_translation_component(
    heading=gettext_lazy("My component"),
    help_text=gettext_lazy("Help text to describe what this is needed for"),
    enable_text=gettext_lazy("Add custom component data"),
    disable_text=gettext_lazy("Do not add custom component data"),
)
class MyTranslationComponent(model.Model):
    pass

Did not yet add documentation as register_locale_component is not documented. Let's discuss

@zerolab zerolab force-pushed the feature/submit-translation-components branch 6 times, most recently from 2acdd61 to 6b0fc39 Compare November 23, 2021 11:01
@zerolab zerolab force-pushed the feature/submit-translation-components branch from 6b0fc39 to e24f0b3 Compare November 23, 2021 16:16
@codecov-commenter
Copy link

Codecov Report

Merging #491 (d25aefb) into main (f6f6b00) will decrease coverage by 0.20%.
The diff coverage is 88.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #491      +/-   ##
==========================================
- Coverage   93.02%   92.82%   -0.21%     
==========================================
  Files          35       36       +1     
  Lines        2868     2981     +113     
  Branches      449      467      +18     
==========================================
+ Hits         2668     2767      +99     
- Misses        104      114      +10     
- Partials       96      100       +4     
Impacted Files Coverage Δ
wagtail_localize/views/update_translations.py 92.95% <72.22%> (+0.53%) ⬆️
wagtail_localize/components.py 85.56% <85.56%> (ø)
wagtail_localize/locales/views.py 97.22% <100.00%> (-0.20%) ⬇️
wagtail_localize/test/models.py 97.39% <100.00%> (+0.18%) ⬆️
wagtail_localize/views/submit_translations.py 93.83% <100.00%> (+0.40%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f6f6b00...d25aefb. Read the comment docs.

Copy link
Contributor

@kaedroho kaedroho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good to me, nice work!

@zerolab zerolab merged commit 31f9dd1 into wagtail:main Nov 26, 2021
@zerolab zerolab deleted the feature/submit-translation-components branch November 26, 2021 16:39
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

Successfully merging this pull request may close these issues.

3 participants