mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-01 11:39:41 +08:00
Added test for using source language for missing translation formatting
This commit is contained in:
@ -134,6 +134,15 @@ class I18NTest extends TestCase
|
||||
$this->assertEquals('На диване лежит 6 кошек!', $this->i18n->translate('test', 'There {n, plural, =0{no cats} =1{one cat} other{are # cats}} on lying on the sofa!', ['n' => 6], 'ru'));
|
||||
}
|
||||
|
||||
public function testUsingSourceLanguageForMissingTranslation()
|
||||
{
|
||||
\Yii::$app->sourceLanguage = 'ru';
|
||||
\Yii::$app->language = 'en';
|
||||
|
||||
$msg = '{n, plural, =0{Нет комментариев} =1{# комментарий} one{# комментарий} few{# комментария} many{# комментариев} other{# комментария}}';
|
||||
$this->assertEquals('5 комментариев', \Yii::t('app', $msg, ['n' => 5]));
|
||||
}
|
||||
|
||||
/**
|
||||
* https://github.com/yiisoft/yii2/issues/2519
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user