chore: add workflow to check locale files in pull requests (#917)

This commit is contained in:
Stefan Dej authored and GitHub committed 2022-06-17 21:44:28 +02:00
1 parent 443b7f9dc8
commit 753f050795
4 files changed
+147 -92

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
name: Check Translations
on:
pull_request_target:
types: [synchronize, opened]
paths:
- 'src/locales/**'
jobs:
check_translations:
runs-on: ubuntu-latest
steps:
- name: Install jq
run: sudo apt install -y jq
- name: Fetch repo
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm ci
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v23
with:
sha: ${{ github.event.pull_request.head.sha }}
files: 'src/locales/*.json'
- name: Run i18n-extract on changed locale files
id: i18n-extract
env:
OUTPUT: ''
run: |
mkdir ./i18n-extract
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
npm run i18n-extract -- --languageFiles=src/locales/${file##*/} --output=i18n-extract/${file##*/}
MISSING=$(cat i18n-extract/${file##*/} | jq '.missingKeys | length')
UNUSED=$(cat i18n-extract/${file##*/} | jq '.unusedKeys | length')
echo "::set-output name=$file::|${file##*/}|${MISSING}|${UNUSED}|"
done
- name: Comment PR
uses: thollander/actions-comment-pull-request@v1
with:
message: |
Language file analysis report:
|File|Missing Keys|Unused Keys|
|:---|---:|---:|
${{join(steps.i18n-extract.outputs.*, '
')}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+83 -84
View File
@@ -6,7 +6,7 @@
"packages": {
"": {
"name": "mainsail",
"version": "2.2.0-beta3",
"version": "2.2.0",
"dependencies": {
"@codemirror/basic-setup": "^0.19.0",
"@codemirror/highlight": "^0.19.6",
@@ -75,7 +75,7 @@
"vite-plugin-pwa": "^0.11.13",
"vite-plugin-vue2": "^1.9.3",
"vue-debounce-decorator": "^1.0.1",
"vue-i18n-extract": "^1.2.3",
"vue-i18n-extract": "^2.0.7",
"vue-router": "^3.5.2",
"vue-template-compiler": "^2.6.14",
"workbox-core": "^6.4.2"
@@ -3753,6 +3753,15 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cac": {
"version": "6.7.12",
"resolved": "https://registry.npmjs.org/cac/-/cac-6.7.12.tgz",
"integrity": "sha512-rM7E2ygtMkJqD9c7WnFU6fruFcN3xe4FM5yUmgxhZzIKJk4uHl9U/fhwdajGFQbQuv43FAUo1Fe8gX/oIKDeSA==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/cachedir": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.3.0.tgz",
@@ -5426,19 +5435,6 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true,
"bin": {
"esparse": "bin/esparse.js",
"esvalidate": "bin/esvalidate.js"
},
"engines": {
"node": ">=4"
}
},
"node_modules/esquery": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz",
@@ -7949,12 +7945,6 @@
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
"dev": true
},
"node_modules/sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
},
"node_modules/sshpk": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz",
@@ -8938,50 +8928,59 @@
"integrity": "sha512-SX35iJHL5PJ4Gfh0Mo/q0shyHiI2V6Zkh51c+k8E9O1RKv5BQyYrCxRzpvPrsIOJEnLaeiovet3dsUB0e/kDzw=="
},
"node_modules/vue-i18n-extract": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/vue-i18n-extract/-/vue-i18n-extract-1.2.3.tgz",
"integrity": "sha512-ZLtF6wp732KHKawHx5ZSmjyydkli9g26z0NfGLP89DkiGx4nKFYZ2oIH35HtImdhcfq1zqkeSwxs7kRzarLoVw==",
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/vue-i18n-extract/-/vue-i18n-extract-2.0.7.tgz",
"integrity": "sha512-i1NW5R58S720iQ1BEk+6ILo3hT6UA8mtYNNolSH4rt9345qvXdvA6GHy2+jHozdDAKHwlu9VvS/+vIMKs1UYQw==",
"dev": true,
"dependencies": {
"commander": "^6.1.0",
"cac": "^6.7.12",
"dot-object": "^2.1.4",
"glob": "^7.1.6",
"glob": "^8.0.1",
"is-valid-glob": "^1.0.0",
"js-yaml": "^3.14.0"
"js-yaml": "^4.1.0"
},
"bin": {
"vue-i18n-extract": "bin/vue-i18n-extract.js"
}
},
"node_modules/vue-i18n-extract/node_modules/argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"node_modules/vue-i18n-extract/node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"dependencies": {
"sprintf-js": "~1.0.2"
"balanced-match": "^1.0.0"
}
},
"node_modules/vue-i18n-extract/node_modules/commander": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
"dev": true,
"engines": {
"node": ">= 6"
}
},
"node_modules/vue-i18n-extract/node_modules/js-yaml": {
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
"node_modules/vue-i18n-extract/node_modules/glob": {
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
"integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==",
"dev": true,
"dependencies": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^5.0.1",
"once": "^1.3.0"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/vue-i18n-extract/node_modules/minimatch": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
"integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
"dev": true,
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/vue-load-image": {
@@ -12229,6 +12228,12 @@
"integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==",
"dev": true
},
"cac": {
"version": "6.7.12",
"resolved": "https://registry.npmjs.org/cac/-/cac-6.7.12.tgz",
"integrity": "sha512-rM7E2ygtMkJqD9c7WnFU6fruFcN3xe4FM5yUmgxhZzIKJk4uHl9U/fhwdajGFQbQuv43FAUo1Fe8gX/oIKDeSA==",
"dev": true
},
"cachedir": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.3.0.tgz",
@@ -13389,12 +13394,6 @@
"eslint-visitor-keys": "^3.3.0"
}
},
"esprima": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
"esquery": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz",
@@ -15230,12 +15229,6 @@
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
"dev": true
},
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
},
"sshpk": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.17.0.tgz",
@@ -15939,41 +15932,47 @@
"integrity": "sha512-SX35iJHL5PJ4Gfh0Mo/q0shyHiI2V6Zkh51c+k8E9O1RKv5BQyYrCxRzpvPrsIOJEnLaeiovet3dsUB0e/kDzw=="
},
"vue-i18n-extract": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/vue-i18n-extract/-/vue-i18n-extract-1.2.3.tgz",
"integrity": "sha512-ZLtF6wp732KHKawHx5ZSmjyydkli9g26z0NfGLP89DkiGx4nKFYZ2oIH35HtImdhcfq1zqkeSwxs7kRzarLoVw==",
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/vue-i18n-extract/-/vue-i18n-extract-2.0.7.tgz",
"integrity": "sha512-i1NW5R58S720iQ1BEk+6ILo3hT6UA8mtYNNolSH4rt9345qvXdvA6GHy2+jHozdDAKHwlu9VvS/+vIMKs1UYQw==",
"dev": true,
"requires": {
"commander": "^6.1.0",
"cac": "^6.7.12",
"dot-object": "^2.1.4",
"glob": "^7.1.6",
"glob": "^8.0.1",
"is-valid-glob": "^1.0.0",
"js-yaml": "^3.14.0"
"js-yaml": "^4.1.0"
},
"dependencies": {
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"requires": {
"sprintf-js": "~1.0.2"
"balanced-match": "^1.0.0"
}
},
"commander": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
"dev": true
},
"js-yaml": {
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
"glob": {
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
"integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==",
"dev": true,
"requires": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^5.0.1",
"once": "^1.3.0"
}
},
"minimatch": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
"integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
"dev": true,
"requires": {
"brace-expansion": "^2.0.1"
}
}
}
+1 -1
View File
@@ -89,7 +89,7 @@
"vite-plugin-pwa": "^0.11.13",
"vite-plugin-vue2": "^1.9.3",
"vue-debounce-decorator": "^1.0.1",
"vue-i18n-extract": "^1.2.3",
"vue-i18n-extract": "^2.0.7",
"vue-router": "^3.5.2",
"vue-template-compiler": "^2.6.14",
"workbox-core": "^6.4.2"
+6 -7
View File
@@ -1,9 +1,8 @@
module.exports = {
vueFilesPath: './src/**/{*.?(js|ts|vue),.i18nignore}',
languageFilesPath: './src/locales/*.json',
options: {
output: false,
add: false,
dynamic: true,
},
vueFiles: './src/**/{*.?(js|ts|vue),.i18nignore}',
languageFiles: './src/locales/*.json',
exclude: ['_last_update'],
output: false,
add: false,
ci: false,
}