getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.31k stars 168 forks source link

3.1.0 breaks expected multilingual behavior for the site root when default language has url set to / #1599

Closed moefuerst closed 5 years ago

moefuerst commented 5 years ago

Describe the bug When the root URL is set for the default language in a multilingual installation of Kirby 3.1.0, accessing / instead returns the secondary language version.

Example: A multilingual installation has en set as default language and should be accessible at the root URL of the site: domain.com/. Therefore 'url' => '/' is set in the language configuration file en.php. The secondary language de has no url set and thus defaults to domain.com/de/. However, accessing domain.com/ returns the de localization, not en (=default).

If no url, or an url not / is set for the default language, the behavior is as expected.

To Reproduce Steps to reproduce the behavior:

  1. Set up a starterkit with two languages, set 'url' => '/' for the default language
  2. Add a localized content file for the home page in the secondary language (e.g. set the title to 'Startseite')
  3. Access the home page at /
  4. The localized home page is loaded instead of the default language version

Expected behavior Accessing the home page at / should return the default language version of the site.

Kirby Version 3.1.0

texnixe commented 5 years ago

I can't reproduce this, works like expected for me.

moefuerst commented 5 years ago

I will try in a different environment and report back.

Here is the language configuration used:

/site/languages/en.php

<?php
return [
  'code' => 'en',
  'default' => true,
  'direction' => 'ltr',
  'locale' => 'en_US',
  'name' => 'English',
  'url' => '/',
];

/site/languages/de.php

<?php
return [
  'code' => 'de',
  'default' => false,
  'direction' => 'ltr',
  'locale' => 'de_AT',
  'name' => 'Deutsch',
];

For testing the localization, I just created home.de.txt with a localized Title: in the content folder and added <?= $page->title() ?> to the header snippet.

texnixe commented 5 years ago

Did you use a fresh Starterkit?

moefuerst commented 5 years ago

Did you use a fresh Starterkit?

Yes. Fresh download and no changes made other than the ones outlined above.

I tried on my server too now, here's a live demo: Notice http://static1.moritzfuerst.net/kirby/ and http://static1.moritzfuerst.net/kirby/de both show the German localization, the English version (which should say "Home") cannot be accessed.

texnixe commented 5 years ago

No? The English version says home (albeit with a lower h, as if the page had no proper title), and the German version says Startseite?

Screenshot 2019-03-19 at 19 04 48 Screenshot 2019-03-19 at 19 04 57
moefuerst commented 5 years ago

Thanks for checking it out. It seems Safari (12.0.3 on macOS 10.13.6) is somehow to blame (issue persists even after a cache flush), works as expected in Firefox.

However, this

albeit with a lower h, as if the page had no proper title

is weird too, it's capitalized in the content file.

texnixe commented 5 years ago

I use Safari myself (12.0.3 on 10.14.3), so I don't think this is a Safari issue.

Does your English text file have the locale extension?

texnixe commented 5 years ago

https://github.com/getkirby/kirby/issues/1603