ONOS-6730: Topo View i18n for:
- select map dialog
- oblique view
- overlay

Change-Id: Ib8cbb5f942ff010ba24f552f0948b3cffc79060d
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.Topo.lioncfg b/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.Topo.lioncfg
index 597fd29..5d66622 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.Topo.lioncfg
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/_config/core.view.Topo.lioncfg
@@ -25,7 +25,7 @@
 
 from cf.QuickHelp import qh_hint_close_detail
 
-from cc.Action import show, hide, enable, disable
+from cc.Action import show, hide, enable, disable, select
 from cc.Network import hosts, devices
 from cc.State import visible, hidden
-from cc.Ui import click, shift_click, drag, cmd_scroll, cmd_drag
+from cc.Ui import click, shift_click, drag, cmd_scroll, cmd_drag, ok, close
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action.properties
index 86a62d0..4a8311c 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action.properties
@@ -27,3 +27,4 @@
 hide=Hide
 enable=Enable
 disable=Disable
+select=Select
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_es.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_es.properties
index fd5fec9..f90ca88 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_es.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_es.properties
@@ -27,3 +27,4 @@
 hide=Hide (es)
 enable=Enable (es)
 disable=Disable (es)
+select=Select (es)
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties
index 43c2867..4c5d6c9 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_it.properties
@@ -27,3 +27,4 @@
 hide=Hide (it)
 enable=Enable (it)
 disable=Disable (it)
+select=Select (it)
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_ko.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_ko.properties
index 6b61c20..2cf0ba1 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_ko.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_ko.properties
@@ -27,3 +27,4 @@
 hide=Hide (ko)
 enable=Enable (ko)
 disable=Disable (ko)
+select=Select (ko)
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_CN.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_CN.properties
index 0479ce4..ab6fffa 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_CN.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_CN.properties
@@ -27,4 +27,4 @@
 hide=Hide (zh_CN)
 enable=Enable (zh_CN)
 disable=Disable (zh_CN)
-
+select=Select (zh_CN)
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_TW.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_TW.properties
index e560388..bf299ac 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_TW.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Action_zh_TW.properties
@@ -27,3 +27,4 @@
 hide=Hide (zh_TW)
 enable=Enable (zh_TW)
 disable=Disable (zh_TW)
+select=Select (zh_TW)
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui.properties
index 2d83b06..a126bdc 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui.properties
@@ -18,6 +18,7 @@
 # Common button text
 ok=OK
 cancel=Cancel
+close=Close
 
 # Gesture text
 click=click
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_es.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_es.properties
index 7e77a8a..141bb38 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_es.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_es.properties
@@ -18,6 +18,7 @@
 # Common button text
 ok=OK
 cancel=Cancelar
+close=Close (es)
 
 # Gesture text
 click=click
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties
index 3a55817..ce7cb68 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_it.properties
@@ -18,6 +18,7 @@
 # Common button text
 ok=OK
 cancel=Annulla
+close=Close (it)
 
 # Gesture text
 click=click
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_ko.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_ko.properties
index 2b27c4b..4506afa 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_ko.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_ko.properties
@@ -18,6 +18,7 @@
 # Common button text
 ok=승인
 cancel=취소
+close=Close (ko)
 
 # Gesture text
 click=클릭
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_CN.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_CN.properties
index 0cb026b..7d2321d 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_CN.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_CN.properties
@@ -18,6 +18,7 @@
 # Common button text
 ok=确定
 cancel=取消
+close=Close (zh_CN)
 
 # Gesture text
 click=点击
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_TW.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_TW.properties
index 8313aae..758c388 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_TW.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/common/Ui_zh_TW.properties
@@ -18,6 +18,7 @@
 # Common button text
 ok=確定
 cancel=取消
+close=Close (zh_TW)
 
 # Gesture text
 click=點擊
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties
index 220b29e..c6adb3e 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo.properties
@@ -78,3 +78,16 @@
 fl_panel_instances=Instances Panel
 
 fl_port_highlighting=Port Highlighting
+
+fl_oblique_view=Oblique View
+fl_normal_view=Normal View
+
+# Button tooltips
+btn_show_view_device=Show Device View
+btn_show_view_flow=Show Flow View for this Device
+btn_show_view_port=Show Port View for this Device
+btn_show_view_group=Show Group View for this Device
+btn_show_view_meter=Show Meter View for this Device
+
+# Miscellaneous
+title_select_map=Select Map
diff --git a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties
index 941c577..23f6460 100644
--- a/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties
+++ b/web/gui/src/main/resources/org/onosproject/ui/lion/core/view/Topo_it.properties
@@ -73,3 +73,16 @@
 fl_panel_instances=Instances Panel (it)
 
 fl_port_highlighting=Port Highlighting (it)
