소스 검색

Fix locale for Url plugin

Artur Paikin 6 년 전
부모
커밋
db187a6be9
2개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      packages/@uppy/url/src/UrlUI.js
  2. 3 4
      packages/@uppy/url/src/index.js

+ 1 - 1
packages/@uppy/url/src/UrlUI.js

@@ -33,13 +33,13 @@ class UrlUI extends Component {
       <input
         class="uppy-c-textInput uppy-Url-input"
         type="text"
+        aria-label={this.props.i18n('enterUrlToImport')}
         placeholder={this.props.i18n('enterUrlToImport')}
         onkeyup={this.handleKeyPress}
         ref={(input) => { this.input = input }} />
       <button
         class="uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Url-importButton"
         type="button"
-        aria-label={this.props.i18n('import')}
         onclick={this.handleClick}>
         {this.props.i18n('import')}
       </button>

+ 3 - 4
packages/@uppy/url/src/index.js

@@ -35,11 +35,10 @@ module.exports = class Url extends Plugin {
 
     this.opts = Object.assign({}, defaultOptions, opts)
 
-    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})
+    // i18n
+    this.translator = new Translator([ defaultLocale, this.uppy.locale, this.opts.locale ])
     this.i18n = this.translator.translate.bind(this.translator)
+    this.i18nArray = this.translator.translateArray.bind(this.translator)
 
     this.hostname = this.opts.serverUrl