Different templates per language in Kirby 3

template
panel
languages
#1

Hi,

I’m trying to migrate a website from K2 to K3 and I’m using the new panel.

In the K2 install I had my content folder setup like this:

content/1-about/overons.nl.txt
content/1-about/about.en.txt

My templates looked like:

site/templates/about.php
site/templates/overons.php

Both pages could be edited with the panel in K2, but in K3 this doesn’t seem to be possible.

I’ve started rebuilding the content for my site three times already, but every time the template names are reset. :frowning:

My process is as follows:

  1. I create a new page in the default language (NL)
  2. The content gets saved as default.nl.txt
  3. I change the template name in the filename by changing default.nl.txt to overons.nl.txt
  4. So far so good
  5. I add the new language (EN) and try to change the filename to about.en.txt to link the English template and after saving the panel created a new file overons.en.txt

I’m then left with three files in my content folder: overons.nl.txt, about.en.txt and overons.en.txt. The about.en.txt file never gets updated when working in the panel and the linked template is the Dutch one for both languages.

Is this a bug, or am I missing something?
Is it even possible to use different templates for each language in Kirby 3?

Cheers,
Rutger

0 Likes

#2

This is such a weird setup. May I ask you why do you need different templates for the same page in different languages? Maybe there’s an alternative approach we can use here to tackle the problem.

0 Likes

#3

Because the template contents differ and some parts are too complex to setup with editable fields.

0 Likes

#4

Just thinking out loud here but couldn’t you for example keep the part in common inside the same template and then load the parts that are different via snippets based on the current active language?

0 Likes

#5

That’s always an option ofcourse. Thing is the current site is build in 2.1.1 and not updated for a while. I believe the recent 2.x release also doesn’t play nice with language dependent templates?

I’d like to port the content over and continue to work on the site.

Question here is: is this even possible in Kirby 3?

0 Likes

#6

Honestly I thought this wasn’t even an option with K2. I always thought you needed matching templates because kirby uses the default language as a fallback to fill in missing content.

So I guess you can’t really do that. I started on Kirby around v2.5 so can’t really tell if this was possible before that due to some bug.

0 Likes

#7

Your setup with different content files is not supported in K2 or K3, if it worked in your version, then due to a bug.

0 Likes

#8

Thanks for your reply @texnixe. I’ll rebuild the templates for the project.

0 Likes