How to read __() in Cakephp .ctp files with poedit?

1.2k views Asked by At

How do i use Poedit to read strings embedded in __(). It's a Cakephp .ctp file. At the moment it only works if i remove one underscore: _(). I know how to use the console but i want to use Poedit.

3

There are 3 answers

0
Václav Slavík On BEST ANSWER

Catalog -> Properties -> Source keywords and add __, because unlike _ it is not xgettext's default.

Just guessing, BTW, because your question leaves a lot to be desired in terms of usable details.

0
floriank On

Read the books page about i18n & i10n.

You have to use the shell to generate the catalogue files and you open these files with poedit not your template files. That's how it works.

Have a read how gettext works. Translating something is more than just replacing a string...

0
DeadKat On

So to make it easier if you can't have your ctpo file parsed by poedit.

Open poedit, in the "files" => "preferences" check the extractors tabs, choose php for modification, add *.ctp to the extension lists.

Save and update your list, translations from ctp files should be there now.

Enjoy !

You should indeed use your console to generate a pot file but, for example, i'm working on a project where everything is online on a mutualised server, i don't have access to any console.