joofu
December 18, 2019, 2:47pm
1
Hi,
I have a problem with the correct output of exception messages in a single-language site.
My setting:
Login-protected pages. Users should also be able to change their password and e-mail address. This works fine.
locale is set in the config file:
‘locale’ => ‘de_DE.utf-8’,
If an exception is thrown when the e-mail address is changed because this e-mail address already exists, the message is in English and not in German.
However, if I test a multi-language site and create a file language/de.php, the extension-message will be in the correct language.
What can I do?
texnixe
December 18, 2019, 7:15pm
2
Hm, good question. One option would be to actually define that single language like you did in your test. If you set your URL to /
, you will not notice the difference to a single language page, only all text files will have the language extensions.
This would work instead as well:
I18n::template($e->getKey(), null, $e->getData(), 'de');
Don’t know if there is a better way.
Turns out you could also set
Kirby\Toolkit\I18n::$locale = 'de';
in a template or controller where you want to call the Exception method.
opened 08:53PM - 18 Dec 19 UTC
In a single language site, it is not possible to set a I18n locale, so that exception messages are rendered in...
2 Likes
joofu
December 19, 2019, 1:09pm
3
Hi @texnixe
thank you for your quick response and your tips. Suddenly I have three working options
I will take one of the last two …