From 06ba8adf50f61cb31f613a84da676f3007453cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Mon, 13 Nov 2017 12:29:47 +0100 Subject: [PATCH] s3: Use Translator for localised strings --- src/plugins/AwsS3/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/AwsS3/index.js b/src/plugins/AwsS3/index.js index 5bc35e6db..0dba300b1 100644 --- a/src/plugins/AwsS3/index.js +++ b/src/plugins/AwsS3/index.js @@ -1,4 +1,5 @@ const Plugin = require('../Plugin') +const Translator = require('../../core/Translator') const XHRUpload = require('../XHRUpload') module.exports = class AwsS3 extends Plugin { @@ -23,6 +24,9 @@ module.exports = class AwsS3 extends Plugin { this.locale = Object.assign({}, defaultLocale, this.opts.locale) this.locale.strings = Object.assign({}, defaultLocale.strings, this.opts.locale.strings) + this.translator = new Translator({ locale: this.locale }) + this.i18n = this.translator.translate.bind(this.translator) + this.prepareUpload = this.prepareUpload.bind(this) } @@ -43,7 +47,7 @@ module.exports = class AwsS3 extends Plugin { fileIDs.forEach((id) => { this.core.emit('core:preprocess-progress', id, { mode: 'determinate', - message: this.locale.strings.preparingUpload, + message: this.i18n('preparingUpload'), value: 0 }) }) @@ -56,7 +60,7 @@ module.exports = class AwsS3 extends Plugin { return paramsPromise.then((params) => { this.core.emit('core:preprocess-progress', file.id, { mode: 'determinate', - message: this.locale.strings.preparingUpload, + message: this.i18n('preparingUpload'), value: 1 }) return params