2 # -*- mode: sh; sh-basic-offset: 4; indent-tabs-mode: nil; -*-
3 # vim: set filetype=sh sw=4 sts=4 expandtab autoindent:
8 LANGUAGES
=${@:-de fr pt}
11 cat |
grep -E '^msgid\s+' |
wc -l
14 count_original_words
() {
15 cat |
grep ^msgid |
sed 's/^msgid "//g;s/"$//g' |
wc -w
18 count_translated_words
() {
19 cat |
grep ^msgstr |
sed 's/^msgstr "//g;s/"$//g' |
wc -w
23 PO_MESSAGES
="$(mktemp -t XXXXXX.$lang.po)"
24 msgcat
--files-from=$PO_FILES --output=$PO_MESSAGES
25 TOTAL
=$
(msgattrib
--no-obsolete $PO_MESSAGES | count_msgids
)
27 msgattrib
--no-obsolete --no-wrap $PO_MESSAGES | count_original_words
29 FUZZY
=$
(msgattrib
--only-fuzzy --no-obsolete $PO_MESSAGES | count_msgids
)
31 msgattrib
--translated --no-fuzzy --no-obsolete $PO_MESSAGES \
35 msgattrib
--translated --no-fuzzy --no-obsolete --no-wrap $PO_MESSAGES \
36 | count_translated_words
38 echo " - $lang: $(($TRANSLATED*100/$TOTAL))% ($TRANSLATED) strings translated, $(($FUZZY*100/$TOTAL))% strings fuzzy, $(($TRANSLATED_WC*100/$TOTAL_WC))% words translated"
39 rm -f $PO_FILES $PO_MESSAGES
44 if pwd |
grep -qs 'wiki/src$' ; then
46 elif [ -d '.git' ] ; then
47 WEBSITE_ROOT_DIR
='wiki/src'
49 echo >&2 "Error: $(basename $0) is meant to be run either from the wiki/src directory,"
50 echo >&2 " or from the root of the source tree"
55 echo "All website PO files"
56 echo "===================="
59 for lang
in $LANGUAGES ; do
60 PO_FILES
="$(mktemp -t XXXXXX.$lang)"
61 find "$WEBSITE_ROOT_DIR" -iname "*.$lang.po" > $PO_FILES
62 find "$WEBSITE_ROOT_DIR" -path "*/locale/$lang/LC_MESSAGES/*.po" >> $PO_FILES
68 echo "[[Core PO files|contribute/l10n_tricks/core_po_files.txt]]"
69 echo "=========================================================="
72 for lang
in $LANGUAGES ; do
73 PO_FILES
="$(mktemp -t XXXXXX.$lang)"
74 cat "$WEBSITE_ROOT_DIR"/contribute
/l10n_tricks
/core_po_files.txt \
75 |
sed "s/$/.$lang.po/g" \
76 |
sed "s,^,$WEBSITE_ROOT_DIR/," \