tAdd script to check all printf format strings - vaccinewars - be a doctor and try to vaccinate the world
 (HTM) git clone git://src.adamsgaard.dk/vaccinewars
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit fdfed750468cc5f871daae642ca72d0c7182f826
 (DIR) parent 6a53ebb74edf9385689c3622a77750840f64112a
 (HTM) Author: Ben Webb <ben@salilab.org>
       Date:   Sat,  5 Dec 2020 23:53:49 -0800
       
       Add script to check all printf format strings
       
       We don't currently check .po files to see if printf-style
       format strings match, because gettext's msgfmt utility
       doesn't like our %tde or %P notation. Add a utility to
       generate an intermediate .po file by mapping %tde to %s
       and %P to %d, and then check that with gettext. Closes #56.
       
       Diffstat:
         M auxbuild/README-release             |       2 +-
         A po/check-cformat.sh                 |      16 ++++++++++++++++
       
       2 files changed, 17 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/auxbuild/README-release b/auxbuild/README-release
       t@@ -1,6 +1,6 @@
        New version checklist:
        
       -- cd po; rm dopewars.pot; make dopewars.pot; make update-po
       +- cd po; rm dopewars.pot; make dopewars.pot; make update-po; ./check-cformat.sh
        - Add version number, date to ChangeLog
        - Change stable version number in NEWS README.md doc/installation.html doc/index.html doc/windows.html
        - git checkout -b release/x.y.z
 (DIR) diff --git a/po/check-cformat.sh b/po/check-cformat.sh
       t@@ -0,0 +1,16 @@
       +#!/bin/bash
       +
       +# Check all translations for broken printf format strings
       +
       +# Usually this is done by msgfmt, but it chokes on our %Tde and %P notations,
       +# so we disable it in the Makefile.
       +
       +# This simple script temporarily replaces each %Tde with %s and each %P
       +# with %d, so that msgfmt can be run.
       +
       +POFILES=$(grep '^POFILES =' Makefile|cut -d= -f2)
       +
       +for po in ${POFILES}; do
       +  perl -p -e 's/%(([0-9]+$)?-?[0-9]*)[tT]../((t)%\1s/g; s/%(([0-9]+$)?-?[0-9]*)P/(P)%\1d/g' < ${po} > ${po}.tmp; msgfmt -c --statistics --verbose ${po}.tmp > /dev/null && rm -f ${po}.tmp
       +done
       +rm -f messages.mo