From 929676793c08a44776902b0ca24b5f94a95a5f7c Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 11 Jan 2018 17:23:58 +0100 Subject: [PATCH] Fix a bug notifications sidebar in client-side not being translated --- api/js/jsapi/egw_lang.js | 2 +- notifications/inc/hook_after_navbar.inc.php | 9 +++++- notifications/js/notificationajaxpopup.js | 34 ++++++++++++--------- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/api/js/jsapi/egw_lang.js b/api/js/jsapi/egw_lang.js index 780a75acf5..c3589b0d0c 100644 --- a/api/js/jsapi/egw_lang.js +++ b/api/js/jsapi/egw_lang.js @@ -72,7 +72,7 @@ egw.extend('lang', egw.MODULE_GLOBAL, function() _msg = _msg.toLowerCase(); // search apps in given order for a replacement - var apps = this.lang_order || ['custom', this.getAppName(), 'etemplate', 'common']; + var apps = this.lang_order || ['custom', this.getAppName(), 'etemplate', 'common', 'notifications']; for(var i = 0; i < apps.length; ++i) { if (typeof lang_arr[apps[i]] != "undefined" && diff --git a/notifications/inc/hook_after_navbar.inc.php b/notifications/inc/hook_after_navbar.inc.php index 9039331918..071a5ee7de 100644 --- a/notifications/inc/hook_after_navbar.inc.php +++ b/notifications/inc/hook_after_navbar.inc.php @@ -19,9 +19,16 @@ if ($GLOBALS['egw_info']['user']['apps']['notifications']) { $notification_config = Api\Config::read('notifications'); Api\Translation::add_app('notifications'); + $langRequire = array ( + 'app' => 'notifications', + 'lang' => Api\Translation::$userlang, + 'etag' => Api\Translation::etag('notifications', Api\Translation::$userlang) + ); $popup_poll_interval = empty($notification_config['popup_poll_interval']) ? 60 : $notification_config['popup_poll_interval']; echo ''; + filemtime(EGW_SERVER_ROOT.'/notifications/js/notificationajaxpopup.js'). + '" type="text/javascript" id="notifications_script_id" data-poll-interval="'.$popup_poll_interval. + '" data-langRequire="'. htmlspecialchars(json_encode($langRequire)).'">'; echo '