Automatic change of the default language config file

Hi there,

I’m working on multilang website and I change the language config file for that :

return [
    'code' => 'en',
    'default' => true,
    'direction' => 'ltr',
    'locale' => [
        'LC_ALL' => 'en_US'
    'name' => 'English',
    'translations' => getTranslations('en'),
    'url' => NULL

As you can see I just change one line, with a function that do the right thing for my application :

 'translations' => getTranslations('en'),

plugins / gdt-translations / index.php

use Kirby\Data\Txt;

function getTranslations($lang) {
    $strings = Txt::decode(
    return Yaml::decode($strings['translations']);

Is there any way to hook the creation of this file (en.php), and add automatically this ‘translations’ line as the user click ‘add language’ in the panel ?

It would prevent me to add this manually each tim they would create a new language…

Thanks a lot !

I’d register the translations in a plugin via the translations extensions, then you don’t need to fiddle with the language config files.