From 7493fe14fcf5f57d688186a407a43d7412417c5f Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Sun, 30 Oct 2022 17:08:57 +0900 Subject: [PATCH] Preload datepicker lang file and always apply dateFormat defaults (fix #1985) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 영어를 예외처리하지 않도록 하여, 영어에서만 날짜 포맷이 다르게 지정되는 문제 수정 --- common/js/plugins/ui/i18n/datepicker-en.js | 0 common/js/plugins/ui/plugin.load | 1 + common/js/plugins/ui/rx_datepicker.js | 17 ++++++++--------- 3 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 common/js/plugins/ui/i18n/datepicker-en.js diff --git a/common/js/plugins/ui/i18n/datepicker-en.js b/common/js/plugins/ui/i18n/datepicker-en.js new file mode 100644 index 000000000..e69de29bb diff --git a/common/js/plugins/ui/plugin.load b/common/js/plugins/ui/plugin.load index 73e7053a1..687d3d353 100644 --- a/common/js/plugins/ui/plugin.load +++ b/common/js/plugins/ui/plugin.load @@ -1,3 +1,4 @@ jquery-ui.min.js jquery-ui.min.css +i18n/datepicker-{$lang_type}.js rx_datepicker.js diff --git a/common/js/plugins/ui/rx_datepicker.js b/common/js/plugins/ui/rx_datepicker.js index 1edaae18d..1b3f3ce4d 100644 --- a/common/js/plugins/ui/rx_datepicker.js +++ b/common/js/plugins/ui/rx_datepicker.js @@ -2,12 +2,11 @@ * @brief Load i18n file of datepicker * @author MinSoo Kim **/ -if(typeof current_lang !== "undefined" && current_lang !== 'en') { - jQuery.getScript(request_uri + "common/js/plugins/ui/i18n/datepicker-"+ current_lang.replace("jp", "ja") +".js", function() { - var default_option = { - dateFormat:'yy-mm-dd' - }; - jQuery.extend(jQuery.datepicker.regional[current_lang.replace("jp", "ja")],default_option); - jQuery.datepicker.setDefaults( jQuery.datepicker.regional[current_lang.replace("jp", "ja")] ); - }); -} \ No newline at end of file +(function($) { + var datepicker_lang = (typeof current_lang !== 'undefined') ? current_lang.replace('jp', 'ja') : 'en'; + var default_options = { + dateFormat: 'yy-mm-dd' + }; + $.extend(jQuery.datepicker.regional[datepicker_lang], default_options); + $.datepicker.setDefaults(jQuery.datepicker.regional[datepicker_lang]); +})(jQuery);