From 843c7a21c990f118722bdab1778ab91e16e7b835 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 5 Oct 2016 18:08:54 +1100 Subject: [PATCH] FIX: properly handle blank localizations --- app/assets/javascripts/locales/i18n.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/locales/i18n.js b/app/assets/javascripts/locales/i18n.js index 97b1a1196c7..d5320f628d9 100644 --- a/app/assets/javascripts/locales/i18n.js +++ b/app/assets/javascripts/locales/i18n.js @@ -106,7 +106,7 @@ function checkExtras(origScope, sep, extras) { currentScope = scope.shift(); messages = messages[currentScope]; } - if (messages) { + if (messages !== undefined) { return messages; } } @@ -139,23 +139,23 @@ I18n.lookup = function(scope, options) { messages = messages[currentScope]; } - if (!messages) { + if (messages === undefined) { messages = checkExtras(origScope, this.defaultSeparator, this.extras); } - if (!messages) { + if (messages === undefined) { if (I18n.fallbacks) { var fallbacks = this.getFallbacks(locale); for (var fallback = 0; fallback < fallbacks.length; fallbacks++) { messages = I18n.lookup(lookupInitialScope, this.prepareOptions({locale: fallbacks[fallback]}, options)); - if (messages) { + if (messages !== undefined) { break; } } } - if (!messages && this.isValidNode(options, "defaultValue")) { + if (messages === undefined && this.isValidNode(options, "defaultValue")) { messages = options.defaultValue; } }