fecshop (yii2)如何开启强制翻译,强制翻译基础语言,譬如强制翻译基础语言英语en_US

Yii框架 · Fecmall · 于 5年前 发布 · 1748 次阅读

YII2的翻译是组件i18n,可以通过配置开启强制翻译

'i18n' => [
            'translations' => [
                'apphtml5' => [
                    'basePaths' => [
                        '@apphtml5/languages',
                    ],
                    // base language code
                    'sourceLanguage' => 'en_US',
                    /**
                     * @var bool whether to force message translation when the source and target languages are the same.
                     * Defaults to false, meaning translation is only performed when source and target languages are different.
                     * see: @yii/i18n/MessageSource.php  @property $forceTranslation
                     */
                    'forceTranslation' => true,
                ],
            ],
        ],

forceTranslation 设置true, 即可开启yii2的强制翻译

fecshop的翻译基于 YII2翻译组件i18n,因此通过上面的方式,在@app/config/main.php中设置即可

共收到 0 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics