I've to develop a small website which is multi-lingual. This website is using an ERP database, so I cannot choose my database structure, ...
My application has the default language in the core.php, and I'm using I18N Through URL to specify which language I've to display
For every different language, I've a different table containing the description of products in the right language.
So I need to set the "$useTable" of cakePhp in the constructor to the right table. But to do this, I need to know the current locale of the application.
I tried several things:
- do a getInstance on the I18n class, but I've always "english" as "lang"
- doing a Configure::read('Config.language'), but this only displays me the default language of the cakePhp
- I tried to read the $GLOBALS['Dispatcher']->$params['language'] but if the user didn't specify any local, I don't get any
- I tried to import the Component Session and read the Config.language value(which I'm writing on the app_controller), but I seems that If I'm on a french page, I click on the link to display the page in german(all texts are in german now), but the value I receive here is still in french, if I refresh the page, I finally got German, but I need to get the value now, not on the next page reload
So I don't see how to retrieve this language, is there an hidden field containing this var, or anywhere I could retrieve this info?
$this->$model->useTable = 'rus';
, etc. Surely your controller AppController can't be exactly the same - you are writing a custom application, right? – Ivo