summaryrefslogtreecommitdiff
path: root/js/common.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-26 09:21:17 +0300
committerAndrew Dolgov <[email protected]>2021-02-26 09:21:17 +0300
commit56b10fea1805b4ff0e7129adb8216d4d89b74147 (patch)
treee3693dddd57299cf64bed71872de63ec0d011a4d /js/common.js
parentfd9cd5292979045581630d36b1f35333c60f420e (diff)
pass translations to frontend as a json object
Diffstat (limited to 'js/common.js')
-rwxr-xr-xjs/common.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/js/common.js b/js/common.js
index 670ee1b30..1544e6d0b 100755
--- a/js/common.js
+++ b/js/common.js
@@ -1,8 +1,22 @@
'use strict';
-/* global dijit, __, App, dojo, __csrf_token */
+/* global dijit, App, dojo, __csrf_token */
/* eslint-disable no-new */
+/* exported __ */
+function __(msg) {
+ if (typeof App != "undefined") {
+ return App.l10n.__(msg);
+ } else {
+ return msg;
+ }
+}
+
+/* exported ngettext */
+function ngettext(msg1, msg2, n) {
+ return __((parseInt(n) > 1) ? msg2 : msg1);
+}
+
/* exported $ */
function $(id) {
console.warn("FIXME: please use App.byId() or document.getElementById() instead of $():", id);