No Code Attached Yet
avatar mastervanleeuwen
mastervanleeuwen
9 Jul 2022

Steps to reproduce the issue

The language switcher module does not display flags in Joomla 3.9.10 and 4.1. Detailed code pointers below

Expected result

Language switcher on frontend shows flags after following these steps: https://docs.joomla.org/J3.x:Setup_a_Multilingual_Site/Language_Switcher

Actual result

The module shows up, but no language options are shown

System information (as much as possible)

Additional comments

I dug a bit into the code of Joomla 3.9.10 and the culprit seems to be in this snippet:

                         $default = $menu->getDefault($item->lang_code);

			if ($default && $default->language === $item->lang_code)
			{
				$homes[$item->lang_code] = $default;
			}

(see: https://github.com/joomla/joomla-cms/blob/3.10-dev/modules/mod_languages/helper.php#L43 )
on my site, the $default->language is equal to *, probably because the default menu item has language settings 'All'. However '*' is not equal to a language code, e.g. 'en-GB', so no entries are added to the $homes and later down in the helper. php, all language codes are discarder for this reason.

I observed the same behaviour in Joomla 4, but have not debugged the code in that case.

avatar mastervanleeuwen mastervanleeuwen - open - 9 Jul 2022
avatar joomla-cms-bot joomla-cms-bot - change - 9 Jul 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 9 Jul 2022
avatar Fedik
Fedik - comment - 9 Jul 2022

probably because the default menu item has language settings 'All'

You need a couple "default menus" for multilanguage: one for ALL, and one per language.

https://docs.joomla.org/J3.x:Setup_a_Multilingual_Site/Creating_menus

avatar chmst
chmst - comment - 9 Jul 2022

You can try to install multilingual sample data. This gives you all you need for a multilingual site.

avatar richard67 richard67 - close - 9 Jul 2022
avatar richard67
richard67 - comment - 9 Jul 2022

Closing as expected behavior. Feel free to re-open this issue when you have proceeded as recommended and it’s still not working.

avatar richard67 richard67 - change - 9 Jul 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-07-09 09:30:44
Closed_By richard67

Add a Comment

Login with GitHub to post a comment