Jump to content

How to remove \en from default language


Recommended Posts

  • 2 months later...

Hello

 

I have a similar problema.

 

What I need to do is to remove the language indicator from the default language.

 

I have spanish and english, spanish links can appear like www.xxxxx.com/es/...

but I need that english links appear like wwwxxxx.com/......

 

thanks for your help.

Link to comment
Share on other sites

Finally I found the answer.

 

edit the file ps/classes/Link.php

 

replace in function called getLangLink:

return Language::getIsoById($id_lang).'/';

with:

if (Configuration::get('PS_LANG_DEFAULT') == $id_lang) {
	return '';
}else{
	return Language::getIsoById($id_lang).'/';
}

Then edit ps/classes/Tools.php

 

replace in function called switchLanguage:

if (($iso = Tools::getValue('isolang')) && Validate::isLanguageIsoCode($iso) && ($id_lang = (int)Language::getIdByIso($iso)))
			$_GET['id_lang'] = $id_lang;

with:

if ( !( ($iso = Tools::getValue('isolang')) && Validate::isLanguageIsoCode($iso) && ($id_lang = (int)Language::getIdByIso($iso)) ) ){
	$_GET['id_lang'] = Configuration::get('PS_LANG_DEFAULT');
}else{
	$_GET['id_lang'] = $id_lang;
}

this works in PS. 1.5 and remove the subfolder for the default language in the friendly url.

Edited by luchiniii (see edit history)
  • Like 6
Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...
×
×
  • Create New...