From 3e8d8bf90d7546b8156f1c950793935bc42f09f4 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 11 Dec 2014 15:48:18 -0500 Subject: [PATCH] Revert i18n initializer, it breaks tests. --- .../javascripts/discourse/helpers/i18n.js.es6 | 19 +++++++++++++ .../initializers/default-i18n.js.es6 | 27 ------------------- 2 files changed, 19 insertions(+), 27 deletions(-) delete mode 100644 app/assets/javascripts/discourse/initializers/default-i18n.js.es6 diff --git a/app/assets/javascripts/discourse/helpers/i18n.js.es6 b/app/assets/javascripts/discourse/helpers/i18n.js.es6 index b19eae3b5..7ca36e81c 100644 --- a/app/assets/javascripts/discourse/helpers/i18n.js.es6 +++ b/app/assets/javascripts/discourse/helpers/i18n.js.es6 @@ -1,5 +1,24 @@ import registerUnbound from 'discourse/helpers/register-unbound'; +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); + }; +} + registerUnbound('i18n', function(key, params) { return I18n.t(key, params); }); diff --git a/app/assets/javascripts/discourse/initializers/default-i18n.js.es6 b/app/assets/javascripts/discourse/initializers/default-i18n.js.es6 deleted file mode 100644 index e6480bdf1..000000000 --- a/app/assets/javascripts/discourse/initializers/default-i18n.js.es6 +++ /dev/null @@ -1,27 +0,0 @@ -export default { - name: 'default-i18n', - - initialize: function() { - // We always prefix with "js." to select exactly what we want passed - // through to the front end. - 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); - }; - } - - } -};