浏览代码

Use `title` consistently from locales (#5134)

Merlijn Vos 11 月之前
父节点
当前提交
1634263c6b

+ 0 - 1
packages/@uppy/companion-client/src/CompanionPluginOptions.ts

@@ -2,7 +2,6 @@ import type { UIPluginOptions } from '@uppy/core'
 import type { tokenStorage } from './index.js'
 
 export interface CompanionPluginOptions extends UIPluginOptions {
-  title?: string
   storage?: typeof tokenStorage
   companionUrl: string
   companionHeaders?: Record<string, string>

+ 1 - 1
packages/@uppy/dropbox/src/Dropbox.tsx

@@ -75,7 +75,7 @@ export default class Dropbox<M extends Meta, B extends Body> extends UIPlugin<
     this.defaultLocale = locale
 
     this.i18nInit()
-    this.title = this.opts.title || this.i18n('pluginNameDropbox')
+    this.title = this.i18n('pluginNameDropbox')
 
     this.onFirstRender = this.onFirstRender.bind(this)
     this.render = this.render.bind(this)

+ 1 - 3
packages/@uppy/screen-capture/src/ScreenCapture.tsx

@@ -23,7 +23,6 @@ function getMediaDevices() {
 }
 
 export interface ScreenCaptureOptions extends UIPluginOptions {
-  title?: string
   displayMediaConstraints?: MediaStreamConstraints
   userMediaConstraints?: MediaStreamConstraints
   preferredVideoMimeType?: string
@@ -102,14 +101,13 @@ export default class ScreenCapture<
     // eslint-disable-next-line no-restricted-globals
     this.protocol = location.protocol === 'https:' ? 'https' : 'http'
     this.id = this.opts.id || 'ScreenCapture'
-    this.title = this.opts.title || 'Screencast'
     this.type = 'acquirer'
     this.icon = ScreenRecIcon
 
     this.defaultLocale = locale
 
-    // i18n
     this.i18nInit()
+    this.title = this.i18n('pluginNameScreenCapture')
 
     // uppy plugin class related
     this.install = this.install.bind(this)

+ 1 - 0
packages/@uppy/screen-capture/src/locale.ts

@@ -1,5 +1,6 @@
 export default {
   strings: {
+    pluginNameScreenCapture: 'Screencast',
     startCapturing: 'Begin screen capturing',
     stopCapturing: 'Stop screen capturing',
     submitRecordedFile: 'Submit recorded file',

+ 5 - 1
packages/@uppy/unsplash/src/Unsplash.tsx

@@ -10,6 +10,7 @@ import { h, type ComponentChild } from 'preact'
 
 import type { UppyFile, Body, Meta } from '@uppy/utils/lib/UppyFile'
 import type { UnknownSearchProviderPluginState } from '@uppy/core/lib/Uppy'
+import locale from './locale.ts'
 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
 // @ts-ignore We don't want TS to generate types for the package.json
 import packageJson from '../package.json'
@@ -42,7 +43,10 @@ export default class Unsplash<M extends Meta, B extends Body> extends UIPlugin<
     this.files = []
     this.storage = this.opts.storage || tokenStorage
     this.id = this.opts.id || 'Unsplash'
-    this.title = this.opts.title || 'Unsplash'
+
+    this.defaultLocale = locale
+    this.i18nInit()
+    this.title = this.i18n('pluginNameUnsplash')
 
     this.icon = () => (
       <svg

+ 5 - 0
packages/@uppy/unsplash/src/locale.ts

@@ -0,0 +1,5 @@
+export default {
+  strings: {
+    pluginNameUnsplash: 'Unsplash',
+  },
+}

+ 1 - 1
packages/@uppy/url/src/Url.tsx

@@ -92,7 +92,6 @@ export default class Url<M extends Meta, B extends Body> extends UIPlugin<
   constructor(uppy: Uppy<M, B>, opts: UrlOptions) {
     super(uppy, opts)
     this.id = this.opts.id || 'Url'
-    this.title = this.opts.title || 'Link'
     this.type = 'acquirer'
     this.icon = () => <UrlIcon />
 
@@ -100,6 +99,7 @@ export default class Url<M extends Meta, B extends Body> extends UIPlugin<
     this.defaultLocale = locale
 
     this.i18nInit()
+    this.title = this.i18n('pluginNameUrl')
 
     this.hostname = this.opts.companionUrl
 

+ 1 - 0
packages/@uppy/url/src/locale.ts

@@ -1,5 +1,6 @@
 export default {
   strings: {
+    pluginNameUrl: 'Link',
     // Label for the "Import" button.
     import: 'Import',
     // Placeholder text for the URL input.

+ 0 - 1
packages/@uppy/webcam/src/Webcam.tsx

@@ -69,7 +69,6 @@ export interface WebcamOptions<M extends Meta, B extends Body>
   showVideoSourceDropdown?: boolean
   /** @deprecated */
   facingMode?: MediaTrackConstraints['facingMode'] // @TODO: remove in the next major
-  title?: string
   videoConstraints?: MediaTrackConstraints
   showRecordingLength?: boolean
   preferredImageMimeType?: string | null