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

只愿长相守 提交于 2019-12-11 22:17:09

问题


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.


回答1:


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.




回答2:


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...




回答3:


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.



来源:https://stackoverflow.com/questions/18656322/how-to-read-in-cakephp-ctp-files-with-poedit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!