+
+fl_oblique_view=Oblique View (it)
+fl_normal_view=Normal View (it)
+
+# Button tooltips
+btn_show_view_device=Show Device View (it)
+btn_show_view_flow=Show Flow View for this Device (it)
+btn_show_view_port=Show Port View for this Device (it)
+btn_show_view_group=Show Group View for this Device (it)
+btn_show_view_meter=Show Meter View for this Device (it)
+
+# Miscellaneous
+title_select_map=Select Map (it)
diff --git a/web/gui/src/main/webapp/app/view/topo/topo.js b/web/gui/src/main/webapp/app/view/topo/topo.js
index 24eee02..3e9a0cc 100644
--- a/web/gui/src/main/webapp/app/view/topo/topo.js
+++ b/web/gui/src/main/webapp/app/view/topo/topo.js
@@ -332,7 +332,6 @@
         box.x -= box.width/2;
         box.y -= box.height/2;
         g.attr('transform', sus.translate(box.x, box.y));
-
     }
 
     function setUpNoDevs() {
@@ -728,6 +727,7 @@
                     // pass lion bundle function ref to other topo modules
                     tfs.setLionBundle(topoLion);
                     tis.setLionBundle(topoLion);
+                    tms.setLionBundle(topoLion);
 
                     // now we have the map projection, we are ready for
                     //  the server to send us device/host data...
diff --git a/web/gui/src/main/webapp/app/view/topo/topoForce.js b/web/gui/src/main/webapp/app/view/topo/topoForce.js
index b8f3a48..6da55fa 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoForce.js
@@ -491,8 +491,7 @@
     }
 
     function vis(b) {
-        var lionKey = b ? 'visible' : 'hidden';
-        return topoLion(lionKey);
+        return topoLion(b ? 'visible' : 'hidden');
     }
 
     function toggleHosts(x) {
@@ -1117,6 +1116,8 @@
         td3.setLionBundle(bundle);
         fltr.setLionBundle(bundle);
         tls.setLionBundle(bundle);
+        tos.setLionBundle(bundle);
+        tov.setLionBundle(bundle);
     }
 
     angular.module('ovTopo')
diff --git a/web/gui/src/main/webapp/app/view/topo/topoMap.js b/web/gui/src/main/webapp/app/view/topo/topoMap.js
index e44cf35..4e1b9f0 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoMap.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoMap.js
@@ -31,9 +31,10 @@
     // internal state
     var order, maps, map, mapItems, msgHandlers;
 
-    // === ---------------------------
-    // === Helper functions
-
+    // function to be replaced by the localization bundle function
+    var topoLion = function (x) {
+        return '#tmap#' + x + '#';
+    };
 
     // === ---------------------------
     // === Main API functions
@@ -64,11 +65,11 @@
             // tint: tintCheck.property('checked') ? 'on' : 'off'
         };
         setMap(p);
-        $log.debug('Dialog OK button clicked');
+        // $log.debug('Dialog OK button clicked');
     }
 
     function dClose() {
-        $log.debug('Dialog Close button clicked (or Esc pressed)');
+        // $log.debug('Dialog Close button clicked (or Esc pressed)');
     }
 
     function selectMap() {
@@ -80,6 +81,7 @@
         var content = tds.createDiv('map-list'),
             form = content.append('form'),
             current = currentMap();
+
         map = maps[current.mapid];
         mapItems = form.append('select').on('change', selectMap);
         order.forEach(function (id) {
@@ -90,15 +92,6 @@
                     .text(m.description);
         });
 
-/*
-        var p = form.append('p');
-        tintCheck = p.append('input').attr('type', 'checkbox').attr('name', 'tint');
-        if (current.tint == 'on') {
-            tintCheck.attr('checked', 'true');
-        }
-        p.append('span').text('Enable map tint');
-*/
-
         return content;
     }
 
@@ -107,10 +100,10 @@
         order = data.order;
         maps = data.maps;
         tds.openDialog()
-            .setTitle('Select Map')
+            .setTitle(topoLion('title_select_map'))
             .addContent(createListContent())
-            .addOk(dOk, 'OK')
-            .addCancel(dClose, 'Close')
+            .addOk(dOk, topoLion('ok'))
+            .addCancel(dClose, topoLion('close'))
             .bindKeys();
     }
 
@@ -126,6 +119,10 @@
         delegate.setMap(map);
     }
 
+    // invoked after the localization bundle has been received from the server
+    function setLionBundle(bundle) {
+        topoLion = bundle;
+    }
     // === -----------------------------------------------------
     // === MODULE DEFINITION ===
 
@@ -151,6 +148,8 @@
                 closeMapSelection: closeMapSelection,
                 start: start,
                 stop: stop,
+
+                setLionBundle: setLionBundle,
             };
         }]);
 
diff --git a/web/gui/src/main/webapp/app/view/topo/topoOblique.js b/web/gui/src/main/webapp/app/view/topo/topoOblique.js
index 6390758..1155ffa 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoOblique.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoOblique.js
@@ -59,6 +59,10 @@
         plane = {},
         oldNodeLock;
 
+    // function to be replaced by the localization bundle function
+    var topoLion = function (x) {
+        return '#tobq#' + x + '#';
+    };
 
     function planeId(tag) {
         return 'topo-obview-' + tag + 'Plane';
@@ -214,6 +218,10 @@
         rem('pkt');
     }
 
+    // invoked after the localization bundle has been received from the server
+    function setLionBundle(bundle) {
+        topoLion = bundle;
+    }
 
 // === -----------------------------------------------------
 // === MODULE DEFINITION ===
@@ -236,10 +244,10 @@
             oblique = !oblique;
             if (oblique) {
                 api.force().stop();
-                flash.flash('Oblique view');
+                flash.flash(topoLion('fl_oblique_view'));
                 toObliqueView();
             } else {
-                flash.flash('Normal view');
+                flash.flash(topoLion('fl_normal_view'));
                 toNormalView();
             }
         }
@@ -250,6 +258,7 @@
 
             isOblique: function () { return oblique; },
             toggleOblique: toggleOblique,
+            setLionBundle: setLionBundle,
         };
     }]);
 }());
diff --git a/web/gui/src/main/webapp/app/view/topo/topoOverlay.js b/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
index a2b52aa..09ff7b6 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoOverlay.js
@@ -37,6 +37,11 @@
         current = null,
         reset = true;
 
+    // function to be replaced by the localization bundle function
+    var topoLion = function (x) {
+        return '#tov#' + x + '#';
+    };
+
     function error(fn, msg) {
         $log.error(tos + fn + '(): ' + msg);
     }
@@ -184,27 +189,27 @@
     var coreButtons = {
         showDeviceView: {
             gid: 'switch',
-            tt: 'Show Device View',
+            tt: function () { return topoLion('btn_show_view_device'); },
             path: 'device',
         },
         showFlowView: {
             gid: 'flowTable',
-            tt: 'Show Flow View for this Device',
+            tt: function () { return topoLion('btn_show_view_flow'); },
             path: 'flow',
         },
         showPortView: {
             gid: 'portTable',
-            tt: 'Show Port View for this Device',
+            tt: function () { return topoLion('btn_show_view_port'); },
             path: 'port',
         },
         showGroupView: {
             gid: 'groupTable',
-            tt: 'Show Group View for this Device',
+            tt: function () { return topoLion('btn_show_view_group'); },
             path: 'group',
         },
         showMeterView: {
             gid: 'meterTable',
-            tt: 'Show Meter View for this Device',
+            tt: function () { return topoLion('btn_show_view_meter'); },
             path: 'meter',
         },
     };
@@ -411,6 +416,11 @@
         api.updateLinks();
     }
 
+    // invoked after the localization bundle has been received from the server
+    function setLionBundle(bundle) {
+        topoLion = bundle;
+    }
+
     // ========================================================================
 
     angular.module('ovTopo')
@@ -450,6 +460,7 @@
                 },
 
                 showHighlights: showHighlights,
+                setLionBundle: setLionBundle,
             };
         }]);
 
diff --git a/web/gui/src/main/webapp/tests/app/view/topo/topoOblique-spec.js b/web/gui/src/main/webapp/tests/app/view/topo/topoOblique-spec.js
index 896d019..f0588a6 100644
--- a/web/gui/src/main/webapp/tests/app/view/topo/topoOblique-spec.js
+++ b/web/gui/src/main/webapp/tests/app/view/topo/topoOblique-spec.js
@@ -36,7 +36,8 @@
 
     it('should define api functions', function () {
         expect(fs.areFunctions(tos, [
-            'initOblique', 'destroyOblique', 'isOblique', 'toggleOblique'
+            'initOblique', 'destroyOblique', 'isOblique', 'toggleOblique',
+            'setLionBundle',
         ])).toBeTruthy();
     });