Prechádzať zdrojové kódy

Fix build locales (#2221)

* add empty userAgent

//cc @MikeKovarik

* remove unused locale strings

* remove i18n from aws-s3 — it was unused?

/cc @goto-bus-stop
Artur Paikin 5 rokov pred
rodič
commit
908598c5d8

+ 1 - 1
bin/locale-packs.js

@@ -63,7 +63,7 @@ function buildPluginsList () {
     // @TODO Consider rewriting constructors so they don't make imperative calls that rely on
     // browser environment (OR: just keep this browser mocking, if it's only causing issues for this script, it doesn't matter)
     global.location = { protocol: 'https' }
-    global.navigator = {}
+    global.navigator = { userAgent: '' }
     global.localStorage = {
       key: () => { },
       getItem: () => { }

+ 1 - 21
packages/@uppy/aws-s3/src/index.js

@@ -28,7 +28,6 @@
 // If global `URL` constructor is available, use it
 const URL_ = typeof URL === 'function' ? URL : require('url-parse')
 const { Plugin } = require('@uppy/core')
-const Translator = require('@uppy/utils/lib/Translator')
 const RateLimitedQueue = require('@uppy/utils/lib/RateLimitedQueue')
 const settle = require('@uppy/utils/lib/settle')
 const hasProperty = require('@uppy/utils/lib/hasProperty')
@@ -93,12 +92,6 @@ module.exports = class AwsS3 extends Plugin {
     this.id = this.opts.id || 'AwsS3'
     this.title = 'AWS S3'
 
-    this.defaultLocale = {
-      strings: {
-        preparingUpload: 'Preparing upload...'
-      }
-    }
-
     const defaultOptions = {
       timeout: 30 * 1000,
       limit: 0,
@@ -108,24 +101,11 @@ module.exports = class AwsS3 extends Plugin {
 
     this.opts = { ...defaultOptions, ...opts }
 
-    this.i18nInit()
-
     this.client = new RequestClient(uppy, opts)
     this.handleUpload = this.handleUpload.bind(this)
     this.requests = new RateLimitedQueue(this.opts.limit)
   }
 
-  setOptions (newOpts) {
-    super.setOptions(newOpts)
-    this.i18nInit()
-  }
-
-  i18nInit () {
-    this.translator = new Translator([this.defaultLocale, this.uppy.locale, this.opts.locale])
-    this.i18n = this.translator.translate.bind(this.translator)
-    this.setPluginState() // so that UI re-renders and we see the updated locale
-  }
-
   getUploadParameters (file) {
     if (!this.opts.companionUrl) {
       throw new Error('Expected a `companionUrl` option containing a Companion address.')
@@ -297,7 +277,7 @@ module.exports = class AwsS3 extends Plugin {
     // Revert to `this.uppy.use(XHRUpload)` once the big comment block at the top of
     // this file is solved
     this._uploader = new MiniXHRUpload(this.uppy, xhrOptions)
-    this._uploader.i18n = this.i18n
+    this._uploader.i18n = this.uppy.i18n
   }
 
   uninstall () {

+ 0 - 4
packages/@uppy/locales/src/en_US.js

@@ -62,7 +62,6 @@ en_US.strings = {
   loading: 'Loading...',
   logOut: 'Log out',
   micDisabled: 'Microphone access denied by user',
-  micIsOn: 'Microphone is on',
   myDevice: 'My Device',
   noDuplicates: 'Cannot add the duplicate file \'%{fileName}\', it already exists',
   noFilesFound: 'You have no files or folders here',
@@ -74,7 +73,6 @@ en_US.strings = {
   paused: 'Paused',
   poweredBy: 'Powered by',
   poweredBy2: '%{backwardsCompat} %{uppy}',
-  preparingUpload: 'Preparing upload...',
   processingXFiles: {
     '0': 'Processing %{smart_count} file',
     '1': 'Processing %{smart_count} files'
@@ -91,8 +89,6 @@ en_US.strings = {
   saveChanges: 'Save changes',
   selectAllFilesFromFolderNamed: 'Select all files from folder %{name}',
   selectFileNamed: 'Select file %{name}',
-  selectSourceDescription: 'In order to capture your screen, please allow access for this site.',
-  selectSourceTitle: 'Please allow access to your screen',
   selectX: {
     '0': 'Select %{smart_count}',
     '1': 'Select %{smart_count}'

+ 0 - 2
packages/@uppy/locales/src/fi_FI.js

@@ -135,8 +135,6 @@ fi_FI.strings = {
   },
   startCapturing: 'Aloita tallennus',
   stopCapturing: 'Lopeta tallennus',
-  selectSourceTitle: 'Valitse kaappauksen kohde',
-  selectSourceDescription: 'Salli ruudun jako, jotta tallennus on mahdollista.',
   submitRecordedFile: 'Hyväksy tallenne',
   streamActive: 'Jako aktiivinen',
   streamPassive: 'Jako passiivinen',

+ 1 - 1
packages/@uppy/screen-capture/src/index.js

@@ -44,7 +44,7 @@ module.exports = class ScreenCapture extends Plugin {
         streamActive: 'Stream active',
         streamPassive: 'Stream passive',
         micDisabled: 'Microphone access denied by user',
-        timeRecording: 'Recording'
+        recording: 'Recording'
       }
     }