Friday 17 February 2012

CakePHP: Loosing translated texts

This one drove me crazy for the last couple of hours, so I thought I better share it right away.

I have a bilingual CakePHP application that displays content messages translated from English to Greek. To achieve this I wrap all my English texts inside cake's __() function and then run the cake i18n extract script in order to assemble a .pot file. Finally, I translate my original messages to Greek using the POEdit program to create and manage the necessary translations. Everything seemed to work well: Each time I added new strings, I would execute the cake i18n extract script, then open POEdit, update my .po catalogue from the generated .pot file and translate only the new texts.

Except for today. I was asked to asked to add a few more messages, so I followed the standard procedure. but after I updated both my .po and .mo files, the messages on the web page remained in English despite my ... sincere efforts and honest desire to see them in Greek.

It took me a while to figure this out: The solution was as simple as to delete all files from the APP/tmp/cache/persistent directory.

2 comments :

Richie v said...

Thanks a lot for posting this. Been ages since I had to deal with Cake, I forgot how annoying gettext can be.

Richie v said...

Thanks a lot for posting this. Been ages since I had to deal with Cake, I forgot how annoying gettext can be.