From 608532746a68da0b9c5405be8b07a851678f4559 Mon Sep 17 00:00:00 2001 From: iota97 Date: Thu, 12 May 2022 08:42:41 +0200 Subject: [PATCH] Unused lang tool --- .gitignore | 3 +++ Tools/langtool/unused-euristic.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 Tools/langtool/unused-euristic.sh diff --git a/.gitignore b/.gitignore index b65839d809..d4f7f8338d 100644 --- a/.gitignore +++ b/.gitignore @@ -122,3 +122,6 @@ debian/ppsspp/ # CMake stuff CMakeFiles + +# Clangd +.cache/ \ No newline at end of file diff --git a/Tools/langtool/unused-euristic.sh b/Tools/langtool/unused-euristic.sh new file mode 100755 index 0000000000..d061918189 --- /dev/null +++ b/Tools/langtool/unused-euristic.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +langfile='../../assets/lang/en_US.ini' +folders=('../../UI/' '../../Core/' '../../Common/' '../../Windows/' '../../assets/shaders' '../../assets/themes') + +# reading each line +while read line; do + # skip empty line, section and comment + if [[ ! -z "$line" && ${line::1} != "[" && ${line::1} != "#" ]]; then + # get everything before the = sign + value=${line/ =*/} + + found=0 + for folder in ${folders[@]}; do + # use recursive grep on the folder + grep -r "$value" $folder > /dev/null + # check return value + ret=$? + if [ $ret -eq 0 ]; then + found=1 + fi + done + + # print if not found + if [ $found -eq 0 ]; then + echo $value + fi + fi +done < $langfile \ No newline at end of file