From 636692cf961bee7ac4657f3b090de9fb5bb1a349 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Mon, 25 Nov 2013 17:05:02 -0800 Subject: [PATCH] Don't console.error missing translations (fixes #2020) --- js/lib/locale.js | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/js/lib/locale.js b/js/lib/locale.js index 6813fbc6d..aa8f058c8 100644 --- a/js/lib/locale.js +++ b/js/lib/locale.js @@ -18,22 +18,18 @@ function t(s, o, loc) { if (rep !== undefined) { if (o) for (var k in o) rep = rep.replace('{' + k + '}', o[k]); return rep; - } else { - function missing() { - var missing = 'Missing ' + loc + ' translation: ' + s; - if (typeof console !== "undefined") console.error(missing); - return missing; - } - - if (loc !== 'en') { - missing(); - return t(s, o, 'en'); - } - - if (o && 'default' in o) { - return o['default']; - } - - return missing(); } + + if (loc !== 'en') { + return t(s, o, 'en'); + } + + if (o && 'default' in o) { + return o['default']; + } + + var missing = 'Missing ' + loc + ' translation: ' + s; + if (typeof console !== "undefined") console.error(missing); + + return missing; }