CChoiceFormat to accept strings

Hello,

I would like to translate in spanish, russian and many other languages which has genre (masculine/feminine/neuter).

CChoiceFormat does great work when you need numbers like


Yii::t('t','days',array($n))

'days' => '0#days|1#day|n>=2#days',

But we need a way to translate by string (to support genre), e.g.


Yii::t('t','Added',array(0)) Yii::t('t','Added',array('company')) Yii::t('t','Added',array('house'))

'Added' => '0#Added|company#Added feminine|house#Added masculine',

Right now I have to do something like


Yii::t('t','Added[company]')

'Added[company]' => 'Added feminine',

Thank you.

Not sure if i understand, even though we have genres in german, too. But maybe you mean something different. In german every noun has what we call "gender": like "table" is masculine, "door" is feminine and "cable" is neuter.

Couldn’t you use a simple mapping like:


0 => masculine,

1 => feminine,

3 => neuter,



If i got you wrong, maybe you can explain the context where you need this?

I have done this:




echo Yii::t( 'contacts', '0#{friend} has been invited as a contact|1#{friend} has been invited as a contact',

array(

   ($friend->Profile->sex === 'male') ? 1 : 0,

  '{friend}' => $friend->Profile->displayName) );



In english, invited is both neutral. But in spanish, you have "invitado" for males, and "invitada" for females.

The problem is if you need both "gender" and counts.

How to handle them?