You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a website with a multiple languages (eng, fra, ara), sometimes when i click on the link to switch for example from ara to eng, it dose not work !!! the website redirect to the source language and the current language become img - when i check Configure::read('Config.language') it show img . it work in some pages and not on others, after trying and checking, i found that the problem is caused by broken images, and it's not work just in the pages having a broken images, because broken images give errors like
2015-11-12 00:28:37 Error: [MissingControllerException] Controller class ClientsController could not be found.
Exception Attributes: array (
'class' => 'ClientsController',
'plugin' => NULL,
)
Request URL: /laboratory/img/clients/centre-city.jpg
and it take the img as a language's alias, that is why when i check Configure::read('Config.language') it contain img
also when i check beforeFilter at Croogo/Croogo/Controller/CroogoAppController, i found that Configure::read('Config.language') take img as a langague's alias, it can access even there is no locale on the url.
if (isset($this->request->params['locale'])) {
Configure::write('Config.language', $this->request->params['locale']);
}
Solution
So that is why we should check if the current language was defined by the user or not,
$allLanguges = array("fra", "eng", "ara"); // we should get all languages from the database
if (isset($this->request->params['locale']) && in_array($this->request->params['locale'], $allLanguges))
{
Configure::write('Config.language', $this->request->params['locale']);
}
and it work fine like that.
The text was updated successfully, but these errors were encountered:
I have a website with a multiple languages (eng, fra, ara), sometimes when i click on the link to switch for example from ara to eng, it dose not work !!! the website redirect to the source language and the current language become img - when i check
Configure::read('Config.language')
it show img . it work in some pages and not on others, after trying and checking, i found that the problem is caused by broken images, and it's not work just in the pages having a broken images, because broken images give errors likeand it take the img as a language's alias, that is why when i check
Configure::read('Config.language')
it contain imgalso when i check beforeFilter at Croogo/Croogo/Controller/CroogoAppController, i found that
Configure::read('Config.language')
take img as a langague's alias, it can access even there is no locale on the url.Solution
So that is why we should check if the current language was defined by the user or not,
and it work fine like that.
The text was updated successfully, but these errors were encountered: