Newbie-Question: Complex datamodeling and multi-language

Just discovered Kirby and played with it, and it’s very exciting!
I would like to know if it’s easy to make more advance data models in combination with multi-language? (90% of our websites are multi-language)

Simple example:
We have a model Categories with 2 multi-language attributes: name, description and we have a model Products with 3 multi-language attributes: name, description, document.
A product belongs to a Category and a product can have sub products. (product parent_id)
Is this easy? Is it better to store multi-language models in a database and query the database?

Looking forward to hear what is possible!

Multi-language functionality is built-in into Kirby. It works by having translations in your /content folder, so instead of using just somemodel.txt as in a single language site, you have somemodel.de.txt, somemodel.en.txt` etc.

Products would usually be pages, so have a separate page folder which contains the translations:

/products
  - products.de.txt
  - products.en.txt
  - /product-one
     - product.de.txt
     - product.en.txt
  - /product-two
     - product.de.txt
     - product.en.txt

Each page can have as many fields as your model requires.

For the categories, you can either also use pages, or use a structure field (a field with subfields). These categories can then be queried in your products.

I think it would probably make sense if you set up a simple example project where you test this to find out if Kirby’s functionality is up to your expectations.

I suggest the following resources for a start:

1 Like