Multilingual pages field

Hi. Is it possible to save the pages field content for all languages, upon creating/updating the main language? Now, when I select some pages in this field, they are not kept for the other languages.

You can set translate: false, then Kirby will automatically fall back to the default content.

However, if your translated pages have different IDs, I’m not sure if you will be redirected to the correct language version.

An example:

category.yml

title: Category

sections:
  items:
    type: fields
    fields:
      items:
        label: Jewels
        type: pages
        query: site.find('products').children.sortBy('date', 'desc')
        templates: product
        translate: false

When I save the page in Greek I get:

category.el.txt

Title: Κολιέ

----

Items:

- products/41233

and in English:
category.en.txt

Title: Necklace

----

Items: 

In the site, the Greek version shows the items, but the English is empty.

EDIT: I just realized that the Title is the page id, and that it must be the same for translated categories.

No, the title is not the page id, the page id consists of the page slug and the parent pages slugs.

It is true the the field is left empty in this case, but your output will still contain this content because Kirby automatically falls back to the content of the default language in these cases. So it is not necessary to store this content multiple times.

However, depending on whether or not you translate slugs for your different pages, this might or might not have the desired result.

Ok, translate: false naturally solved the problem. I was not getting the translated items on the front-end because I had some content files containing the pages field (‘Items:’ in my example) already set to nothing. :man_facepalming:t4: