summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Ossman <pierre@ossman.eu>2016-11-14 21:58:14 +0100
committerPierre Ossman <pierre@ossman.eu>2016-11-17 19:58:10 +0100
commitf28e248d3f176152463d11bcd761a04342f4c7a3 (patch)
treeb50879f8fc4216a55a3efad15bba0c38aea39571
parente1f853e5ae429bd10e47912d379725e5bcf67579 (diff)
downloadnovnc-f28e248d3f176152463d11bcd761a04342f4c7a3.tar.gz
Use _() as shorthand for translations
Used commonly when gettext is used for translations. Avoids cluttering the code.
-rw-r--r--app/ui.js20
-rw-r--r--core/rfb.js4
2 files changed, 14 insertions, 10 deletions
diff --git a/app/ui.js b/app/ui.js
index ceb7209..fd769c5 100644
--- a/app/ui.js
+++ b/app/ui.js
@@ -51,6 +51,8 @@ var UI;
window.onscriptsload = function () { UI.load(); };
/* [end skip-as-module] */
+ var _ = Util.Localisation.get;
+
UI = {
connected: false,
@@ -390,26 +392,26 @@ var UI;
switch (state) {
case 'connecting':
- document.getElementById("noVNC_transition_text").innerHTML = Util.Localisation.get("Connecting...");
+ document.getElementById("noVNC_transition_text").innerHTML = _("Connecting...");
document.documentElement.classList.add("noVNC_connecting");
break;
case 'connected':
UI.connected = true;
document.documentElement.classList.add("noVNC_connected");
if (rfb && rfb.get_encrypt()) {
- msg = Util.Localisation.get("Connected (encrypted) to ") + UI.desktopName;
+ msg = _("Connected (encrypted) to ") + UI.desktopName;
} else {
- msg = Util.Localisation.get("Connected (unencrypted) to ") + UI.desktopName;
+ msg = _("Connected (unencrypted) to ") + UI.desktopName;
}
UI.showStatus(msg);
break;
case 'disconnecting':
- document.getElementById("noVNC_transition_text").innerHTML = Util.Localisation.get("Disconnecting...");
+ document.getElementById("noVNC_transition_text").innerHTML = _("Disconnecting...");
document.documentElement.classList.add("noVNC_disconnecting");
break;
case 'disconnected':
UI.connected = false;
- UI.showStatus(Util.Localisation.get("Disconnected"));
+ UI.showStatus(_("Disconnected"));
break;
default:
msg = "Invalid UI state";
@@ -994,7 +996,7 @@ var UI;
}
if ((!host) || (!port)) {
- var msg = Util.Localisation.get("Must set host and port");
+ var msg = _("Must set host and port");
Util.Error(msg);
UI.showStatus(msg, 'error');
return;
@@ -1260,9 +1262,9 @@ var UI;
// The browser is IE and we are in fullscreen mode.
// - We need to force clipping while in fullscreen since
// scrollbars doesn't work.
- var msg = Util.Localisation.get("Forcing clipping mode since " +
- "scrollbars aren't supported " +
- "by IE in fullscreen");
+ var msg = _("Forcing clipping mode since " +
+ "scrollbars aren't supported " +
+ "by IE in fullscreen");
Util.Debug(msg);
UI.showStatus(msg);
UI.rememberedClipSetting = UI.getSetting('clip');
diff --git a/core/rfb.js b/core/rfb.js
index d10d666..ddc92bb 100644
--- a/core/rfb.js
+++ b/core/rfb.js
@@ -263,6 +263,8 @@
};
(function() {
+ var _ = Util.Localisation.get;
+
RFB.prototype = {
// Public methods
connect: function (host, port, password, path) {
@@ -273,7 +275,7 @@
if (!this._rfb_host || !this._rfb_port) {
return this._fail(
- Util.Localisation.get("Must set host and port"));
+ _("Must set host and port"));
}
this._rfb_init_state = '';