Stop ACTA

CakePHP 2.0, i18n, l10n and core strings

Posted in CakePHP on 02.05.2012.

Here's something I just ran into, regarding CakePHP 2.0 and i18n shell.

Someone on stackoverflow asked this question, which made me question my memory. Because I honestly can't remember what i18n and l10n looked like in cake 1.3 and earlier. Alzheimer : Me / 1:0

So I started snooping around, and the answer to that question is what I came up with: in order to translate things from cake core, you need to manually add the folder into the i18n shell.

For those of you who are lazy to click one more link, here's a reproduction:

$:/var/www/path/app$ cake i18n extract

# if will ask you here if you want to extract from your app folder
# simply press enter to confirm
What is the path you would like to extract?
[Q]uit [D]one  
[/var/www/path/app/]

# now it will ask you again, in this case enter the cake path
What is the path you would like to extract?
[Q]uit [D]one  
[D] > /var/www/path/lib/Cake

# third time, just press enter
What is the path you would like to extract?
[Q]uit [D]one  
[D] > 

# press enter to accept the app/Locale
What is the path you would like to output?
[Q]uit  
[/var/www/path/app//Locale] > 

# press enter to keep translation domains deparate
Would you like to merge all domains strings into the default.pot file?  (y/n) 
[n] > 

This should give you default.pot, cake.pot, cake_dev.pot et alii. The separation occurred because it's pointless to translate cake strings every damn time and keeping them in your default.pot, at least according to this post by AD7six, and the linked lighthouse issue discussion.

My wish would be that i18n shell has a --include-cake param, or something like that, which would do the "standard" extract, including the cake core. While doing it this way is not a difficult thing to do, it may materialise a few question marks above the heads of less experienced bakers.

On the other hand, maybe there is an issue with this idea of which I am not aware, but cake devs are. Time will tell..sooner or later, time will tell...

Article comments — View · Add


Page 1 of 1

twitter :: 30.03.2013 21:36:52
Thank you for this cake information. That helped me for i18n.
Maxy :: 30.03.2015 14:22:03
if you need a reliable localization tool to collaboratively translate software strings, check out https://poeditor.com/