diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-08-21 15:12:14 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-08-21 15:12:14 +0200 |
commit | da6e8919e75fa8f961d1b805e877c8a92e76dafb (patch) | |
tree | 1e001a2e07d4a1d51d83f4d5a5efe91b3caeef84 /src/ops.c | |
parent | 830e3583da682eee41ed6b027c9912547d4022c0 (diff) | |
download | vim-git-da6e8919e75fa8f961d1b805e877c8a92e76dafb.tar.gz |
patch 8.1.0306: plural messages are not translated properlyv8.1.0306
Problem: Plural messages are not translated properly.
Solution: Add more usage of NGETTEXT(). (Sergey Alyoshin)
Diffstat (limited to 'src/ops.c')
-rw-r--r-- | src/ops.c | 73 |
1 files changed, 28 insertions, 45 deletions
@@ -244,7 +244,6 @@ op_shift(oparg_T *oap, int curs_top, int amount) { long i; int first_char; - char_u *s; int block_col = 0; if (u_save((linenr_T)(oap->start.lnum - 1), @@ -297,26 +296,21 @@ op_shift(oparg_T *oap, int curs_top, int amount) if (oap->line_count > p_report) { + char *op; + char *msg_line_single; + char *msg_line_plural; + if (oap->op_type == OP_RSHIFT) - s = (char_u *)">"; - else - s = (char_u *)"<"; - if (oap->line_count == 1) - { - if (amount == 1) - sprintf((char *)IObuff, _("1 line %sed 1 time"), s); - else - sprintf((char *)IObuff, _("1 line %sed %d times"), s, amount); - } + op = ">"; else - { - if (amount == 1) - sprintf((char *)IObuff, _("%ld lines %sed 1 time"), - oap->line_count, s); - else - sprintf((char *)IObuff, _("%ld lines %sed %d times"), - oap->line_count, s, amount); - } + op = "<"; + msg_line_single = NGETTEXT("%ld line %sed %d time", + "%ld line %sed %d times", amount); + msg_line_plural = NGETTEXT("%ld lines %sed %d time", + "%ld lines %sed %d times", amount); + vim_snprintf((char *)IObuff, IOSIZE, + NGETTEXT(msg_line_single, msg_line_plural, oap->line_count), + oap->line_count, op, amount); msg(IObuff); } @@ -789,10 +783,8 @@ op_reindent(oparg_T *oap, int (*how)(void)) if (oap->line_count > p_report) { i = oap->line_count - (i + 1); - if (i == 1) - MSG(_("1 line indented ")); - else - smsg((char_u *)_("%ld lines indented "), i); + smsg((char_u *)NGETTEXT("%ld line indented ", + "%ld lines indented ", i), i); } /* set '[ and '] marks */ curbuf->b_op_start = oap->start; @@ -2529,12 +2521,8 @@ op_tilde(oparg_T *oap) curbuf->b_op_end = oap->end; if (oap->line_count > p_report) - { - if (oap->line_count == 1) - MSG(_("1 line changed")); - else - smsg((char_u *)_("%ld lines changed"), oap->line_count); - } + smsg((char_u *)NGETTEXT("%ld line changed", "%ld lines changed", + oap->line_count), oap->line_count); } /* @@ -3348,19 +3336,18 @@ op_yank(oparg_T *oap, int deleting, int mess) /* redisplay now, so message is not deleted */ update_topline_redraw(); - if (yanklines == 1) + if (oap->block_mode) { - if (oap->block_mode) - smsg((char_u *)_("block of 1 line yanked%s"), namebuf); - else - smsg((char_u *)_("1 line yanked%s"), namebuf); + smsg((char_u *)NGETTEXT("block of %ld line yanked%s", + "block of %ld lines yanked%s", yanklines), + yanklines, namebuf); } - else if (oap->block_mode) - smsg((char_u *)_("block of %ld lines yanked%s"), - yanklines, namebuf); else - smsg((char_u *)_("%ld lines yanked%s"), yanklines, - namebuf); + { + smsg((char_u *)NGETTEXT("%ld line yanked%s", + "%ld lines yanked%s", yanklines), + yanklines, namebuf); + } } } @@ -5653,12 +5640,8 @@ op_addsub( curbuf->b_op_start = startpos; if (change_cnt > p_report) - { - if (change_cnt == 1) - MSG(_("1 line changed")); - else - smsg((char_u *)_("%ld lines changed"), change_cnt); - } + smsg((char_u *)NGETTEXT("%ld line changed", "%ld lines changed", + change_cnt), change_cnt); } } |