From ad7d1ae7bc137fd6f2c67e4e66fe65f8d42774c3 Mon Sep 17 00:00:00 2001 From: Mathias Kresin Date: Thu, 8 Jan 2015 23:54:24 +0100 Subject: [PATCH] Add script to find missing locales from fguillot/kanboard#393 and adjusted for miniflux usage --- scripts/find-strings.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 scripts/find-strings.sh diff --git a/scripts/find-strings.sh b/scripts/find-strings.sh new file mode 100755 index 0000000..87e17b3 --- /dev/null +++ b/scripts/find-strings.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +REF_LANG=${1:-fr_FR} + +### +APP_DIR=`dirname $0`/../ +LANG_FILE=$APP_DIR/locales/$REF_LANG/translations.php +TMPFILE=`mktemp` + +# find all strings used with t() or e() and write them to a temp buffer +find $APP_DIR -name '*.php' -print | xargs -n 1 cat | grep -oP -e "\b(t|tne)\((\"\K.*?\"|\'\K.*?\') *[\)\,]" | sed -e "s/'[),]$//" -e 's/\\/\\\\/g' | sort | uniq > $TMPFILE + +echo "Missing strings from $REF_LANG: (if none printed, none missing)" +while read LINE +do + grep -F "'$LINE'" $LANG_FILE > /dev/null + if [[ $? -ne 0 ]]; then + echo " '$LINE' => ''," + fi +done < $TMPFILE + +# delete the work file +rm $TMPFILE \ No newline at end of file