Commit 2b3be8ec authored by Tails developers's avatar Tails developers
Browse files

Support running language_statistics.sh from the root of the repository too,...

Support running language_statistics.sh from the root of the repository too, and error out if it's not run from a supported place.
parent 12a16d45
......@@ -39,6 +39,18 @@ statistics () {
rm -f $PO_FILES $PO_MESSAGES
}
# sanity checks
if pwd | grep -qs 'wiki/src$' ; then
WEBSITE_ROOT_DIR='.'
elif [ -d '.git' ] ; then
WEBSITE_ROOT_DIR='wiki/src'
else
echo >&2 "Error: $(basename $0) is meant to be run either from the wiki/src directory,"
echo >&2 " or from the root of the source tree"
exit 1
fi
# all PO files
echo "All PO files"
echo "============"
......@@ -46,8 +58,8 @@ echo ""
for lang in $LANGUAGES ; do
PO_FILES="$(mktemp -t XXXXXX.$lang)"
find -iname "*.$lang.po" > $PO_FILES
find -path "*/locale/$lang/LC_MESSAGES/*.po" >> $PO_FILES
find "$WEBSITE_ROOT_DIR" -iname "*.$lang.po" > $PO_FILES
find "$WEBSITE_ROOT_DIR" -path "*/locale/$lang/LC_MESSAGES/*.po" >> $PO_FILES
statistics $PO_FILES
done
......@@ -59,6 +71,9 @@ echo ""
for lang in $LANGUAGES ; do
PO_FILES="$(mktemp -t XXXXXX.$lang)"
cat contribute/l10n_tricks/core_po_files.txt | sed "s/$/.$lang.po/g" > $PO_FILES
cat "$WEBSITE_ROOT_DIR"/contribute/l10n_tricks/core_po_files.txt \
| sed "s/$/.$lang.po/g" \
| sed "s,^,$WEBSITE_ROOT_DIR/," \
> $PO_FILES
statistics $PO_FILES
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment