aboutsummaryrefslogtreecommitdiff
path: root/js/lib/ui.js
diff options
context:
space:
mode:
authorEvan Winslow <evan@elgg.org>2012-08-26 01:29:50 -0700
committerEvan Winslow <evan@elgg.org>2012-08-26 01:29:50 -0700
commitb9dec14a7a7476b64722c3815e77b3b226c05e72 (patch)
treea7d737682f559d8fe5482e4609c2645e91a7a369 /js/lib/ui.js
parent80b75e049dabbf1318fe58d80e957f334faa9a76 (diff)
parentf2cc620bd4aead5af6d4348789b432e51d48aadd (diff)
downloadelgg-b9dec14a7a7476b64722c3815e77b3b226c05e72.tar.gz
elgg-b9dec14a7a7476b64722c3815e77b3b226c05e72.tar.bz2
Merge pull request #362 from sembrestels/datepicker-i18n
Datepicker i18n
Diffstat (limited to 'js/lib/ui.js')
-rw-r--r--js/lib/ui.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/js/lib/ui.js b/js/lib/ui.js
index c26cbe389..616e71d54 100644
--- a/js/lib/ui.js
+++ b/js/lib/ui.js
@@ -257,7 +257,7 @@ elgg.ui.loginHandler = function(hook, type, params, options) {
* @return void
*/
elgg.ui.initDatePicker = function() {
- if ($('.elgg-input-date').length) {
+ var loadDatePicker = function() {
$('.elgg-input-date').datepicker({
// ISO-8601
dateFormat: 'yy-mm-dd',
@@ -273,9 +273,21 @@ elgg.ui.initDatePicker = function() {
}
}
});
+ };
+
+ if ($('.elgg-input-date').length && elgg.get_language() == 'en') {
+ loadDatePicker();
+ } else if ($('.elgg-input-date').length) {
+ elgg.get({
+ url: elgg.config.wwwroot + 'vendors/jquery/i18n/jquery.ui.datepicker-'+ elgg.get_language() +'.js',
+ dataType: "script",
+ cache: true,
+ success: loadDatePicker,
+ error: loadDatePicker, // english language is already loaded.
+ });
}
};
elgg.register_hook_handler('init', 'system', elgg.ui.init);
elgg.register_hook_handler('init', 'system', elgg.ui.initDatePicker);
-elgg.register_hook_handler('getOptions', 'ui.popup', elgg.ui.loginHandler); \ No newline at end of file
+elgg.register_hook_handler('getOptions', 'ui.popup', elgg.ui.loginHandler);