Commit 51ace286 by Alexander Makarov

Added test for using source language for missing translation formatting

parent 02d1fefa
...@@ -134,6 +134,15 @@ class I18NTest extends TestCase ...@@ -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')); $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 * https://github.com/yiisoft/yii2/issues/2519
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment