Menu Content

Podpora

> Diskusní fóra, FAQs & placená podpora
Welcome, Guest
Username Password: Remember me

Pull request / Suggestion for JoomSEF 4.2.9
(1 viewing) (1) Guest
Support forum for users using free edition of JoomSEF 4 (Joomla 1.6/1.7/2.5+ compatible). These forums are mainly for mutual help between users.

Please note that due to our capacity limitations, we do not monitor these forums regularly.
  • Page:
  • 1

TOPIC: Pull request / Suggestion for JoomSEF 4.2.9

Pull request / Suggestion for JoomSEF 4.2.9 11 years, 11 months ago #34857

Hello,
i am using ARTIO JoomSEF for some time and i would like to ask if is there some GIT repository or any option how to "Pull Request" some changes i made in This product and i think it would be good for everyone to apply it in next release.

Here are 2 things i think that should work better.
Both is when you use multilanguage site.

1)
// Redirect root URL to URL with language code
Here is problem with this line 853 in file com_sef/joomsef.php
JFactory::getApplication()->redirect(JRoute::_($link), '', 'message', true);

This makes redirection 'HTTP/1.1 301 Moved Permanently' from root domain to default language url.
BUT when user change language to some other its set in cookie... And when he come next time to root domain it switch back do default language, because 301 redirection is saved in browser cache and its more powerful than cookies...
I suppose to change this line to this:
JFactory::getApplication()->redirect(JRoute::_($link));

This makes only 'HTTP/1.1 303 See other' redirection.
Anyway i think 307 redirection would be even better.

2)
// Correct FaLang support for translations
Here is problem with code between lines 141 - 156 in file com_sef/joomsef.php
 
if ($sefConfig->langEnable && $check == false) {
$langVar = $uri->getVar('lang');
if (!empty($langVar)) {
$langCode = JoomSEF::getLangCode($langVar);
if (!is_null($langCode)) {
$curCode = JoomSEF::getLangCode();
if ($langCode != $curCode) {
// URL language is different from current language,
// change current language for correct translations
$language = JFactory::getLanguage();
$prevLang = $language->setLanguage($langCode);
$language->load();
}
}
}
}
 

this whole part of loading language of URL destination is problematical in some cases.
For instance if you have language swither module on your website. It makes loading all language files and redefine all global lang constans that comes in webpage after this module to thle language of the last language link in this module...
I have removed this code and i do not think it makes anythink wrong. Now i do not load language files i do not need.


I dont know if there are any other reasons why ARTIO works this way, but anyone can tell me reason.
And i think these 2 "bugs" makes troubles to many users, because i spen quite lot of hours to figure it out.

Re: Pull request / Suggestion for JoomSEF 4.2.9 11 years, 11 months ago #34878

  • dajo
  • OFFLINE
  • Posts: 5069
Hi,
There's currently no git repository for JoomSEF, but thank you for your suggestion, we'll think about it.

1) You are right, a 303 redirect would most likely work better in this case. We'll change it in next version probably.

2) The language for specific URL is loaded so the texts used in URLs are translated to corresponding language (for example the "/page-3" suffix for pagination can be "/stranka-3" in Czech). But it shouldn't cause problems as you describe, because the original language should be loaded again after the URL is processed, that's why the original language is stored in the $prevLang variable and the JoomSEF::_endSef($prevLang); function is called before every "return" in the build() function.
So the problem is, why the original language wasn't restored correctly in your case.
ARTIO Support Team

Re: Pull request / Suggestion for JoomSEF 4.2.9 11 years, 11 months ago #34932

  • dajo
  • OFFLINE
  • Posts: 5069
Hi,
We've tested the language problem and there really is a bug, the following line:
$language->load();

doesn't cause Joomla to reload the language if it was already loaded. It should be:
$language->load('joomla', JPATH_BASE, null, true);

which forces Joomla to reload the language. This fix is also needed in the _restoraLang() function, then the language is correctly restored after the SEF URL is constructed.
It will be fixed in next version of JoomSEF.
ARTIO Support Team

Re: Pull request / Suggestion for JoomSEF 4.2.9 11 years, 11 months ago #35139

Hi dajo,
thank you for your reply, i am glad i could help a little. ;-)
You are true with that language realoading. It is much more better fix.

Anyway i found another thing to upgrade in artio ;-)

3)
Default joomla Languagefilter plugin can change site title according to settings in Language manager. You can specify Site title for each lang.
(administrator/index.php?option=com_languages&view=languages)

It is wery easy to add this func in ARTIO JoomSEF plugin
in file plugins/system/joomsef/joomsef.php
put this code at the end of function onAfterInitialise (its about line 125)
 
$app = JFactory::getApplication();
if ($app->isSite()) {
$tag = JFactory::getLanguage()->getTag();
// Adding custom site name
$languages = JLanguageHelper::getLanguages('lang_code');
if (isset($languages[$tag]) && $languages[$tag]->sitename) {
JFactory::getConfig()->set('sitename', $languages[$tag]->sitename) ;
}
}
 

Re: Pull request / Suggestion for JoomSEF 4.2.9 11 years, 11 months ago #35316

  • dajo
  • OFFLINE
  • Posts: 5069
Hi,

Thank you for your suggestion. We have a similar fix for this problem already implemented for next version of JoomSEF.
ARTIO Support Team
  • Page:
  • 1
Přihlášení uživatele Prázdný