#! /bin/sh -e
# vim: set sw=2 expandtab:
# $1: es.po fr.po pt.po zh-cn.po zh-cn.po-best ...
#
MSGATTR="msgattrib"
#
for f in "$@"; do
  TOTAL="$(${MSGATTR} --no-obsolete "po/$f" | grep ^msgid | sed 1d | wc -l)"
  UNTRANSLATED="$(${MSGATTR} --untranslated "po/$f" | grep ^msgid | sed 1d | wc -l)"
  FUZZY="$(${MSGATTR} --fuzzy "po/$f" | grep ^msgid | sed 1d | wc -l)"
  COMPLETED="$(((TOTAL - UNTRANSLATED - FUZZY) * 100 / TOTAL))"
  echo "$f  $TOTAL strings -- TOTAL msgstr to translate"
  echo "$f    $UNTRANSLATED strings -- EMPTY msgstr"
  echo "$f    $FUZZY strings -- FUZZY msgstr"
  echo "$f  $COMPLETED %       -- COMPLETED translation (must be more than 40%)"
  echo
done
