Brightball

Articles about Internationalization

String localization with dynamic content in CakePHP

CakePHP | PHP | i18n | - June 20, 2009 // Barry

Cake has a wonderful shell script function built into it called extract that will run through your code and create a .po file full of all of the text contained within your __('My text here') calls. You can then pass these files onto to translators to modify them for your languages. When you want to add variables though, you have to break it up into pieces which may change the context of the phrase. Here's a way around that.