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

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

问题描述

在 Yii 中用 GetText 翻译字符串时,是否必须使用 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 _() vs Yii::t()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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