0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Fix jsDoc on i18n.t()

no issue

- my IDE has been moaning at me for every usage of i18n.t that didn't have 2 args
- this uses the optional notation and expects an object instead of JSON (JSON requires keys to be quoted)
This commit is contained in:
Hannah Wolfe 2016-02-22 01:57:22 +01:00
parent 6bbcbab3f3
commit 8cef27d698

View file

@ -17,10 +17,10 @@ I18n = {
* Helper method to find and compile the given data context with a proper string resource. * Helper method to find and compile the given data context with a proper string resource.
* *
* @param {string} path Path with in the JSON language file to desired string (ie: "errors.init.jsNotBuilt") * @param {string} path Path with in the JSON language file to desired string (ie: "errors.init.jsNotBuilt")
* @param {json} context * @param {object} [bindings]
* @returns {string} * @returns {string}
*/ */
t: function t(path, context) { t: function t(path, bindings) {
var string = I18n.findString(path), var string = I18n.findString(path),
msg; msg;
@ -32,11 +32,11 @@ I18n = {
string.forEach(function (s) { string.forEach(function (s) {
var m = new MessageFormat(s, currentLocale); var m = new MessageFormat(s, currentLocale);
msg.push(m.format(context)); msg.push(m.format(bindings));
}); });
} else { } else {
msg = new MessageFormat(string, currentLocale); msg = new MessageFormat(string, currentLocale);
msg = msg.format(context); msg = msg.format(bindings);
} }
return msg; return msg;