robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
0860b24c2c
master
1" Vim script to cleanup a .po file: 2" - Remove line numbers (avoids that diffs are messy). 3" - Comment-out fuzzy and empty messages. 4" - Make sure there is a space before the string (required for Solaris). 5" Requires Vim 6.0 or later (because of multi-line search patterns). 6 7" Disable diff mode, because it makes this very slow 8let s: was_diff = & diff 9setl nodiff 10 11" untranslated message preceded by c-format or comment 12silent g /^#, c-format\n# /.d _ 13silent g /^#\.. * \n# /.d _ 14 15" c-format comments have no effect, the check.vim scripts checks it. 16" But they might still be useful? 17" silent g/^#, c-format$/d _ 18 19silent g /^# [ :~ ] /d _ 20silent g /^#, fuzzy\(, . * \)\=\nmsgid ""\@! /.+1 , / ^$ / -1 s /^/#\~ / 21silent g /^msgstr" /s //msgstr "/ 22silent g /^msgid" /s //msgid "/ 23silent g /^msgstr ""\(\n"\)\@! /?^msgid ?, .s /^/#\~ / 24 25" remove stray comment 26silent g /^\%(#. * \n\)\+\n /d 27 28" Comments only useful for the translator 29silent g /^#\. /d _ 30 31" clean up empty lines 32silent g /^\n\n /.d _ 33silent ! %s /\n\+\%$// 34 35if s: was_diff 36setl diff 37endif