2016-08-29 3 views
1

i18nの検証に問題があります。私が何をしたのかを見せてください。私は基本的なアプリケーションがあります。設定/ web.phpYii2 i18n検証メッセージが機能しない

'i18n' => [ 
       'translations' => [ 
        'app*' => [ 
        'class' => 'yii\i18n\PhpMessageSource', 
        'basePath' => '@app/messages', 
        'fileMap' => [ 
         'yii'=>'yii.php', 
         'app'=>'app.php', 
         'app/validation'=>'validation.php', 
        ] 
        ], 
       ], 
      ], 

のconfig/i18n.php

return [ 
    'color' => null, 
    'interactive' => true, 
    //'sourcePath' => '@yii', 
    'sourcePath'=> __DIR__. DIRECTORY_SEPARATOR .'..', 
    'messagePath' => __DIR__ . DIRECTORY_SEPARATOR .'..'. DIRECTORY_SEPARATOR . 'messages', 
    //'messagePath' => '@yii/messages', 
    'languages' => ['en','gu','ta','te'], 
    'translator' => 'Yii::t', 
    'sort' => false, 
    'overwrite' => true, 
    'removeUnused' => false, 
    'markUnused' => true, 
    'except' => [ 
     '.svn', 
     '.git', 
     '.gitignore', 
     '.gitkeep', 
     '.hgignore', 
     '.hgkeep', 
     '/messages', 
     '/BaseYii.php', 
    ], 
    'only' => [ 
     '*.php', 
    ], 
    'format' => 'php', 
    'db' => 'db', 
    'sourceMessageTable' => '{{%source_message}}', 
    'messageTable' => '{{%message}}', 
    'catalog' => 'messages', 
    'ignoreCategories' => [], 
]; 

私はvalidation.phpの内容がどうあるべきかわからないですが、私は次のように記述します。 Biodata.php(モデルファイル)ルール

['name','required','message'=>Yii::t('app/validation','{attribute} cannot be blank.')], 

しかし、それでもまだ、私は英語の検証を取得していて

return [ 
    'Name'=>'பெயர் வெறுமையாக இருக்க முடியாது.', 
    ]; 

。私は必要ですபெயர் வெறுமையாக இருக்க முடியாது. enter image description here

私は翻訳された言語で全体の検証が欲しいです。ありがとう

答えて

1

これを試してください。あなたのvalidation.phpファイルで

return [ 
    '{attribute} cannot be blank.'=>'{attribute} வெறுமையாக இருக்க முடியாது.', 
    ];