kartik-v / yii2-widget-fileinput

An enhanced FileInput widget for Bootstrap 4.x/3.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)
Other
229 stars 96 forks source link

Translation is not passed to the bootstrap-fileinput #33

Closed aliechti closed 9 years ago

aliechti commented 9 years ago

Nothing is translated by default, because the language is not passed to the bootstrap-fileinput. The translation file is loaded but the bootstrap-fileinput language is set to default.

A workaround is to set it manually at every fileinput

<?= $form->field($article, 'file')->widget(FileInput::className(), [
    'pluginOptions' => [
        'language' => Yii::$app->language
    ],
]) ?>

To fix it, I think it should be set at the widget init()

if (!isset($this->pluginOptions['language'])) $this->pluginOptions['language'] = $this->language;
kartik-v commented 9 years ago

Resolved via d96e605.