view src/po/cleanup.vim @ 27708:bb1a3e598a86 v8.2.4380

patch 8.2.4380: small differences between Chinese translation files Commit: https://github.com/vim/vim/commit/774e55702f236b0f16ef4a255a290dc87cfca67b Author: Ada <me@yuhaowen.com> Date: Mon Feb 14 15:04:55 2022 +0000 patch 8.2.4380: small differences between Chinese translation files Problem: Small differences between Chinese translation files. Solution: Add rule for converting UTF-8 to gb2312. (closes https://github.com/vim/vim/issues/9773)
author Bram Moolenaar <Bram@vim.org>
date Mon, 14 Feb 2022 16:15:03 +0100
parents 325a1dbf662d
children 5d26e9a7f8f2
line wrap: on
line source

" Vim script to cleanup a .po file:
" - Remove line numbers (avoids that diffs are messy).
" - Comment-out fuzzy and empty messages.
" - Make sure there is a space before the string (required for Solaris).
" Requires Vim 6.0 or later (because of multi-line search patterns).

" Disable diff mode, because it makes this very slow
let s:was_diff = &diff
setl nodiff

" untranslated message preceded by c-format or comment
silent g/^#, c-format\n#/.d
silent g/^#\..*\n#/.d

silent g/^#[:~] /d
silent g/^#, fuzzy\(, .*\)\=\nmsgid ""\@!/.+1,/^$/-1s/^/#\~ /
silent g/^msgstr"/s//msgstr "/
silent g/^msgid"/s//msgid "/
silent g/^msgstr ""\(\n"\)\@!/?^msgid?,.s/^/#\~ /

silent g/^\n\n\n/.d

if s:was_diff
  setl diff
endif