Yii:GetText _()与Yii :: t() [英] Yii: GetText _() vs Yii::t()

查看:56
本文介绍了Yii:GetText _()与Yii :: t()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用GetText在Yii中翻译字符串时,我们是否必须使用Yii::t($category,'message')或gettext的_('message')语法?

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

然后我们如何将字符串提取到PO文件中?

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

推荐答案

您可以通过POEdit应用程序放置字符串: http://poedit .net/ 它使您可以扫描项目文件,并将所有必需的字符串自动添加到.po文件中.

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.

如果涉及Yii :: t($ category,'message')和_('message')之间的区别-您应该使用Yii :: t($ category,'message'). GetText的_('message')使用完全不同的po/mo目录结构.

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.

我个人使用POEdit作为字符串扫描程序,它的工作原理很像魅力.

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

这篇关于Yii:GetText _()与Yii :: t()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