Thursday, July 05, 2012

Editing PO File Using Vi

Sometimes I prefer to use vi to do translation, by directly edit a PO file. To complete a partially translated file, it's very handy to know this regex to search untranslated or fuzzy strings:

/^msgstr ""\n^$\|^msgstr\[1\] ""\n^$\|, fuzzy
/^msgstr ""\n^$ will search for untranslated string, taking into account (and skipping) translated multi line strings. ^msgstr\[1\] ""\n^$\ will search for untranslated plural string. While \| are needed to OR multiple regex patterns (need to be escaped).

Update 13rd Jul, 2012: more exact 'fuzzy' matching.

2 comments:

Alexandre Franke said...

You should have a look at http://www.vim.org/scripts/script.php?script_id=2530

Andika Triwidada said...

Whoa, so many functions! Thanks