yii2-file-upload-widget
yii2-file-upload-widget copied to clipboard
Can not set translation manually
If you need to setup translation manually for whatever reason, it's not working, because the widget overwrite the i18n settings in the config.
Possible solution is to pass translation configuration to plugin:
FileUpload::widget([
'model' => $model,
'attribute' => 'upload[]',
...
'i18n' => [
'sourceLanguage' => 'en',
'basePath' => '@fileupload/messages',
'class' => 'yii\i18n\PhpMessageSource',
],
]);
Alternative, if you want to control it from central config:
FileUpload::widget([
'model' => $model,
'attribute' => 'upload[]',
...
'i18n' => ArrayHelper::getValue(Yii::$app->i18n->translations, 'fileupload', null),
]);