Open freddiemixell opened 8 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
a3efa8f
) 92.60% compared to head (5fb32e5
) 92.65%. Report is 13 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thank you @freddiemixell. Could you please add some tests?
No problem! I begin working on them already but alas the work week came and stole me away lol
I will have some time starting this weekend and I'm off all next week so I will wrap this up then if I don't find during the week.
@zerolab I figured out some intial tests. Let me know if you'd like more or any changes.
Happy holidays! ☃️
This is a solid start @freddiemixell
Can you update
and remove the notices, as well as add a section at the end on how to use this? Aside from that, I keep going back to the fact that for regular models we allow defining whether a field is translatable or is synchronised, and that we need to support this for
StructBlock
s. For example, in yourCustomImageBlock
we want the description to be translatable, but the image to be synchronised. I am making an assumption here as I am not fully geared to test things locally ('tis Christmas after all), but what happens in that case?
Hey @zerolab,
Thanks for checking this out on Christmas! (Tis Christmas made me lol)
I see what you're saying about the image block and synchronization. I'll investigate if this will cause any issues with synchronized fields today.
If you have any specific tests you're thinking of let me know and I'll try to hook it up, thanks again!
StructBlock:
Expected:
Result:
English Page
French Page
StructBlock:
Expected:
Result:
English Page
French Page
StructBlock:
Expected:
Result:
English Page
French Page
I'll add that I'm not sure why exactly this is working with the images. That is what I'm going to work on figuring out now so I could really get behind this or find any flaws.
Issue:
When overriding the image of the youtube button in the french version with a picture of the Eiffel Tower I still see the Youtube button.
I believe this means it's breaking the overridable segments somehow.
Update:
I reverted this change a second time, reset everything and now I do see the image block going through so this seems like a problem with this PR still.
Whats actually happening: After testing this a bit further I'm seeing that I was mistaken before. I was getting confused because I had an image field on my blog model and I was mistaking that for the image block. I changed it to another image and that revealed the issue.
translatable_blocks = ['description']
This prevents the images from being overridden, which is sort of enforced by this configuration if you wanted to prevent images from being changed for some reason.
translatable_blocks = ['image']
However, this configuration produces a different scenario where you can keep the same text but allow overriding the image. When I did this I was able to override the image successfully in the French version. Which means this isn't technically a bug but does allow for a little more control over nested images if you need it.
@freddiemixell the code tests should pretty much follow what you test as a user, manually
Hey @freddiemixell do you need any help / pointers on tests?
Hi @zerolab! 👋
I'm Daniel from the Mozilla Foundation, on a team that heavily relies on Wagtail/wagtail-localize for our projects.
We have a stakeholder request that would be directly fulfilled by the work in this PR.
We noticed that your team had previously offered assistance with adding tests, but there hasn't been a response yet.
We were wondering if there are any updates on this PR or an estimated timeline for when it might be merged. This information would help us set the right expectations with our own stakeholders.
Additionally, if there's anything we can do to help move this forward, please let us know!
Thanks 👍
Hey @danielfmiranda,
It is a difficult one in that I had lots of non-localize work to attend to.
If you/your team have the capacity, a PR that adds tests to this would move things quite a bit. Otherwise, I'll probably realistically get some time during Wagtail Space Netherlands which is mid-June.
This PR is attempting to allow users to mark certain sub-blocks of a struct block to be ignored like UrlBlock.
Example use case: blocks.py
In the above example the first block doesn't define the property so it goes through the code the same as before.
The second block only includes the description field, which technically doesn't matter because the image would be skipped regardless. However, I added it in to illustrate how you could exclude fields by simply not adding them to the list.
The last 2 examples we add the property but with an empty list. That will prevent any blocks from this struct block from being extracted.
Notes: Closes #307