views:

184

answers:

2

Hi,

As per subject, I would like to be able to use __() function call in my cakephp shell. I've tried importing l10n to the shell to no avail

App::import('Core', 'l10n');

Any help is appreciated, many thank's!

EDIT:

I will probably add more info. The __() call is successful, but it's outputting the input string instead of translated string. So I guess more like path error or something.

EOD;

-aw

A: 

I assume that you have your language files setup and loaded?

As I recall you need to have language files in your application in, "app\locale\eng\LC_MESSAGES" or whichever locale you are using. They should be a pot file with the translations in.

Ref, http://book.cakephp.org/view/163/Localization-in-CakePHP

My guess is that if these files are missing, then it will replace it essentially with whatever you put into the function.

DavidYell
A: 

I've got it working already. For some reason, I have to tell Cake Console which language I'm using explicitly.

Configure::write('Config.language', 'en-us');
andreas
Shouldn't that be `Configure::write('Config.language', 'en-us');`?
Marko
oh yep, I was over excited there, thank's for the correction.
andreas