-> articles listed from that front end tag view should show in the current language
-> English Articles always show even if site language is french
j3.9.11
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
Labels |
Added:
J3 Issue
|
Status | New | ⇒ | Information Required |
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.
Status | Information Required | ⇒ | Discussion |
@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
?
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();
}
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.
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.
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: ? |
@infograf768 can you please comment?