Based on the below article, I was able to internationalize my CakePHP application to certain extent –
http://puskin.in/blog/2010/08/cakephp-manage-multiple-language-in-application/
I want to extend this functionality and provide the ability where user can save the preferred language in his User profile. And everytime the user logs in, I want to use the preferred language and display the content of the site in that language. Ex – Facebook language setting. As soon as you change the language, the static content in the website is changed to that language.
Also, I have some static data like look-up information for drop-downs. How should my table design be in order to support i18n.
Any code snippets or ideas?
Having a user language preference setting is trivial. Just add a field
languageto the user table and allow the user somewhere to set a value to it. In your app, you set the default language incore.phpusingConfigure::write('Config.language', 'eng')and override it someplace else, best in theAppController::beforeFilter:Now all of Cake’s L10n functionality will output content in the user’s selected language.
If you need any additional language logic that’s not covered by Cake, you might have to implement it yourself. I’d suggest you open a new specific question about specific concerns you have. Generally, you will base any custom language logic on the value in
Configure::read('Config.language'). If you have, say, products with descriptions in multiple languages, you can have aProducthasManyDescriptionrelationship, where eachDescriptionhas alanguageattribute which you filter by.