Add check for unused languages in deploy.sh

This commit is contained in:
Felix Ableitner 2021-04-21 14:02:41 +02:00
parent 5230b391ef
commit fe1c819163
2 changed files with 13 additions and 0 deletions

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
set -e
git submodule update --remote git submodule update --remote
git add lemmy-docs git add lemmy-docs
@ -7,6 +8,14 @@ git add joinlemmy-translations
git commit -m"Updating translations" git commit -m"Updating translations"
git push git push
# look for unused translations
for langfile in joinlemmy-translations/translations/*.json; do
lang=$(basename $langfile .json)
if ! grep -q "\"./translations/$lang\"" src/shared/i18next.ts; then
echo "Unused language $lang"
fi
done
new_tag="$1" new_tag="$1"
git tag $new_tag git tag $new_tag

View file

@ -13,6 +13,8 @@ import { fr } from "./translations/fr";
import { el } from "./translations/el"; import { el } from "./translations/el";
import { ko } from "./translations/ko"; import { ko } from "./translations/ko";
import { pl } from "./translations/pl"; import { pl } from "./translations/pl";
import { ar } from "./translations/ar";
import { eo } from "./translations/eo";
// https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66 // https://github.com/nimbusec-oss/inferno-i18next/blob/master/tests/T.test.js#L66
const resources = { const resources = {
@ -28,6 +30,8 @@ const resources = {
el, el,
ko, ko,
pl, pl,
ar,
eo,
}; };
function format(value: any, format: any): any { function format(value: any, format: any): any {