Hi Dang,
Thank you for your quick response and for providing the updated code snippet regarding the multilingual feature.
I tested the suggested code:
Code:
if ($config->get('activate_multilingual_feature') && Factory::getContainer()->get('language.filter')->isEnabled()) {
$query->where('tbl.language IN (' . $db->Quote(Factory::getApplication()->getLanguage()->getTag()) . ',' . $db->Quote('*') . ', "")');
}
However, when running it on Joomla 5.4, I received the following error:
Resource 'language.filter' has not been registered with the container.
Since I am not a PHP expert, I consulted an AI assistant again.
The analysis suggested that this error occurs because
language.filter is not always registered in the container (e.g., when the multilingual system plugin is not enabled).
As an alternative, the AI recommended using
Multilanguage::isEnabled(), which works correctly and avoids the container registration issue. I tested this approach, and the update page displayed normally:
Code:
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Multilanguage;
if ($config->get('activate_multilingual_feature') && Multilanguage::isEnabled())
{
$langTag = Factory::getApplication()->getLanguage()->getTag();
$query->where(
$db->quoteName('tbl.language') . ' IN (' .
implode(',', [$db->quote($langTag), $db->quote('*'), $db->quote('')]) .
')'
);
}
This solution seems safer and more compatible with Joomla 5.x.
Could you please review and consider adopting this approach in a future release?
Thanks!