Skip to content

Commit

Permalink
added i18n.get(namespace, key, data)
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Feb 9, 2014
1 parent 88a77b8 commit 6656f61
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/messageformat.include.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
window.i18n.get = function(n, k, d) {
var m = this[n], f = function(k, d) { return m[k] && m[k](d) || k; };
if (!m) {
return null;
} else if (typeof k == "undefined") {
return f;
} else if (typeof d == "undefined") {
return m[k];
} else {
return f(k, d);
}
}
var
c=function(d){if(!d)throw new Error("MessageFormat: No data passed to function.")},
n=function(d,k,o){if(isNaN(d[k]))throw new Error("MessageFormat: `"+k+"` isnt a number.");return d[k]-(o||0)},
Expand Down

0 comments on commit 6656f61

Please sign in to comment.