[checkmk-commits] Check_MK Git: check_mk: Made some missing texts localizable

Lars Michelsen lm at mathias-kettner.de
Mon Feb 23 12:27:16 CET 2015


Module: check_mk
Branch: master
Commit: 0b200ccf6e4ed0f699c52454f03043921daafbac
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0b200ccf6e4ed0f699c52454f03043921daafbac

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Mon Feb 23 12:27:11 2015 +0100

Made some missing texts localizable

Conflicts:
	web/htdocs/visuals.py

---

 web/htdocs/js/checkmk.js      |    7 ++++---
 web/htdocs/visuals.py         |    4 ++--
 web/plugins/views/painters.py |    4 ++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index ff8d68c..73e3216 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -575,7 +575,7 @@ function create_graph(data, params) {
 
         // Add the control for adding the graph to a dashboard
         var visualadd = document.createElement('a');
-        visualadd.title = 'Add this view to...';
+        visualadd.title = data['add_txt'];
         visualadd.className = 'visualadd';
         visualadd.onclick = function(host, service, view, source) {
             return function(event) {
@@ -605,14 +605,15 @@ function create_graph(data, params) {
     urlvars = null;
 }
 
-function render_pnp_graphs(container, site, host, service, pnpview, base_url, pnp_url, with_link, from_ts, to_ts) {
+function render_pnp_graphs(container, site, host, service, pnpview, base_url, pnp_url, with_link, add_txt, from_ts, to_ts) {
     from_ts = (typeof from_ts === 'undefined') ? null : from_ts;
     to_ts   = (typeof to_ts === 'undefined') ? null : to_ts;
 
     var data = { 'container': container, 'base_url': base_url,
                  'pnp_url':   pnp_url,   'site':     site,
                  'host':      host,      'service':  service,
-                 'with_link': with_link, 'view':     pnpview};
+                 'with_link': with_link, 'view':     pnpview,
+                 'add_txt':   add_txt};
 
     if (from_ts !== null && to_ts !== null) {
         data['start'] = from_ts;
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index caebd49..521e37b 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -1322,8 +1322,8 @@ def ajax_popup_add():
             visual_module = __import__(module_name)
             handler = visual_module.__dict__[visual_type["popup_add_handler"]]
             visuals = handler()
-            html.write('<li><span>Add to %s:</span></li>' % visual_type["title"])
-            for name, title in handler():
+            html.write('<li><span>%s %s:</span></li>' % (_('Add to'), visual_type["title"]))
+            for name, title in sorted(handler(), key=lambda x: x[1]):
                 html.write('<li><a href="javascript:void(0)" '
                            'onclick="add_to_visual(\'%s\', \'%s\')"><img src="images/icon_%s.png"> %s</a></li>' %
                            (visual_type_name, name, visual_type_name.rstrip('s'), title))
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index d27ddee..6b66dde 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -801,9 +801,9 @@ def paint_pnpgraph(sitename, host, service = "_HOST_"):
             pnpview = pnp_timerange[1]
 
     return "pnpgraph", "<div id=\"%s\"></div>" \
-                       "<script>render_pnp_graphs('%s', '%s', '%s', '%s', '%s', '%s', '%s', %s, %s, %s)</script>" % \
+                       "<script>render_pnp_graphs('%s', '%s', '%s', '%s', '%s', '%s', '%s', %s, '%s', %s, %s)</script>" % \
                           (container_id, container_id, sitename, host, service, pnpview,
-                           defaults.url_prefix + "check_mk/", pnp_url, with_link, from_ts, to_ts)
+                           defaults.url_prefix + "check_mk/", pnp_url, with_link, _('Add this graph to...'), from_ts, to_ts)
 
 multisite_painters["svc_pnpgraph" ] = {
     "title"   : _("PNP service graph"),



More information about the checkmk-commits mailing list