From c4ca6b993426cca6fe75343183290fbc8fcb2f99 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 14 Jan 2015 14:00:47 -0500 Subject: [PATCH] FIX: Activate account page JS error with I18n --- vendor/assets/javascripts/i18n-patches.js | 34 ++++++++++++----------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/vendor/assets/javascripts/i18n-patches.js b/vendor/assets/javascripts/i18n-patches.js index cef203d9a..b4522357e 100644 --- a/vendor/assets/javascripts/i18n-patches.js +++ b/vendor/assets/javascripts/i18n-patches.js @@ -1,20 +1,22 @@ (function() { - var oldI18nlookup = I18n.lookup; - I18n.lookup = function(scope, options) { - return oldI18nlookup.apply(this, ["js." + scope, options]); - }; - - // Default format for storage units - var oldI18ntoHumanSize = I18n.toHumanSize; - I18n.toHumanSize = function(number, options) { - options = options || {}; - options.format = I18n.t("number.human.storage_units.format"); - return oldI18ntoHumanSize.apply(this, [number, options]); - }; - - if (Ember.EXTEND_PROTOTYPES) { - String.prototype.i18n = function(options) { - return I18n.t(String(this), options); + if (typeof I18n !== "undefined") { + var oldI18nlookup = I18n.lookup; + I18n.lookup = function(scope, options) { + return oldI18nlookup.apply(this, ["js." + scope, options]); }; + + // Default format for storage units + var oldI18ntoHumanSize = I18n.toHumanSize; + I18n.toHumanSize = function(number, options) { + options = options || {}; + options.format = I18n.t("number.human.storage_units.format"); + return oldI18ntoHumanSize.apply(this, [number, options]); + }; + + if (Ember.EXTEND_PROTOTYPES) { + String.prototype.i18n = function(options) { + return I18n.t(String(this), options); + }; + } } })();