~inkscape.dev/inkscape/transform_by_two_points

« back to all changes in this revision

Viewing changes to po/language_statistics.sh

  • Committer: Jabiertxof
  • Date: 2015-08-24 19:48:18 UTC
  • mfrom: (13879.1.440 inkscape)
  • Revision ID: jtx@jtx.marker.es-20150824194818-8q73m6s3w1s1a1p1
update to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
# -*- mode: sh; sh-basic-offset: 4; indent-tabs-mode: nil; -*-
 
3
# vim: set filetype=sh sw=4 sts=4 expandtab autoindent:
 
4
 
 
5
set -eu
 
6
#set -o pipefail
 
7
LANGUAGES="$(grep -v "^\#" ./LINGUAS)"
 
8
#LANGUAGES=${@:-am ar ko}
 
9
#echo $LANGUAGES
 
10
 
 
11
 
 
12
count_msgids () {
 
13
    cat | grep -E '^msgid\s+' | wc -l
 
14
}
 
15
 
 
16
count_original_words () {
 
17
    cat | grep ^msgid | sed 's/^msgid "//g;s/"$//g' | wc -w
 
18
}
 
19
 
 
20
statistics () {
 
21
    PO_MESSAGES="$(mktemp -t XXXXXXXXXX.po)"
 
22
    msgcat --files-from=$PO_FILES --output=$PO_MESSAGES
 
23
    REV_DATE=$(grep "PO-Revision-Date: [1-9]" $PO_MESSAGES |cut -d " " -f2)
 
24
    TOTAL=$(msgattrib --force-po --no-obsolete $PO_MESSAGES | count_msgids)
 
25
    TOTAL_WC=$(msgattrib --force-po --no-obsolete --no-wrap $PO_MESSAGES | count_original_words)
 
26
    FUZZY=$(msgattrib --force-po --only-fuzzy --no-obsolete $PO_MESSAGES | count_msgids)
 
27
    TRANSLATED=$(msgattrib --force-po --translated --no-fuzzy --no-obsolete $PO_MESSAGES | count_msgids)
 
28
    TRANSLATED_WC=$(msgattrib --force-po --translated --no-fuzzy --no-obsolete --no-wrap $PO_MESSAGES | count_original_words)
 
29
    echo "   $lang: $(($TRANSLATED*100/$TOTAL))% ($TRANSLATED/$TOTAL) translated, $(($FUZZY*100/$TOTAL))% ($FUZZY) fuzzy, $(($TRANSLATED_WC*100/$TOTAL_WC))% ($TRANSLATED_WC/$TOTAL_WC) words translated (rev. date: $REV_DATE)"
 
30
    rm -f $PO_FILES $PO_MESSAGES
 
31
}
 
32
 
 
33
# all PO files
 
34
 
 
35
for lang in $LANGUAGES ; do
 
36
    PO_FILES="$(mktemp -t XXXXXXXXXX.pofiles)"
 
37
    find . -iname "$lang.po" > $PO_FILES
 
38
    statistics $PO_FILES
 
39
done