diff src/ops.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 0a69e6e708f9
children 27b9a84395b5
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -244,7 +244,6 @@ op_shift(oparg_T *oap, int curs_top, int
 {
     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
 
     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 *)">";
+	    op = ">";
 	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);
-	}
-	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)(voi
     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 
 
 	    /* 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);
     }
 }