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中设置即可