Language.detect doesn't work

I made a multilingual website with French by default and English as secondary language. I set the generic config.php with languages.detect as stated by the documentation but it doesn’t work (tested by friends with English browers, by me with a language switcher Firefox add-on, with deleted cookies and private mode.

The documentation on this point just say to add this option so I don’t really now how to test it further or knowing if I did the good thing.

Did I miss something?

1 Like

Are you sure languages.detect is for Kirby 3?

I only find $kirby->detectedLanguage() in the docs.

Yes, but the option is called languages.detect, it is queried here: https://github.com/getkirby/kirby/blob/c9dcfb5a79af7951a6be6dcecd202d9c8a01b28e/config/routes.php#L141

<?php var_dump(option('language.detect')) ?> returns bool(true), so I assume it’s ok, but I don’t know why it’s not working.

<?= $kirby->detectedLanguage() ?> returns fr when the browser is in french, en when the browser is in english, and fr if the language is not english (don’t know why it doesn’t detect the real language though, maybe it only detect the applied/available language).

So the option seems to work, but not the redirecton / auto switch, and I can’t figure out why, and don’t know how to test it further.

1 Like

It seems linked to this bug (no redirect if default language set without language code) : https://github.com/getkirby/kirby/issues/1924