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

Refactor locale scripts & generate types and docs #3276

Merged
merged 23 commits into from Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cac0a90
First working version with separate locale files
Murderlon Oct 13, 2021
1c81589
WIP full refactor
Murderlon Oct 14, 2021
0d73179
Clean up
Murderlon Oct 14, 2021
ffea465
Small improvements
Murderlon Oct 16, 2021
a166f96
Generate types and lint files
Murderlon Oct 17, 2021
92d1ffc
Merge branch 'main' into locale-docs
Murderlon Oct 18, 2021
a56b2f4
WIP tests
Murderlon Oct 19, 2021
33cb200
Merge branch 'main' into locale-docs
Murderlon Oct 20, 2021
2461b85
Refactor tests & rename doc files to match plugin name
Murderlon Oct 20, 2021
c3f67b1
Remove eslint from build step, ignore comma danlge instead
Murderlon Oct 21, 2021
ab2c6ca
Merge branch 'main' into locale-docs
Murderlon Oct 28, 2021
46084a6
Include comments in doc generation
Murderlon Oct 28, 2021
6601738
Move scripts to `private/locale-pack`
Murderlon Oct 28, 2021
6f69416
Use promises instead of `data.task`
Murderlon Oct 28, 2021
d9f0269
Use readFile and writeFile from fs/promises
Murderlon Oct 31, 2021
11cb1a2
Set ignoreFinalDefinitions to true
Murderlon Oct 31, 2021
979297b
Bring back doc sections that were incorrectly deleted
Murderlon Oct 31, 2021
d3db2c7
Use fileURLToPath
Murderlon Oct 31, 2021
d69b5f1
Improve eslint disable comment
Murderlon Oct 31, 2021
ca6a630
Merge branch 'main' into locale-docs
Murderlon Nov 2, 2021
7a65f5e
Run script to add locale to newly added `screen-capture.md`
Murderlon Nov 2, 2021
de8c74b
Format `en_US.js` with eslint
Murderlon Nov 3, 2021
725a277
Merge branch 'main' into locale-docs
Murderlon Nov 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
295 changes: 0 additions & 295 deletions bin/locale-packs.js

This file was deleted.

5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -135,7 +135,7 @@
"build:angular": "yarn workspace @uppy/angular build:release",
"build:js": "npm-run-all build:lib build:companion build:locale-pack build:svelte build:angular build:bundle",
"build:lib": "yarn node ./bin/build-lib.js",
"build:locale-pack": "yarn node --experimental-abortcontroller ./bin/locale-packs.js build",
"build:locale-pack": "yarn workspace locale-pack build && eslint packages/@uppy/locales/src/en_US.js --fix && yarn workspace locale-pack test unused",
"build": "npm-run-all --parallel build:js build:css --serial size",
"contributors:save": "yarn node ./bin/update-contributors.mjs",
"dev:browsersync": "yarn workspace @uppy-example/dev start",
Expand All @@ -156,7 +156,8 @@
"test:companion": "yarn workspace @uppy/companion test",
"test:endtoend:local": "yarn workspace @uppy-tests/end2end test:endtoend:local",
"test:endtoend": "yarn workspace @uppy-tests/end2end test:endtoend",
"test:locale-packs": "yarn node ./bin/locale-packs.js test",
"test:locale-packs:unused": "yarn workspace locale-pack test unused",
"test:locale-packs:warnings": "yarn workspace locale-pack test warnings",
"test:type": "yarn workspaces foreach -piv --include '@uppy/*' --exclude '@uppy/{angular,react-native,locales,companion,provider-views,robodog,svelte}' exec tsd",
"test:unit": "yarn run build:lib && jest --env jsdom",
"test:watch": "jest --env jsdom --watch",
Expand Down
8 changes: 3 additions & 5 deletions packages/@uppy/aws-s3/src/index.js
Expand Up @@ -31,6 +31,8 @@ const { RequestClient } = require('@uppy/companion-client')
const MiniXHRUpload = require('./MiniXHRUpload')
const isXml = require('./isXml')

const locale = require('./locale')

function resolveUrl (origin, link) {
return new URL(link, origin || undefined).toString()
}
Expand Down Expand Up @@ -108,11 +110,7 @@ module.exports = class AwsS3 extends BasePlugin {
this.id = this.opts.id || 'AwsS3'
this.title = 'AWS S3'

this.defaultLocale = {
strings: {
timedOut: 'Upload stalled for %{seconds} seconds, aborting.',
},
}
this.defaultLocale = locale

const defaultOptions = {
timeout: 30 * 1000,
Expand Down
5 changes: 5 additions & 0 deletions packages/@uppy/aws-s3/src/locale.js
@@ -0,0 +1,5 @@
module.exports = {
strings: {
timedOut: 'Upload stalled for %{seconds} seconds, aborting.',
},
}
9 changes: 4 additions & 5 deletions packages/@uppy/box/src/index.js
Expand Up @@ -3,6 +3,8 @@ const { Provider } = require('@uppy/companion-client')
const { ProviderViews } = require('@uppy/provider-views')
const { h } = require('preact')

const locale = require('./locale')

module.exports = class Box extends UIPlugin {
static VERSION = require('../package.json').version

Expand Down Expand Up @@ -32,11 +34,8 @@ module.exports = class Box extends UIPlugin {
pluginId: this.id,
})

this.defaultLocale = {
strings: {
pluginNameBox: 'Box',
},
}
this.defaultLocale = locale

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

Expand Down
5 changes: 5 additions & 0 deletions packages/@uppy/box/src/locale.js
@@ -0,0 +1,5 @@
module.exports = {
strings: {
pluginNameBox: 'Box',
},
}