Skip to content

Commit

Permalink
Use title consistently from locales (#5134)
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon committed May 8, 2024
1 parent 2eaef62 commit 1634263
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/dropbox/src/Dropbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions packages/@uppy/screen-capture/src/ScreenCapture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function getMediaDevices() {
}

export interface ScreenCaptureOptions extends UIPluginOptions {
title?: string
displayMediaConstraints?: MediaStreamConstraints
userMediaConstraints?: MediaStreamConstraints
preferredVideoMimeType?: string
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions packages/@uppy/screen-capture/src/locale.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
strings: {
pluginNameScreenCapture: 'Screencast',
startCapturing: 'Begin screen capturing',
stopCapturing: 'Stop screen capturing',
submitRecordedFile: 'Submit recorded file',
Expand Down
6 changes: 5 additions & 1 deletion packages/@uppy/unsplash/src/Unsplash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions packages/@uppy/unsplash/src/locale.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
strings: {
pluginNameUnsplash: 'Unsplash',
},
}
2 changes: 1 addition & 1 deletion packages/@uppy/url/src/Url.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ 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 />

// Set default options and locale
this.defaultLocale = locale

this.i18nInit()
this.title = this.i18n('pluginNameUrl')

this.hostname = this.opts.companionUrl

Expand Down
1 change: 1 addition & 0 deletions packages/@uppy/url/src/locale.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
strings: {
pluginNameUrl: 'Link',
// Label for the "Import" button.
import: 'Import',
// Placeholder text for the URL input.
Expand Down
1 change: 0 additions & 1 deletion packages/@uppy/webcam/src/Webcam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1634263

Please sign in to comment.