Open evertalbers opened 3 years ago
I can confirm that something is not working as intended, i'm having the same problem with my Bolt 5.0.2 project. It happens when i have a collection with a set where some fields are localized, the specific part of the contenttype:
highlights:
type: collection
label: Highlights
group: Highlights
fields:
contentset:
type: set
label: Highlight
fields:
highlight_text:
type: text
label: Naam
localize: true
highlight_image:
label: Icoon (voorkeur een SVG bestand)
type: image
extensions: [ gif, jpg, png, svg ]
upload: icons
Steps to reproduce the problem:
Maybe the problem in this case is that the image field is not localized, so the image fields are filled in in the NL locale but when switching to the EN locale those fields are empty. Perhaps when saving them in the EN locale it saves the images as empty for all locales?
I hope this helps with pinpointing the problem.
Edit: After re-adding the images on the NL locale > save > everything is working again until editing the sets on another locale.
Looking at this, I can see that there may be some weirdness going on here. The collections/sets are intended to be either fully localized or fully non-localized. I can't picture how a part of a set would be localized, but the other part would not 🤷♂️
And, given that, I think the "safest" way is to put them all as localized (or at least the top-level item, either the collection or the set depending on what it is).
Fair enough, it does indeed work as intended if all the fields in the set are localized. In my specific use case there wouldn't be a need to "translate" the image field since the same image is used regardless of the locale.
But that was an assumption from my side, thanks for clearing it up :)
No worries! I can see how that would be useful, yes.
Same thing here, with the non-translated images. I can live without, but I would have to test if (in my example)
contentblocks:
type: collection
label: Content Blocks
group: Extra Content Blocks
localize: true
and omitting all other "localize
s" falling under contentblocks
will work well.
hey @evertalbers , @mcdennem just bumped into this today and it seems to break the localization. Each field inside a collection should be localized, or it will only be available in the default locale.
Hi @I-Valchev finally had the time to try this out. Translating all fields seems to work indeed, so that's some progress. I used the field defs. below:
contentblocks:
type: collection
label: Content Blocks
group: Extra Content Blocks
localize: true
fields:
partnerlistitem:
label: Partner list item
icon: "fa-coffee"
type: set
localize: true
fields:
partnertitle:
type: text
label: "Partner title"
postfix: "<h4>Only shown in the backend to keep things orderly</h4>"
localize: true
partnerlogo:
type: image
upload: "logos"
localize: true
partnertext:
type: redactor
localize: true
So in my case there seem to be 2 options:
If this is the way to go for multilocale collections I suggest making an addition to the docs.
partners
viewless block contenttype (multi-locale text and single-locale partnerlogo
fields),
and use a single-locale collection with "Populate-values-from-a-ContentType - selects" on the visible contenttype that link to the desired records. Less work for the editor but also less intuitive.
For me even if I localize all nested items it is not working. If I change something in one locale, all of the data in other is deleted.
But not everywhere. If I have that on my homepage, then translations are disappearing, and if I create viewless contenttype with translatable collection, it is OK ?!
Download this Bolt instance with only the affected contenttype to reproduce the bug: Wetransfer
In a localized Bolt 5.0.2 with
When I fill in a second or third
partnerlistitem
, content in the preceedingpartnerlistitem
is deleted. I cannot put my finger on what gets deleted when, but I think that at leastpartnerlogo
fields in the existingpartnerlistitem
s are deleted/emptied whenever a newpartnerlistitem
is added - even before you add content to the new item.In this usecase, ideally the same logo would be shown for all languages, so you don't have to fill that in twice. As you can see I tried some variations with the places where
localize: true
is applied, I don't think I saw any difference.As mentioned in line 1, you can use this zipped Bolt instance (or set up a fresh one using its config files, and the theme directory) to reproduce the bug Wetransfer.
Start with an empty page and (in the #extra-content-blocks tab) add 2 or 3
partnerlistitem
s, saving in one or both languages and refreshing at the frontend after adding each new item. You should see some of your previously entered content disappear.When trying this out, please note that
partnertitle
is not supposed to be shown in the frontend, only thepartnertext
.