Search code examples
phpyiigettextphp-gettext

Yii: GetText _() vs Yii::t()


When translating strings in Yii with GetText, do we have to use Yii::t($category,'message') or gettext's _('message') syntax?

And then how do we pull the strings into a PO file?


Solution

  • You can put strings via POEdit app: http://poedit.net/ It allow you to scan your project files and automatically add all required strings into .po file.

    If it comes to difference between Yii::t($category,'message') and _('message') - you should use Yii::t($category,'message'). GetText's _('message') works with a quite different po/mo catalog structure.

    I personally use POEdit as string scanner and it works like a charm.