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

initLanguage should use short message format? #189

Open maxxer opened 1 year ago

maxxer commented 1 year ago

Prerequisites

Steps to reproduce the issue

            <?= FileInput::widget([
                'model' => $model,
                'attribute' => 'attachments[]',
                'options' => ['multiple' => true],
            ]) ?>

Expected behavior and actual behavior

According to the code, plugin language is set automatically using Yii::$app->language property, but this doesn't work. language widget property must be set explicitly to the short ISO code in order to translate the widget.

A simple change in FileInput::initWidget() would allow automatic language selection.

        $this->initLanguage('language', false);

Setting the short message format will load the correct language.

Environment

Browsers

Operating System

Libraries

Isolating the problem