dachcom-digital / pimcore-i18n

Pimcore - i18n Manager
Other
28 stars 18 forks source link

active language is ambiguous #136

Closed benwalch closed 1 year ago

benwalch commented 1 year ago
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? yes

Consider a website having the following different locales: de_DE and de_CH.

When the current locale is de_DE and the active languages are requested from i18n context using https://github.com/dachcom-digital/pimcore-i18n/blob/master/src/I18nBundle/Context/I18nContext.php#L134, both entries are marked active. If this is intended behaviour, this should be reconsidered since it is a valid case having two different sites, with different locales but the same "language". Furthermore it would be an improvement to also provide the the corresponding locale info in the language entry array here: https://github.com/dachcom-digital/pimcore-i18n/blob/master/src/I18nBundle/Context/I18nContext.php#L346

solverat commented 1 year ago

As discussed, you shouldn't use getActiveLanguages in country mode. Use getActiveCountries instead.

Twig code example: https://github.com/dachcom-digital/pimcore-i18n/blob/master/docs/60_CodeExamples.md#country-selection