winter
winter copied to clipboard
Select2 does not load i18n localizations
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
- Use a dropdown field with non-English localization
Workaround
No response
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:
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');
});
This should definitely be handled by the code that already loaded client side localizations for the Winter backend; a PR would definitely be appreciated :)
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.
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].