winter icon indicating copy to clipboard operation
winter copied to clipboard

Select2 does not load i18n localizations

Open dragomano opened this issue 3 years ago • 4 comments

Winter CMS Build

1.1

PHP Version

7.4

Database engine

MySQL/MariaDB

Plugins installed

Builder

Issue description

Select2 dropdown library does not load i18n localization (e.g., message "No results found" during search in the list - it should be localized)

Steps to replicate

  1. Use a dropdown field with non-English localization

Workaround

No response

dragomano avatar Feb 18 '22 19:02 dragomano

Did you put this code in your plugn.php?

 // Listen for `backend.page.beforeDisplay` event and inject js to current controller instance.
`  Event::listen('backend.page.beforeDisplay', function($controller, $action, $params) {
    $controller->addJs('/modules/system/assets/ui/vendor/select2/js/i18n/ru.js');
});`

Everythig works fine for me: select2

hauzmann avatar Feb 19 '22 18:02 hauzmann

Thanks. It would be better to add it once in /modules/backend/classes/Controller.php:

// Listen for `backend.page.beforeDisplay` event and inject js to current controller instance.
\Winter\Storm\Support\Facades\Event::listen('backend.page.beforeDisplay', function($controller, $action, $params) {
    $controller->addJs('/modules/system/assets/ui/vendor/select2/js/i18n/' . Config::get('app.locale') . '.js');
});

dragomano avatar Feb 19 '22 20:02 dragomano

This should definitely be handled by the code that already loaded client side localizations for the Winter backend; a PR would definitely be appreciated :)

LukeTowers avatar Feb 19 '22 22:02 LukeTowers

This issue will be closed and archived in 3 days, as there has been no activity in the last 60 days. If this issue is still relevant or you would like to see it actioned, please respond and we will re-open this issue. If this issue is critical to your business, consider joining the Premium Support Program where a Service Level Agreement is offered.

github-actions[bot] avatar Apr 21 '22 00:04 github-actions[bot]

This issue will be closed and archived in 3 days, as there has been no activity in this issue for the last 6 months. If this issue is still relevant or you would like to see it actioned, please respond within 3 days. If this issue is critical for your business, please reach out to us at [email protected].

github-actions[bot] avatar Oct 21 '22 00:10 github-actions[bot]