Procházet zdrojové kódy

Fix locale-pack for en_US (#5431)

Merlijn Vos před 7 měsíci
rodič
revize
a750140335

+ 1 - 1
package.json

@@ -120,7 +120,7 @@
     "build:js": "npm-run-all build:js:typeless build:locale-pack build:angular build:bundle",
     "build:js": "npm-run-all build:js:typeless build:locale-pack build:angular build:bundle",
     "build:ts": "yarn workspaces list --no-private --json | yarn tsc -b && yarn workspace @uppy/svelte validate",
     "build:ts": "yarn workspaces list --no-private --json | yarn tsc -b && yarn workspace @uppy/svelte validate",
     "build:lib": "yarn node ./bin/build-lib.js",
     "build:lib": "yarn node ./bin/build-lib.js",
-    "build:locale-pack": "yarn workspace @uppy-dev/locale-pack build && eslint packages/@uppy/locales/src/en_US.js --fix && yarn workspace @uppy-dev/locale-pack test unused",
+    "build:locale-pack": "yarn workspace @uppy-dev/locale-pack build && eslint packages/@uppy/locales/src/en_US.ts --fix && yarn workspace @uppy-dev/locale-pack test unused",
     "build": "npm-run-all --serial build:ts --parallel build:js build:css --serial size",
     "build": "npm-run-all --serial build:ts --parallel build:js build:css --serial size",
     "contributors:save": "yarn node ./bin/update-contributors.mjs",
     "contributors:save": "yarn node ./bin/update-contributors.mjs",
     "dev:with-companion": "npm-run-all --parallel start:companion dev",
     "dev:with-companion": "npm-run-all --parallel start:companion dev",

+ 20 - 7
packages/@uppy/locales/src/en_US.ts

@@ -1,9 +1,10 @@
+/* eslint-disable @typescript-eslint/ban-ts-comment */
 import type { Locale } from '@uppy/utils/lib/Translator'
 import type { Locale } from '@uppy/utils/lib/Translator'
 
 
 const en_US: Locale<0 | 1> = {
 const en_US: Locale<0 | 1> = {
   strings: {},
   strings: {},
-  pluralize(count) {
-    if (count === 1) {
+  pluralize(n) {
+    if (n === 1) {
       return 0
       return 0
     }
     }
     return 1
     return 1
@@ -21,6 +22,8 @@ en_US.strings = {
     '%{count} additional restrictions were not fulfilled',
     '%{count} additional restrictions were not fulfilled',
   addMore: 'Add more',
   addMore: 'Add more',
   addMoreFiles: 'Add more files',
   addMoreFiles: 'Add more files',
+  aggregateExceedsSize:
+    'You selected %{size} of files, but maximum allowed size is %{sizeAllowed}',
   allFilesFromFolderNamed: 'All files from folder %{name}',
   allFilesFromFolderNamed: 'All files from folder %{name}',
   allowAccessDescription:
   allowAccessDescription:
     'In order to take pictures or record video with your camera, please allow camera access for this site.',
     'In order to take pictures or record video with your camera, please allow camera access for this site.',
@@ -70,8 +73,8 @@ en_US.strings = {
   dropPasteImportFiles: 'Drop files here, %{browseFiles} or import from:',
   dropPasteImportFiles: 'Drop files here, %{browseFiles} or import from:',
   dropPasteImportFolders: 'Drop files here, %{browseFolders} or import from:',
   dropPasteImportFolders: 'Drop files here, %{browseFolders} or import from:',
   editFile: 'Edit file',
   editFile: 'Edit file',
-  editImage: 'Edit image',
   editFileWithFilename: 'Edit file %{file}',
   editFileWithFilename: 'Edit file %{file}',
+  editImage: 'Edit image',
   editing: 'Editing %{file}',
   editing: 'Editing %{file}',
   emptyFolderAdded: 'No files were added from empty folder',
   emptyFolderAdded: 'No files were added from empty folder',
   encoding: 'Encoding...',
   encoding: 'Encoding...',
@@ -90,7 +93,7 @@ en_US.strings = {
   },
   },
   filter: 'Filter',
   filter: 'Filter',
   finishEditingFile: 'Finish editing file',
   finishEditingFile: 'Finish editing file',
-  flipHorizontal: 'Flip horizontal',
+  flipHorizontal: 'Flip horizontally',
   folderAdded: {
   folderAdded: {
     '0': 'Added %{smart_count} file from %{folder}',
     '0': 'Added %{smart_count} file from %{folder}',
     '1': 'Added %{smart_count} files from %{folder}',
     '1': 'Added %{smart_count} files from %{folder}',
@@ -134,8 +137,12 @@ en_US.strings = {
   pluginNameDropbox: 'Dropbox',
   pluginNameDropbox: 'Dropbox',
   pluginNameFacebook: 'Facebook',
   pluginNameFacebook: 'Facebook',
   pluginNameGoogleDrive: 'Google Drive',
   pluginNameGoogleDrive: 'Google Drive',
+  pluginNameGooglePhotos: 'Google Photos',
   pluginNameInstagram: 'Instagram',
   pluginNameInstagram: 'Instagram',
   pluginNameOneDrive: 'OneDrive',
   pluginNameOneDrive: 'OneDrive',
+  pluginNameScreenCapture: 'Screencast',
+  pluginNameUnsplash: 'Unsplash',
+  pluginNameUrl: 'Link',
   pluginNameZoom: 'Zoom',
   pluginNameZoom: 'Zoom',
   poweredBy: 'Powered by %{uppy}',
   poweredBy: 'Powered by %{uppy}',
   processingXFiles: {
   processingXFiles: {
@@ -160,8 +167,8 @@ en_US.strings = {
   resumeUpload: 'Resume upload',
   resumeUpload: 'Resume upload',
   retry: 'Retry',
   retry: 'Retry',
   retryUpload: 'Retry upload',
   retryUpload: 'Retry upload',
-  revert: 'Revert',
-  rotate: 'Rotate',
+  revert: 'Reset',
+  rotate: 'Rotate 90°',
   save: 'Save',
   save: 'Save',
   saveChanges: 'Save changes',
   saveChanges: 'Save changes',
   search: 'Search',
   search: 'Search',
@@ -185,7 +192,7 @@ en_US.strings = {
   submitRecordedFile: 'Submit recorded file',
   submitRecordedFile: 'Submit recorded file',
   takePicture: 'Take a picture',
   takePicture: 'Take a picture',
   takePictureBtn: 'Take Picture',
   takePictureBtn: 'Take Picture',
-  timedOut: 'Upload stalled for %{seconds} seconds, aborting.',
+  unnamed: 'Unnamed',
   upload: 'Upload',
   upload: 'Upload',
   uploadComplete: 'Upload complete',
   uploadComplete: 'Upload complete',
   uploadFailed: 'Upload failed',
   uploadFailed: 'Upload failed',
@@ -227,4 +234,10 @@ en_US.strings = {
   zoomOut: 'Zoom out',
   zoomOut: 'Zoom out',
 }
 }
 
 
+// @ts-ignore untyped
+if (typeof Uppy !== 'undefined') {
+  // @ts-ignore untyped
+  globalThis.Uppy.locales.en_US = en_US
+}
+
 export default en_US
 export default en_US

+ 0 - 16
packages/@uppy/locales/template.js

@@ -1,16 +0,0 @@
-const en_US = {
-  pluralize (count) {
-    if (count === 1) {
-      return 0
-    }
-    return 1
-  },
-}
-
-en_US.strings = {}
-
-if (typeof Uppy !== 'undefined') {
-  globalThis.Uppy.locales.en_US = en_US
-}
-
-export default en_US

+ 22 - 0
packages/@uppy/locales/template.ts

@@ -0,0 +1,22 @@
+/* eslint-disable @typescript-eslint/ban-ts-comment */
+import type { Locale } from '@uppy/utils/lib/Translator'
+
+const en_US: Locale<0 | 1> = {
+  strings: {},
+  pluralize(n) {
+    if (n === 1) {
+      return 0
+    }
+    return 1
+  },
+}
+
+en_US.strings = {}
+
+// @ts-ignore untyped
+if (typeof Uppy !== 'undefined') {
+  // @ts-ignore untyped
+  globalThis.Uppy.locales.en_US = en_US
+}
+
+export default en_US

+ 2 - 0
private/dev/Dashboard.js

@@ -15,6 +15,7 @@ import DropTarget from '@uppy/drop-target'
 import Audio from '@uppy/audio'
 import Audio from '@uppy/audio'
 import Compressor from '@uppy/compressor'
 import Compressor from '@uppy/compressor'
 import GoogleDrive from '@uppy/google-drive'
 import GoogleDrive from '@uppy/google-drive'
+import english from '@uppy/locales/lib/en_US.js'
 /* eslint-enable import/no-extraneous-dependencies */
 /* eslint-enable import/no-extraneous-dependencies */
 
 
 import generateSignatureIfSecret from './generateSignatureIfSecret.js'
 import generateSignatureIfSecret from './generateSignatureIfSecret.js'
@@ -89,6 +90,7 @@ export default () => {
   // }
   // }
 
 
   const uppyDashboard = new Uppy({
   const uppyDashboard = new Uppy({
+    locale: english,
     logger: debugLogger,
     logger: debugLogger,
     meta: {
     meta: {
       username: 'John',
       username: 'John',

+ 3 - 3
private/locale-pack/index.mjs

@@ -8,10 +8,10 @@ import { getLocales, sortObjectAlphabetically } from './helpers.mjs'
 const root = fileURLToPath(new URL('../../', import.meta.url))
 const root = fileURLToPath(new URL('../../', import.meta.url))
 
 
 const localesPath = path.join(root, 'packages', '@uppy', 'locales')
 const localesPath = path.join(root, 'packages', '@uppy', 'locales')
-const templatePath = path.join(localesPath, 'template.js')
-const englishLocalePath = path.join(localesPath, 'src', 'en_US.js')
+const templatePath = path.join(localesPath, 'template.ts')
+const englishLocalePath = path.join(localesPath, 'src', 'en_US.ts')
 
 
-async function getLocalesAndCombinedLocale () {
+async function getLocalesAndCombinedLocale() {
   const locales = await getLocales(`${root}/packages/@uppy/**/lib/locale.js`)
   const locales = await getLocales(`${root}/packages/@uppy/**/lib/locale.js`)
 
 
   const combinedLocale = {}
   const combinedLocale = {}