Fix a bug notifications sidebar in client-side not being translated

This commit is contained in:
Hadi Nategh 2018-01-11 17:23:58 +01:00
parent 6f2f0c4a8d
commit 2bf7597647
3 changed files with 28 additions and 17 deletions

View File

@ -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" &&

View File

@ -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 '<script src="'. $GLOBALS['egw_info']['server']['webserver_url']. '/notifications/js/notificationajaxpopup.js?'.
filemtime(EGW_SERVER_ROOT.'/notifications/js/notificationajaxpopup.js'). '" type="text/javascript" id="notifications_script_id" data-poll-interval="'.$popup_poll_interval.'"></script>';
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)).'"></script>';
echo '
<div id="egwpopup" style="display: none; z-index: 999;">
<div id="egwpopup_header">'.lang('Notifications').

View File

@ -559,6 +559,9 @@
var lab = egw_LAB || $LAB;
var self = notifications;
lab.wait(function(){
var langRequire = jQuery('#notifications_script_id').attr('data-langRequire');
egw.langRequire(window, [JSON.parse(langRequire)], function()
{
if (typeof window.app == 'undefined') window.app = {};
window.app.notifications = new self();
// toggle notifications bar
@ -574,5 +577,6 @@
);
});
jQuery(".egwpopup_seenall", '#egwpopup').click(function(){window.app.notifications.mark_all_seen()});
}, this);
});
})();