2023-03-04 15:29:28 +01:00
|
|
|
#!/bin/sh
|
2023-03-03 02:33:36 +08:00
|
|
|
|
2023-03-04 15:29:28 +01:00
|
|
|
# this script runs in alpine image which only has `sh` shell
|
2025-12-19 09:50:48 -08:00
|
|
|
if [ ! -f ./options/locale/locale_en-US.json ]; then
|
2023-03-03 02:33:36 +08:00
|
|
|
echo "please run this script in the root directory of the project"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2020-01-21 17:26:17 +01:00
|
|
|
|
2025-12-19 09:50:48 -08:00
|
|
|
mv ./options/locale/locale_en-US.json ./options/
|
2023-03-03 02:33:36 +08:00
|
|
|
|
2020-01-21 17:26:17 +01:00
|
|
|
# Remove translation under 25% of en_us
|
2025-12-25 12:51:33 -08:00
|
|
|
baselines=$(cat "./options/locale_en-US.json" | wc -l)
|
2020-01-21 17:26:17 +01:00
|
|
|
baselines=$((baselines / 4))
|
2025-12-19 09:50:48 -08:00
|
|
|
for filename in ./options/locale/*.json; do
|
2025-12-25 12:51:33 -08:00
|
|
|
lines=$(cat "$filename" | wc -l)
|
|
|
|
|
if [ "$lines" -lt "$baselines" ]; then
|
2020-01-21 17:26:17 +01:00
|
|
|
echo "Removing $filename: $lines/$baselines"
|
|
|
|
|
rm "$filename"
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
|
2025-12-19 09:50:48 -08:00
|
|
|
mv ./options/locale_en-US.json ./options/locale/
|