Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use title consistently from locales #5134

Merged
merged 6 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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