format_number_choice
我在 Symfony 1.4中使用了以下代码:
<?php echo format_number_choice(
'[0]You do not have any remaining invites.|[1]You have one invite.|(1,+Inf]You have %1% invites.', array('%1%' => $users->getInvitatii()), $users->getInvitatii(), 'nrchoice') ?>
翻译字符串如下所示:
<trans-unit id="2" approved="yes">
<source>[0]You do not have any remaining invites.|[1]You have one invite.|(1,+Inf]You have %1% invites.</source>
<target state="translated">[0]Nu mai aveți nicio invitație|[1]Mai aveți o invitație|{n: n % 100 < 20} Mai aveți %1% invitații.|{n: n % 100 > 20} Mai aveți %1% de invitații.</target>
</trans-unit>
在罗马尼亚语中,有两种复数形式:number%100 < 20
和number%100 >= 20
。唯一的问题是我的字符串没有被翻译,我猜我的语法有错误,但我不知道问题出在哪里。我在 Symfony 1.4 文档中找到了这个语法。