From 1ca6434d40c2cc305dd06d356a34af2b9a59c4b5 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Fri, 6 Nov 2020 00:08:36 +0100 Subject: [PATCH] DEV: Remove i18n-patches (#11139) * DEV: Move toHumanSize patch into I18n proper The patch wasn't loaded in Ember CLI environment causing translation discrepancies. * DEV: Remove String.prototype.i18n I don't think this patch is needed. Let the CI prove me wrong. :P --- app/assets/javascripts/locales/i18n.js | 2 +- app/assets/javascripts/vendor.js | 1 - app/assets/javascripts/wizard-application.js | 1 - vendor/assets/javascripts/i18n-patches.js | 17 ----------------- 4 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 vendor/assets/javascripts/i18n-patches.js diff --git a/app/assets/javascripts/locales/i18n.js b/app/assets/javascripts/locales/i18n.js index 7ef1ae356df..814e8ed8d9d 100644 --- a/app/assets/javascripts/locales/i18n.js +++ b/app/assets/javascripts/locales/i18n.js @@ -254,7 +254,7 @@ I18n.toHumanSize = function(number, options) { options = this.prepareOptions(options, { precision: precision, - format: "%n%u", + format: this.t("number.human.storage_units.format"), delimiter: "" }); diff --git a/app/assets/javascripts/vendor.js b/app/assets/javascripts/vendor.js index cf116f3f4c7..e6c081a193c 100644 --- a/app/assets/javascripts/vendor.js +++ b/app/assets/javascripts/vendor.js @@ -1,7 +1,6 @@ //= require logster //= require template_include.js -//= require i18n-patches //= require message-bus //= require jquery.ui.widget.js diff --git a/app/assets/javascripts/wizard-application.js b/app/assets/javascripts/wizard-application.js index 4e2a7adc072..1c7b5c4d538 100644 --- a/app/assets/javascripts/wizard-application.js +++ b/app/assets/javascripts/wizard-application.js @@ -1,5 +1,4 @@ //= require_tree ./discourse-common/addon -//= require i18n-patches //= require_tree ./select-kit/addon //= require wizard/router //= require wizard/wizard diff --git a/vendor/assets/javascripts/i18n-patches.js b/vendor/assets/javascripts/i18n-patches.js deleted file mode 100644 index ee4df93b160..00000000000 --- a/vendor/assets/javascripts/i18n-patches.js +++ /dev/null @@ -1,17 +0,0 @@ -(function() { - if (typeof I18n !== "undefined") { - // 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 ("w" in String.prototype) { - String.prototype.i18n = function(options) { - return I18n.t(String(this), options); - }; - } - } -})();