Multi-environment for 3 different pages with different language setup

Hey there,

Another question that popped up while migrating from kirby 2 to kirby 3.
We have a multi-environment setup for 3 different product landingpages, that all share the same styles, templates and assets. One of them is in DE, EN, FR and IT, two others are just in DE and EN.

With kirby 2 two I just defined the languages per page in each config file.
How can I solve this in kirby 3? Should I do some logic in the language files or is there a more elegant way?

Thanks in advance!

Since the languages folder has its own root, it should be possible to set them up depending on environment.

Thanks for you answer!
According to the docs I could not find a way to set the languages root per language.


Languages is not listed here as configurable root.
How did you think of setting it up depending on environment?

Best, Marco

Like in the link I posted above: https://getkirby.com/docs/cookbook/setup/multisite#setting-up-your-multisite

Here are all roots: https://github.com/getkirby/kirby/blob/master/config/roots.php

According to my understanding, they should all be configurable. I might be mistaken, but worth a try.

So what you could do (or at least try) is set up three different language folders languages-domain1 etc. and set the root according to domain. I currently don’t have another idea.

I just tried to do this, but unfortunately it does not seem to work…

According to this link in the docs, the languages root seems also not to be configurable:

Anyone who could solve a similar issue in kirby 3 already?

I could solve it now with a domain check in the corresponding languages file.
In case it might help someone in the future, here’s my solution:

<?php
$sites = [
    'domain1.com' => 'domain1.com',
    'domain1.local' => 'domain1.com',
    'domain2.com' => 'domain2.com',
    'domain2.local' => 'domain2.com',
];

$host = Url::host();
$root = $sites[$host];
$domain1 = 'domain1.com';
$domain2 = 'domain2.com';

if($root ==  $domain1):
return [
  'code' => 'it',
  'locale' => 'it_CH',
  'name' => 'Italiano',
  'url' => '/it',
];
endif;