Extracting PO file with CakePHP I18n Shell

I have always been religiously wrapping __() and __n() around my texts knowing that it needs to be localized some day. Then it got to me that I never knew how to actually localize it! Out of curiosity, I went ahead to extract the PO file using the I18n shell.

What it does is basically look through your entire app folder for files and within each file extract all instances of __() and gang, then grab the tokens necessarily for building the PO file. Now, this is where it gets picky.

// error! invalid marker content!
__('Delete post #' . $id);
__n('comment', 'comments', $array[0]);
__n('comment', 'comments', $object->noOfComments());
__n('comment', 'comments', (int) $noOfComments);

// valid! it makes it easier to translate anyways
sprintf(__('Delete post #%d', true), $id);
// just $var will work, nothing funky
sprintf(__n('%d comment', '%d comments', $noOfComments, true), $noOfComments);

So if you are thinking of using the I18n shell, you should take note that the text to be translated should really be one single token. Also, the generated file has an extension of .pot but it should really be renamed to .po instead since Cake expects .po files in the locale folder.