summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCindy Lu <clu@us.ibm.com>2015-03-20 13:50:26 -0700
committerCindy Lu <clu@us.ibm.com>2015-03-20 13:51:19 -0700
commit5fb82fec833d42d69d0a80179e395dba98930430 (patch)
treeb16157f59e0d42fdfb424949a936806bd00ca955
parentde415b446b01258e38709671a10046ad1a4c2aa3 (diff)
downloadhorizon-5fb82fec833d42d69d0a80179e395dba98930430.tar.gz
[Launch Instance fix] Refactor translation for Angular filter
Use django interpolate. Change-Id: I64ec365ac974c56fac7df4ecbddaaaaa8ef86ec7 Closes-Bug: #1434674
-rw-r--r--horizon/static/horizon/js/angular/filters/filters.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/horizon/static/horizon/js/angular/filters/filters.js b/horizon/static/horizon/js/angular/filters/filters.js
index d2816e96c..d2bf42be6 100644
--- a/horizon/static/horizon/js/angular/filters/filters.js
+++ b/horizon/static/horizon/js/angular/filters/filters.js
@@ -50,7 +50,7 @@
if (isNaN(input) || null === input) {
return '';
} else {
- return input.toString() + " " + gettext("GB");
+ return interpolate(gettext("%s GB"), [input.toString()]);
}
};
})
@@ -67,7 +67,7 @@
if (isNaN(input) || null === input) {
return '';
} else {
- return input.toString() + " " + gettext("MB");
+ return interpolate(gettext("%s MB"), [input.toString()]);
}
};
})
@@ -135,15 +135,15 @@
if (isNaN(input) || null === input || input < 0) {
return '';
} else if (input >= tb) {
- return Number(input/tb).toFixed(2) + " " + gettext("TB");
+ return interpolate(gettext("%s TB"), [Number(input/tb).toFixed(2)]);
} else if (input >= gb) {
- return Number(input/gb).toFixed(2) + " " + gettext("GB");
+ return interpolate(gettext("%s GB"), [Number(input/gb).toFixed(2)]);
} else if (input >= mb) {
- return Number(input/mb).toFixed(2) + " " + gettext("MB");
+ return interpolate(gettext("%s MB"), [Number(input/mb).toFixed(2)]);
} else if (input >= kb) {
- return Number(input/kb).toFixed(2) + " " + gettext("KB");
+ return interpolate(gettext("%s KB"), [Number(input/kb).toFixed(2)]);
} else {
- return Math.floor(input) + " " + gettext("bytes");
+ return interpolate(gettext("%s bytes"), [Math.floor(input)]);
}
};
})