alkacon / opencms-core

The Java open source content management system by Alkacon Software
http://www.opencms.org
GNU Lesser General Public License v2.1
525 stars 576 forks source link

Language fallback with two locales in <localesdefault> does not work any more in OpenCms 14 #762

Closed tobias-karrer closed 1 year ago

tobias-karrer commented 1 year ago

As shown on https://documentation.opencms.org/opencms-documentation/template-development/localization/multilingual-websites/ we configured two default locales:

<localesdefault>
        <locale>en</locale>
        <locale>de</locale>
</localesdefault>

After updating from Opencms 10 to 14 showing english contents in german subtree still is fine, but the opposite way doesn't work correctly - contents in english subtree don't show german contents (when language node for "EN" isn't available)

Only the first localesdefault definition is considered

Switching the order in opencms-system.xml to

<localesdefault>
        <locale>de</locale>
        <locale>en</locale>
</localesdefault>

as well "switches" the behaviour.

gWestenberger commented 1 year ago

Your description is lacking in detail.

Possibly you have the locale property set to "en" in your English subtree? That would supercede the settings in opencms-system.xml - "en,de" would be the proper setting.

If this isn't the problem, please provide a minimal example for producing this behavior in a fresh OpenCms installation.

tobias-karrer commented 1 year ago

Setup: image image


Config 1:

<localesdefault>
        <locale>en</locale>
        <locale>de</locale>
</localesdefault>

OpenCms 10:

OpenCms 14:


Config 2:

<localesdefault>
        <locale>de</locale>
        <locale>en</locale>
</localesdefault>

OpenCms 10:

OpenCms 14:

gWestenberger commented 1 year ago

As I suspected, you have "en" in your locale property. You need "en,de" if you want "de" as a fallback. The OpenCms 10 behavior was a bug. Fixed with commit 07cc622d38d76018007e9f7d2e529cfb477eec1f , in OpenCms 11.

tobias-karrer commented 1 year ago

Ok, thanks. But then why fallback to "en" works even if I don't have "de,en" ?

tobias-karrer commented 1 year ago

And why is it possible to define multiples in opencms-system.xml (as shown in documentation: https://documentation.opencms.org/opencms-documentation/template-development/localization/multilingual-websites/) if only the first one is used?