Translation in yii 1.1

I am trying to write a better solution to the translations in yii 1.1.

I will start with a very simple example:

Yii::t('app', 'n==1#one book|n>1#many books', array(5));


one book (if n=1)  

many books (if n>1)

But i want other words to be part of the translation without having to repeat the words.

If i want the output to be

one book in the table

many books in the table

I will have to add in the table to both of these expressions like so

Yii::t('app', 'n==1#one book in the table|n>1#many books in the table', array(5));

in the table is common between both the expressions here but I am finding myself having to repeat that. If the sentence is too long, i will be repeating quiet a lot.

Is there an efficient solution to this problem.


Not really. It is much better in Yii 2.0 but in 1.1 that and newer plurals format are the only options. In both cases full string has to be specified.