From 0ef62af0725c9591703934eb5b6e12dfae59746b Mon Sep 17 00:00:00 2001 From: Tetsuo Seto Date: Mon, 25 Jan 2016 23:10:39 -0800 Subject: [PATCH] Support globalize without en/messages.json extraction --- lib/globalize.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/globalize.js b/lib/globalize.js index 79a24bdc..06009c5d 100755 --- a/lib/globalize.js +++ b/lib/globalize.js @@ -100,6 +100,14 @@ function formatMessage(path, variables) { '*** %s not found for %s. Fall back to: "%s" ***', path, lang, message ); + if (typeof variables === 'string' || + (Array.isArray(variables) && variables.length > 0)) { + var sanitizedMsg = message + .replace(/}}/g, '') + .replace(/{{/g, '') + .replace(/%[sdj]/g, '%s'); + message = util.format.apply(util, [sanitizedMsg].concat(variables)); + } }; } return message;