diff --git a/packages/@uppy/core/src/Uppy.ts b/packages/@uppy/core/src/Uppy.ts index 8009e71259..21cc3b3e27 100644 --- a/packages/@uppy/core/src/Uppy.ts +++ b/packages/@uppy/core/src/Uppy.ts @@ -411,6 +411,7 @@ export class Uppy< store: NonNullableUppyOptions['store'] + // Warning: do not use this from a plugin, as it will cause the plugins' translations to be missing i18n!: I18n i18nArray!: Translator['translateArray'] diff --git a/packages/@uppy/google-drive-picker/src/GoogleDrivePicker.tsx b/packages/@uppy/google-drive-picker/src/GoogleDrivePicker.tsx index ff47a11c3a..1f0a0fcc8d 100644 --- a/packages/@uppy/google-drive-picker/src/GoogleDrivePicker.tsx +++ b/packages/@uppy/google-drive-picker/src/GoogleDrivePicker.tsx @@ -103,6 +103,7 @@ export default class GoogleDrivePicker storage={this.storage} pickerType="drive" uppy={this.uppy} + i18n={this.i18n} clientId={this.opts.clientId} apiKey={this.opts.apiKey} appId={this.opts.appId} diff --git a/packages/@uppy/provider-views/src/GooglePicker/GooglePickerView.tsx b/packages/@uppy/provider-views/src/GooglePicker/GooglePickerView.tsx index c4f05ef92c..3774683d14 100644 --- a/packages/@uppy/provider-views/src/GooglePicker/GooglePickerView.tsx +++ b/packages/@uppy/provider-views/src/GooglePicker/GooglePickerView.tsx @@ -3,6 +3,8 @@ import { useCallback, useEffect, useRef, useState } from 'preact/hooks' import type { Uppy, AsyncStore } from '@uppy/core' +import type { I18n } from '@uppy/utils/lib/Translator' + import { authorize, ensureScriptsInjected, @@ -44,6 +46,7 @@ function useStore( export type GooglePickerViewProps = { uppy: Uppy + i18n: I18n clientId: string onFilesPicked: (files: PickedItem[], accessToken: string) => void storage: AsyncStore @@ -62,6 +65,7 @@ export type GooglePickerViewProps = { export default function GooglePickerView({ uppy, + i18n, clientId, onFilesPicked, pickerType, @@ -212,7 +216,7 @@ export default function GooglePickerView({ }, [accessToken, setAccessToken]) if (loading) { - return
{uppy.i18n('pleaseWait')}...
+ return
{i18n('pleaseWait')}...
} if (accessToken == null) { @@ -220,12 +224,12 @@ export default function GooglePickerView({ ) @@ -240,9 +244,7 @@ export default function GooglePickerView({ disabled={loading} onClick={() => showPicker()} > - {pickerType === 'drive' ? - uppy.i18n('pickFiles') - : uppy.i18n('pickPhotos')} + {pickerType === 'drive' ? i18n('pickFiles') : i18n('pickPhotos')} )