/
Empty page names in breadcrumbs on multi-lingual websites [5.2.2-B1]
Empty page names in breadcrumbs on multi-lingual websites [5.2.2-B1]
The breadcrumbs allows to navigation easily up the website page hierarchy. Typical breadcrumbs look like this:
Home > Top Page Name > Sub Page Name
This works like a charm on website with single language, but on website with multiple languages page names might turn out empty because implementation issues of "\kNavigationBar::getCategoryParentPath" method. Here is what's wrong:
- shared cache is used for all language, but only page name on current language is stored in it
- there is no fallback to page translation on primary language in case if page isn't translated on current language
- if user opens website on non-primary language on which page name isn't translated AND cache is missing, then this empty page name is saved into cache
Solution
In the "\kNavigationBar::getCategoryParentPath" method:
- use "\kMultiLanguageHelper::getLanguages" to iterate over all enabled languages and query translations of used categories on all languages
- include language serial in cache key, to auto-reset cache when language is added/removed or primary language is changed
- set category text for a given language into category text from primary language, when category text on given language is missing