Mercurial > vim
diff src/ex_cmds.c @ 14585:c8f07e8b273e v8.1.0306
patch 8.1.0306: plural messages are not translated properly
commit https://github.com/vim/vim/commit/da6e8919e75fa8f961d1b805e877c8a92e76dafb
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 21 15:12:14 2018 +0200
patch 8.1.0306: plural messages are not translated properly
Problem: Plural messages are not translated properly.
Solution: Add more usage of NGETTEXT(). (Sergey Alyoshin)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 21 Aug 2018 15:15:06 +0200 |
parents | 076b9632bda4 |
children | 193471015e1a |
line wrap: on
line diff
--- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -985,12 +985,8 @@ do_move(linenr_T line1, linenr_T line2, ml_delete(line1 + extra, TRUE); if (!global_busy && num_lines > p_report) - { - if (num_lines == 1) - MSG(_("1 line moved")); - else - smsg((char_u *)_("%ld lines moved"), num_lines); - } + smsg((char_u *)NGETTEXT("%ld line moved", "%ld lines moved", num_lines), + (long)num_lines); /* * Leave the cursor on the last of the moved lines. @@ -5940,23 +5936,29 @@ do_sub_msg( || count_only) && messaging()) { + char *msg_single; + char *msg_plural; + if (got_int) STRCPY(msg_buf, _("(Interrupted) ")); else *msg_buf = NUL; - if (sub_nsubs == 1) - vim_snprintf_add((char *)msg_buf, sizeof(msg_buf), - "%s", count_only ? _("1 match") : _("1 substitution")); - else - vim_snprintf_add((char *)msg_buf, sizeof(msg_buf), - count_only ? _("%ld matches") : _("%ld substitutions"), - sub_nsubs); - if (sub_nlines == 1) - vim_snprintf_add((char *)msg_buf, sizeof(msg_buf), - "%s", _(" on 1 line")); - else - vim_snprintf_add((char *)msg_buf, sizeof(msg_buf), - _(" on %ld lines"), (long)sub_nlines); + + msg_single = count_only + ? NGETTEXT("%ld match on %ld line", + "%ld matches on %ld line", sub_nsubs) + : NGETTEXT("%ld substitution on %ld line", + "%ld substitutions on %ld line", sub_nsubs); + msg_plural = count_only + ? NGETTEXT("%ld match on %ld lines", + "%ld matches on %ld lines", sub_nsubs) + : NGETTEXT("%ld substitution on %ld lines", + "%ld substitutions on %ld lines", sub_nsubs); + + vim_snprintf_add((char *)msg_buf, sizeof(msg_buf), + NGETTEXT(msg_single, msg_plural, sub_nlines), + sub_nsubs, (long)sub_nlines); + if (msg(msg_buf)) /* save message to display it after redraw */ set_keep_msg(msg_buf, 0);