No Code Attached Yet J3 Issue
avatar nordmograph
nordmograph
23 Aug 2019

Steps to reproduce the issue

  • At least 2 languages set
  • Articles created set to different languages with same tag
  • In Tag component config option (Item Selection tab), set Language Filter option to 'Current'
  • Publish a tag module in the front end
  • Click a tag from that that is added from to articles in both languages

Expected result

-> articles listed from that front end tag view should show in the current language

Actual result

-> English Articles always show even if site language is french

System information (as much as possible)

j3.9.11

Additional comments

Issue seems to be in the front end tag model:
getListQuery function

The $language value is 'current_language' but
the $language value expected by the helper's getTagItemsQuery is:

JFactory::getLanguage()->getTag()

So the fix could be to add this:
if($language =='current_language'){
$language = JFactory::getLanguage()->getTag();
}
Before the helper is called

avatar nordmograph nordmograph - open - 23 Aug 2019
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Aug 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 23 Aug 2019
Labels Added: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 23 Aug 2019
avatar ghost
ghost - comment - 24 Aug 2019

@infograf768 can you please comment?

avatar franz-wohlkoenig franz-wohlkoenig - change - 24 Aug 2019
Status New Information Required
avatar infograf768
infograf768 - comment - 24 Aug 2019

Using mod_tags_popular set to display on ALL languages , I can't reproduce the specific issue, i.e. when we have for example some articles in different languages tagged to the same tag. In that case it works when we switch to the language concerned.

But I found a hitch with this module when a tag set to All languages is only used for some items in languages which are not the Content Language in use.
The tag concerned still displays in the module with the total number of items and displays the message MOD_TAGS_POPULAR_NO_ITEMS_FOUND when clicked on.

This comes from the fact that the module is only filtering by the tags language and not also the items language.

$query->where($db->quoteName('t.language') . ' IN (' . $db->quote($language) . ', ' . $db->quote('*') . ')');

where t is the _tags table

same for COUNT

Looks like this would be interesting to solve by adding a filter by core_language and Count in the _ucm_content table which would modify the results obtained by the _tags table.

avatar franz-wohlkoenig franz-wohlkoenig - change - 24 Aug 2019
Status Information Required Discussion
avatar alikon
alikon - comment - 24 Aug 2019

@infograf768 did you mean something like adding this line

$query->where($db->quoteName('c.core_language') . ' IN (' . $db->quote($language) . ', ' . $db->quote('*') . ')');

after https://github.com/joomla/joomla-cms/blob/staging/modules/mod_tags_popular/helper.php#L74
?

avatar infograf768
infograf768 - comment - 24 Aug 2019

@alikon
Looks like it is not enough

avatar nordmograph
nordmograph - comment - 24 Aug 2019

The reported issue here concerns the 'current_language' mode not the 'all' mode and the component behaviour (tag view).

For the popular tags module I had to make that change inthe helper.php:

if ($language === 'current_language')
{
//$language = JHelperContent::getCurrentLanguage();
$language = JFactory::getLanguage()->getTag();
}


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25998.

avatar infograf768
infograf768 - comment - 24 Aug 2019

@nordmograph

Publish a tag module in the front end

is what you wrote in the OT. Therefore why I specially tested with the module.
I tagged this module to All languages

For me Tags coding in is globally confusing.

  1. Language should only be taken care of when multilang is enabled
  2. This done we have 2 types of filtering:
    One per tag if the tag has a content language set.
    One per tagged item if the item is tagged to a specific content language.

Using $language = JFactory::getLanguage()->getTag();
is wrong because it would also work when the user specific site language is set in a monolingual site which can have multiple languages installed.

Therefore, if no specific tags menu item exists (as this can create issues) and we only use the module, it looks like

			// Optionally filter on language
		$language = JComponentHelper::getParams('com_tags')->get('tag_list_language_filter', 'all');

		if ($language !== 'all')
		{
			if ($language === 'current_language')
			{
				$language = JHelperContent::getCurrentLanguage();
			}

			$query->where($db->quoteName('t.language') . ' IN (' . $db->quote($language) . ', ' . $db->quote('*') . ')');
			$query->where($db->quoteName('c.core_language') . ' IN (' . $db->quote($language) . ', ' . $db->quote('*') . ')');
		}

But honestly I would prefer

		// Optionally filter on language
		if (JMultilanguage::isEnabled())
		{
			$language = JComponentHelper::getParams('com_tags')->get('tag_list_language_filter', 'all');

			if ($language !== 'all')
			{
				if ($language === 'current_language')
				{
					$language = JHelperContent::getCurrentLanguage();
				}

				$query->where($db->quoteName('t.language') . ' IN (' . $db->quote($language) . ', ' . $db->quote('*') . ')');
				$query->where($db->quoteName('c.core_language') . ' IN (' . $db->quote($language) . ', ' . $db->quote('*') . ')');
			}
		}

Then there may be an issue in multilang when we have also a menu item of type "Tagged Items" set to one language only... For example it may kill the breadcrumbs.

JHelperContent::getCurrentLanguage(); will always retrieve the lang in use or the browser lang if no cookie i.e. first visit to the site, but this will only work correctly when multilang is enabled.

I guess we may have the same type of confusion for the tags menu items.

avatar Hackwar Hackwar - close - 7 Nov 2022
avatar Hackwar
Hackwar - comment - 7 Nov 2022

#39140 should fix this. Closing this for now.

avatar Hackwar Hackwar - change - 7 Nov 2022
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2022-11-07 21:33:48
Closed_By Hackwar
Labels Added: No Code Attached Yet
Removed: ?

Add a Comment

Login with GitHub to post a comment