i am not sure if this is really a bug, but:
I have 2 languages active on a site (german as default, english as second) and if i turn off the /de url particle via config (‘url’ => ‘/’) the locale won’t be set anymore for the english language. It stays de_DE.
If i turn back to each having their distinctive url particle, everything works fine…
Is this a feature or a bug?
What does your locale config look like in both languages? Which Kirby version?
Kirby Version: 3.4.0
Locale config is for german: ‘locale’ => ‘de_DE’, & english: ‘locale’ => ‘en_EN’,
How do you test that the locale is not correct anymore? Have you set language detection? Or what exactly is the issue?
i have a date field that should show the weekday in its language. It never did, so i started digging.
here you can see two versions of a kirby install:
in Version 2 i have added to the german language file this: ‘url’ => ‘/’
I am currently testing by just asking for the date:
<?php $date = strftime('%A, %d.%m.%Y'); echo $date; ?>
<?php $currentLocale = setlocale(LC_ALL, 0); echo $currentLocale; ?>
The currentLocale gives me in version 1 a de_DE for german and a C for english.
In version 2 it always stays de_DE.
The locale should be set like this
'locale' => [
'LC_ALL' => 'de_DE.utf8'
I have a current project where dates work without issues with this setting and no language string in the URL for the default language.
Mhh, i changed the locale, but i think my problem is more basic. When i change the language, the locale doesn’t change at all. Stays de.
For my current project i just turned to a /de & /en logic, so it works and i think its no harm to have the /de string in there. i was just wondering, why this is happening, but i have no experience and tools to test anything that would explain it.
Did you try to follow Kirby docs: Introduction - Using different domains for each language added by “.utf8” or “.utf-8” (without “
If you type
locale -a into your terminal, what are the installed locales? You should get a list similar to this one and can then compare if what is set in your language definition is available on the server:
LC_ALL setting should be present.
If your webserver runs on Windows OS, then follow
Language Strings and Country/Region Strings
on MSDN for the stings,
e.g. for German you should use
This tip is based on PHP docs: setlocale:
Windows users will find useful information about
locale strings at Microsoft’s MSDN website. Supported language strings can be found in the » language strings documentation and supported country/region strings in the » country/region strings documentation.
Hello @texnixe & @anon77445132,
i think i have to give up, because i tested it on my server and on my local machine, and i have different results (server: de_DE.utf8 for both languages / localhost: de = C, en = en_US).
Both results are unsatisfying, but i found my workaround and leave it now. My knowledge of connecting to a webserver via Terminal or even finding out which system runs on the server (hetzner) is beyond my abilities.
Thanks so far and so much.
Nevertheless I say thank you very much for your support.
Can you please tell us the OS of your servers here, could be important for further evaluation…
site/config/config.php I set now for my German (one language) websites:
// set 'locale' to '' (or 'deu_DEU.utf8' or 'German_Germany.utf8') for Windows servers and to 'de_DE.utf8' for the rest
'locale' => [
LC_ALL => r((strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'), '', 'de_DE.UTF8')
So there is no difference between my Windows development environment and the (Linux) live webserver for the file
Independent of this I use an additional file
site/config/config.127.0.0.1.php for the development environment. This webserver XAMPP runs on my Win10 laptop…
For a multilingual website, you can add a corresponding functionality in the
/site/languages/*.php files, if you need this. But I think, this is NOT necessary.