HJR
July 1, 2020, 11:18am
1
Hi, i have changed the default language via config:
/site/config/config.php
<?php
return [
'debug' => true,
// kirby: panel
'panel.install' => true,
'panel.language' => 'de',
// php: german locale
'locale' => 'de_DE.utf-8',
'timezone' => 'Europe/Berlin',
'date.handler' => 'strftime'
];
But the translation is still ‘en’. I have checked this in a template with:
<?= 'Translation.Code: ' . I18n::locale(); ?>
and
<?= 'Translation.System: ' . I18n::translate("copy", "Das war's noch nicht."); ?>
Result: Translation.Code: en
and Translation.System: Copy
.
What do i miss?
Setting the locale like that in your config has no effect on the I18n::$locale
variable. You have to set that static variable in your config:
Kirby\Toolkit\I18n::$locale = 'de';
(before the return statement)
HJR
July 1, 2020, 3:25pm
3
Hi @texnixe
Sorry, no luck, even after upgrading to Kirby 3.3.6, disabling all plugins except the gallery
-plugin from the Starterkit, clearing the browser-cache, checking with FF 77.0.1 and MS-Edge 83.0.478.58, PHP 7.3.18.
Just to make shure:
/site/config/config.php
<?php
// german translation setup
Kirby\Toolkit\I18n::$locale = 'de';
return [
'debug' => true,
...
];
Could you please crosscheck in your installation?
BTW: Where could I have found this information in the docs?
Thank you…
i
Ah, sorry, yes, setting it in config doesn’t make sense because Kirby isn’t initialized yet. You have to set it where you need it, e.g. in a controller.
HJR
July 1, 2020, 8:06pm
5
Hi @texnixe ,
this is a hard workaround because then everytime i have to touch all the controllers and plugins sourcecode.
Would it make more sense to have a simple config-option like: 'translations' => 'de'
?
Could you please write an issue, because i didn’t have a github-account.
Thank you…
There is already an ideas issue and a workaround in the last comment:: https://github.com/getkirby/ideas/issues/459