summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-16 10:17:19 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-16 10:17:19 -0500
commita994e07f64b7fb7fe42386290c8fb7ab665f681a (patch)
tree6d8852ce91492d25e3e4acae162601e30a355ba6 /scripts
parent557bc2c3cd1fd2dddf1d7c03731aaaf173cd2bb7 (diff)
Add script to find missing locales and update locales (pull-request #393)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/find-strings.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/find-strings.sh b/scripts/find-strings.sh
new file mode 100755
index 00000000..752a2f83
--- /dev/null
+++ b/scripts/find-strings.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+REF_LANG=${1:-fr_FR}
+
+###
+APP_DIR=`dirname $0`/../app
+LANG_FILE=$APP_DIR/Locale/$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[et]\((\"\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