Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initLanguage should use short message format? #189

Open
14 of 19 tasks
maxxer opened this issue May 5, 2023 · 0 comments
Open
14 of 19 tasks

initLanguage should use short message format? #189

maxxer opened this issue May 5, 2023 · 0 comments

Comments

@maxxer
Copy link

maxxer commented May 5, 2023

Prerequisites

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • The issue still exists against the latest master branch of yii2-widget-fileinput.
  • This is not an usage question. I confirm having read the widget documentation and demos.
  • This is not a general programming / coding question. (Those should be directed to the webtips Q & A forum).
  • This is not a source plugin (fileinput) issue. (Those should be directed to the plugin issues repo).
  • I have attempted to find the simplest possible steps to reproduce the issue.
  • I have included a failing test as a pull request (Optional).

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

  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Safari

Operating System

  • Windows
  • Mac OS X
  • Linux
  • Mobile

Libraries

  • jQuery version: v3.6.4
  • yii2-widget-fileinput version: v1.1.1

Isolating the problem

  • This bug happens on the widget demos page
  • The bug happens consistently across all tested browsers
  • This bug happens when using yii2-widget-fileinput without other plugins
  • I can reproduce this bug in a jsbin
maxxer added a commit to maxxer/yii2-widget-fileinput that referenced this issue May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant