Merge pull request #47 from LemmyNet/unused-langs-check

Add check for unused languages in deploy.sh
This commit is contained in:
Dessalines 2021-04-21 10:31:37 -04:00 committed by GitHub
commit 968eff6b32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -1,4 +1,5 @@
#!/bin/bash
set -e
git submodule update --remote
git add lemmy-docs
@ -7,6 +8,14 @@ git add joinlemmy-translations
git commit -m"Updating translations"
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"
git tag $new_tag

View File

@ -13,6 +13,8 @@ import { fr } from "./translations/fr";
import { el } from "./translations/el";
import { ko } from "./translations/ko";
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
const resources = {
@ -28,6 +30,8 @@ const resources = {
el,
ko,
pl,
ar,
eo,
};
function format(value: any, format: any): any {