dachcom-digital / pimcore-i18n

Pimcore - i18n Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

active language is ambiguous

benwalch opened this issue · comments

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

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