July 12, 2023

Adventures in Po Files

I’m an Italian translator for the newsboat program.

Basically what I need to do is find changed and new strings to translate.

Changed strings are marked with the fuzzy attribute when the .po file is updated.

It’s pretty easy just to search for the word fuzzy in vim.

Searching for added strings is a bit more annoying, a message can be split on multiple lines so just grepping for "" in the message string returns a of stuff which does not need to be translated.

I’ve found out on stack-overflow that I can use this command to find new empty added translations:

msggrep -v -T -e "." po/it.po

It use the msggrep program from gettext which, as the name suggests is a grep-like utility to find matches in a .po file.

It’s invoked which the following options:

  • -v to invert the match,
  • -T to match msgstr,
  • -e specifies the regular expression to match.

So it reads all the lines which msgstr is empty, which is pretty cool.

© Mauro Scomparin 2020 - 2023

Powered by Hugo & Kiss.