Overwrite multi language domain setting locally


#1

Hello!

I set up different domains for each language. How do I overwrite this for my local environment where I don’t want to be redirected to the live version of the page?

Back in v2 this was possible via a domain specific config file. Since this is defined in the language files now I don’t know how to overwrite it.

Btw. Kirby 3 is great so far – thanks a lot for all the love you folks put in <3


#2

Unfortunately, this is a bit more complicated now but possible.

You can set up different translation roots depending on domain like in this post Kirby 3 and multisite, but instead of setting all the roots, you would set only the translation root for localhost (or you local test domain).

That would be something like this (not tested):

<?php

require 'kirby/bootstrap.php';


if(url::host() == "localhost") {
     $kirby = new Kirby([
        'roots' => [
            'translations'   => __DIR__.'/site/localtranslations',
           
        ]);
     echo $kirby->render();
} else {
   
     echo (new Kirby)->render(); 

}