Created
January 29, 2018 14:31
-
-
Save rnarian/7dc0c915108d2f0f72a2bd036588716e to your computer and use it in GitHub Desktop.
Simple bash script that searches for unused i18n strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -a all_labels=( | |
"GEN_LBL_SALUTATION" | |
"GEN_LBL_TITLE" | |
"GEN_LBL_NAME" | |
"GEN_LBL_FNAME" | |
"GEN_LBL_LNAME" | |
"GEN_LBL_ORGA" | |
"GEN_LBL_POSITION" | |
"GEN_LBL_WEBSITE" | |
"GEN_LBL_TELEPHONE" | |
"GEN_LBL_FAX" | |
); | |
labels_to_remove=(); | |
ignore_files="--ignore-file=is:de.json --ignore-file=is:lang.sh --ignore-file=is:en.json" | |
run=0; | |
for i in "${all_labels[@]}"; do | |
if [[ $(ack "$i" -l $ignore_files;) ]]; then | |
echo -ne "$run / ${#all_labels[@]} \r" | |
else | |
labels_to_remove+=("$i") | |
echo -ne "$run / ${#all_labels[@]}, Adding $i \r" | |
fi | |
run=$[$run +1]; | |
done; | |
for i in "${labels_to_remove[@]}"; do | |
echo "Removing $i" | |
grep -v "$i" ./app/scripts/lang/en.json > ./tmp-en.json; mv ./tmp-en.json ./app/scripts/lang/en.json | |
grep -v "$i" ./app/scripts/lang/de.json > ./tmp-de.json; mv ./tmp-de.json ./app/scripts/lang/de.json | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment