Требуется убрать префикс языка "ru" для многоязычного сайта, НО только для определенного компонента - Mosets tree. На остальных страницах - префикс остается. Еще установлен sh404SEF , но в нем такой настнойки не предусмотрено.
Т.е. необходимо создать условие, что включен компонент Mosets tree и при true не подставлять /ru/
Предполагаю, что это где-то в коде \com_sh404sef_4.24.0.4301\admin\classes\router.php
/*
* 1 - We don't know what the language filter may or may not have done
* with the path. It may already have returned a lang var to the router
* but we don't know that either
*
* Actually we do: if a language was detected, $app->input->get('language')
* will have the language code (ie en-GB)
* If that is set, the path has been truncated, ie the leading en/ code
* has been removed (and no query var set to compensate!)
*
* 2 - What we can do: compare the original url with the path
* in $uri. If we do have a language in the original but not
* in the incoming $uri, then language filter already has done lang
* detection and removed that from the path (including when there's no
* language code at all: that's default language)
* Then we can:
* - figure out what the language is and stick it back in $uri
* - parse through sh404SEF
* - remove the leading lang code we put in $uri
* - unset any 'lang' we may have calculated ourselves so as
* not to override what the languge filter has done
* EDIT: to still be able to switch back to default language (when no lang code is used
* on default language, we must use trick (ie set a cookie)
*
*/
$appLang = $app->input->get('language', '');
$sefLangCode = '';
if (!empty($appLang))
{
$languages = JLanguageHelper::getLanguages('lang_code');
$sefLangCode = empty($languages[$appLang])? '' : $languages[$appLang]->sef;
}
$currentPath = '';
if (!empty($sefLangCode) && $originalPath != 'index.php'
&& (
$appLang != Sh404sefHelperLanguage::getDefaultLanguageTag()
||
(
$appLang == Sh404sefHelperLanguage::getDefaultLanguageTag()
&& Sh404sefHelperLanguage::getInsertLangCodeInDefaultLanguage()
&& (!empty($originalPath))
)
)
)
{
// stick back the path in the url
$currentPath = $uri->getPath();
$uri->setPath($sefLangCode . '/' . (empty($currentPath)? '' : $currentPath));
$this->_guessedLanguageCode = $sefLangCode;
}