I found the "Rules-*" feature of gettext to do this; sorry for the noise!

--
https://rrt.sc3d.org