From 38749eae1b3413f7eccfc9127990db6cd6e08f14 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Fri, 13 Nov 2015 17:30:12 +0100 Subject: [PATCH] fix i18n.js so that it supports lodash 3 --- common/script/i18n.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/script/i18n.js b/common/script/i18n.js index 59e5e358da..f35daa232a 100644 --- a/common/script/i18n.js +++ b/common/script/i18n.js @@ -6,7 +6,7 @@ module.exports = { strings: null, translations: {}, t: function(stringName) { - var clonedVars, e, locale, string, stringNotFound, vars; + var clonedVars, e, error, error1, locale, string, stringNotFound, vars; vars = arguments[1]; if (_.isString(arguments[1])) { vars = null; @@ -27,9 +27,9 @@ module.exports = { clonedVars.locale = locale; if (string) { try { - return _.template(string, clonedVars); - } catch (_error) { - e = _error; + return _.template(string)(clonedVars); + } catch (error) { + e = error; return 'Error processing the string. Please see Help > Report a Bug.'; } } else { @@ -39,13 +39,13 @@ module.exports = { stringNotFound = module.exports.translations[locale] && module.exports.translations[locale].stringNotFound; } try { - return _.template(stringNotFound, { + return _.template(stringNotFound)({ string: stringName }); - } catch (_error) { - e = _error; + } catch (error1) { + e = error1; return 'Error processing the string. Please see Help > Report a Bug.'; } } } -}; +}; \ No newline at end of file