Recent posts
Recent comments
- In i18n routes with CakePHP 1.3
- pierre_martin wrote: Hi everyone and thank you for the feedbacks! Since this article was published, we improved...
- In i18n routes with CakePHP 1.3
- Mateusz Mucha wrote: Thank you!
- In i18n routes with CakePHP 1.3
- Piotr wrote: Wow! That's great and usefull. Ways easier than with old methods. I added some code to update...
- In i18n routes with CakePHP 1.3
- Lee wrote: Once you set $url['lang'] when empty is doesn't update $this-params with the default...
- In CakePHP Migrations plugin: easily version and deploy whole applications
- Remigijus wrote: When I am trying to run 'migration generate' for first time, my migration file 'up' has value...
Categories
There are no categories to display
Words of Wisdom from Pierre Martin
-
i18n routes with CakePHP 1.3
August 05 2010 | Pierre Martin | Uncategorized
Internationalizing a CakePHP application can be tricky when it comes to deal with i18n urls. We will see in this article how the Custom route classes introduced by CakePHP 1.3 could be used to add the current language to your urls in a few lines of code. EDIT: This proof of concept has now been improved and a better version of the code below can be found in CakeDC's I18n plugin on Github Requirements This article will not go too deep in internationalizing an application as many resources already exist about it. We suppose the following: Your application defines the current language on given the language code passed in the url The available languages are configured via Configure::write('Config.languages', array('eng', 'fre', 'deu')); You use the CakePHP array syntax for defining urls: $this->Html->link('link', array('controller' => 'posts', 'action' => 'view', $post[...