问题描述
从我的第一个问题开始,我有以下代码
From my first question I've got the following code
Yii::t('transFile', 'AAA {BBB} CCC', array('{BBB}'=>Yii::t('transFile','BBB')))
现在我的transFile中有
Now in my transFile I have
return array(
'BBB'=>'translation of BBB'
'AAA {VAR} CCC'=>'translation_of_AAA CCC {VAR}',
);
此代码运行良好.
但是我希望BBB的翻译存在两种类型:BBBx
和BBBy
因此翻译文件将包含类似
But I want the translation of BBB to exist in 2 types: BBBx
and BBBy
So the translation file will hold something like
'BBB'=>'translation of BBBx,translation of BBBy,'
那么如何编写代码,使翻译文件采用BBB翻译的一种或另一种形式,并将其放入文本中?
So how to write the code in way so the translation file will take one or another variant of BBB translation and put it in text ?
推荐答案
答案仍然在我发送给您的链接中:).意思是这个 http://www.yiiframework.com/doc/guide/1.1/en /topics.i18n 您可以发送需要进行一次翻译或另一次翻译的参数.例如
well the answer is still in the link I sent you to :). Meaning this onehttp://www.yiiframework.com/doc/guide/1.1/en/topics.i18nYou can have parameters sent that take 1 translation or another. For example
Yii::t('app', 'n==1#one book|n>1#many books', 1);
您始终可以创建
Yii::t('app', 'n==1#translation of BBBx|n>1#translation of BBBy', 1);
获取"BBBx的翻译"和
to get "translation of BBBx" and
Yii::t('app', 'n==1#translation of BBBx|n>1#translation of BBBy', 2);
获取"BBBy的翻译"
To get "translation of BBBy"
这篇关于Yii :: t()复杂翻译,并添加了differnet结果iva aprameter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!