phemellc / yii2-jui-timepicker

Adds a timepicker widget to Yii2 JUI
MIT License
2 stars 4 forks source link

localization problem #2

Open SoleSS opened 6 years ago

SoleSS commented 6 years ago

when Yii2 language is set to something else than en-US, widget stops working with error (in browser console): Uncaught TypeError: Cannot read property 'regional' of undefined

solution: move DateTimePickerAsset::register($this->getView()); before if ($language != 'en-US' && $language != 'en') {

and change "$('#{$containerID}').{$picker}($.extend({}, $.{$picker}.regional['{$language}'], $options));" to "$('#{$containerID}').{$picker}($.extend({}, $.datepicker.regional['{$language}'], $options));"

moreover: your widget uses 2 letters language code (en), but on systems with 5 letters (en-US) encoded language - your widget wont get localized... and missing dependency on DatePickerLanguageAsset

arisk commented 6 years ago

5 letter languages should work fine. I don't see the reason for this change "$('#{$containerID}').{$picker}($.extend({}, $.datepicker.regional['{$language}'], $options));"

germanow commented 3 years ago

I have the same issue. Here is console output:

jquery-ui-timepicker-uk.js?v=1461180334:4 Uncaught TypeError: Cannot read property 'regional' of undefined
    at jquery-ui-timepicker-uk.js?v=1461180334:4
    at jquery-ui-timepicker-uk.js?v=1461180334:22

Solution above works for me.