wagtail-localize icon indicating copy to clipboard operation
wagtail-localize copied to clipboard

Translation of models with ParentalManyToManyField

Open hpoul opened this issue 3 years ago • 5 comments

My try to fix #563 I basically duplicated the code from django-modelcluster copy_cluster: https://github.com/wagtail/django-modelcluster/blob/8666f16eaf23ca98afc160b0a4729864411c0563/modelcluster/models.py#L386-L392

hpoul avatar May 04 '22 14:05 hpoul

@zerolab thanks for taking a look

Can you rebase on latest main and re-generate the migration? we reduced the test app migrations to just 0001_initial

i've now rebased. I'm not sure about the migrations.. i've deleted the old once and recreated a new one.. Was this what you meant, or should it also be part of the 0001_initial migration? 🤔

This works well to sync the values, but they are not exposed in the edit translation UI which could potentially cause additional confusion

Are SynchronizedFields actually exposed in the translation UI? 🤔 Should this simply list the selected IDs or str() of the objects?

Would it be possible to make this as part of a separate PR? This error blocks me from translating some content in my project.. hopefully the last problem 😬

btw. do you know of some easy way to use a forked version as a dependency? The problem is including wagtail-localize as a git dependency doesn't work because it would require manual npm build to generate the static files.. 🤔 I guess I could just commit the generated files into my forked git repo, but that would make merging pretty cumbersome..

hpoul avatar May 06 '22 19:05 hpoul

On using a fork.. you cannot really do it because of the FE assets.. best to build it locally and host the built package somewhere you can install from a URL

Will revisit the synchedfield question tomorrow.

zerolab avatar May 06 '22 19:05 zerolab

Hey @hpoul,

SynchronisedField, or "overridable segment", does show in the UI. By default it syncs the value from the source, but the value can be overridden. See https://www.wagtail-localize.org/concept/segments/#overridable-segment

zerolab avatar May 09 '22 17:05 zerolab

Did this make it into v1.2? I'm having the exact same problem.

zemogle avatar May 24 '22 13:05 zemogle

@zemogle this PR is still open, so it did not, I'm afraid

zerolab avatar May 24 '22 14:05 zerolab

@hpoul I am having the same problem and your fix would be very useful. It has been a while, but what is the state of this PR? Is there a way to help you getting this PR merged? Thanks!

lvonlanthen avatar Jun 29 '23 11:06 lvonlanthen

@lvonlanthen see https://github.com/wagtail/wagtail-localize/pull/564#pullrequestreview-964839332

This works well to sync the values, but they are not exposed in the edit translation UI which could potentially cause additional confusion

I don't have enough time it understanding in the inner workings of the wagtail admin to fix this.. feel free to take over this PR.. 🤷‍♂️

hpoul avatar Jun 29 '23 13:06 hpoul

I've rebased on main and squashed commits.. is there any chance to get this merged without the UI when it's not synchronized? @zerolab At least it fixes the exception when creating the translation.. I don't see how it would make anything worse..

hpoul avatar Sep 30 '23 10:09 hpoul

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (e2de395) 93.27% compared to head (123f06d) 93.23%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #564      +/-   ##
==========================================
- Coverage   93.27%   93.23%   -0.04%     
==========================================
  Files          47       47              
  Lines        3908     3918      +10     
  Branches      579      583       +4     
==========================================
+ Hits         3645     3653       +8     
  Misses        154      154              
- Partials      109      111       +2     
Files Coverage Δ
wagtail_localize/test/models.py 98.80% <100.00%> (+0.01%) :arrow_up:
wagtail_localize/fields.py 91.22% <71.42%> (-1.37%) :arrow_down:

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Sep 30 '23 10:09 codecov-commenter

@hpoul now in https://github.com/wagtail/wagtail-localize/releases/tag/v1.6 sorry for the delay!

zerolab avatar Oct 06 '23 16:10 zerolab