Simple tool to check for glib-style translation context format



Hi,

I hacked up the attached script that can be used to check
translations for invalid translation of glib-style context
strings.  It's a simple heuristic, but does the job, and we can
extend it as more complex cases show up.

Questions:

1) I can already see the following have incorrect translations in
gtk+ HEAD: bn, br, cs, mk, ne, ru, sq, xh.  Can someone run this
on all current translations of all modules?  And shall we fix it
or let the translators do?  Seems like they don't...  I can hack
another script to automatically fixing them, by replacing their
msgstr with an empty string.  The command I used is this btw:

  for x in *.po; do check-glib-context $x >/dev/null || echo $x; done


2) Shall we write our own extended msgfmt in intltool?  In glib?


3) Ross, can you install this as part of the po/ commit script?


That's all for now I guess.

Cheers,

--behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
	-- Dan Bern, "New American Language"
#!/bin/sh

cat "$@"		|
grep -v "^# "		| # remove translator comments
sed 's/^#[.]/# /'	| # change automatic comments to translator comments
msggrep -K -F -e '|'	| # grep messages with '|' in msgid
msggrep -T -F -e '|'	| # grep messages with '|' in msgstr
msggrep -C -E -i -e '(before|prefix|strip).*[|]' \
			| # grep messages with a comment like "strip before |"
if LANG=C grep .; then
	exit 1
else
	exit 0
fi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]