如何配置 YII i18n 功能以使用 gettext? [英] how can I configure YII i18n feature to use gettext?

查看:28
本文介绍了如何配置 YII i18n 功能以使用 gettext?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了 yii-web-start 扩展,它使用数据库进行消息翻译,但我需要使用 gettext.

I installed the yii-web-start extension, it uses a database for message translation, but I need use gettext instead.

在哪里以及如何配置 YII-i18n?

Where and how can I configure YII-i18n?

推荐答案

您可以使用 CGettextMessageSource 使用 gettext.

You can set up i18n in your config (protected/config/main.php) with CGettextMessageSource to use gettext.

'components' => array(
    'messages' => array(
        'class' => 'CGettextMessageSource'
     )
 ),

默认情况下,您应该将 .po 文件存储在 protected/messages 下.

By default, you should store your .po-files under protected/messages.

这篇关于如何配置 YII i18n 功能以使用 gettext?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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