aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2021-10-23 15:10:28 -0400
committerJames McCoy <jamessan@jamessan.com>2021-11-01 06:40:00 -0400
commit684640f5518a483cf2bc48efc8f68449379cef69 (patch)
treea57866f1d9ca7d05e1a3436015d8aaa3c59438e8 /src/nvim/ex_cmds.c
parent7f4b7320f63eee37841b9b7608495a3f6f9d2fb7 (diff)
downloadrneovim-684640f5518a483cf2bc48efc8f68449379cef69.tar.gz
rneovim-684640f5518a483cf2bc48efc8f68449379cef69.tar.bz2
rneovim-684640f5518a483cf2bc48efc8f68449379cef69.zip
vim-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) https://github.com/vim/vim/commit/da6e8919e75fa8f961d1b805e877c8a92e76dafb
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 8db1f984ba..b5a3a5fad7 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -1015,11 +1015,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
ml_delete(line1 + extra, true);
}
if (!global_busy && num_lines > p_report) {
- if (num_lines == 1) {
- MSG(_("1 line moved"));
- } else {
- smsg(_("%" PRId64 " lines moved"), (int64_t)num_lines);
- }
+ smsg(NGETTEXT("1 line moved", "%" PRId64 " lines moved", num_lines), (int64_t)num_lines);
}
extmark_move_region(curbuf, line1-1, 0, start_byte,
@@ -4456,22 +4452,20 @@ bool do_sub_msg(bool count_only)
} else {
*msg_buf = NUL;
}
- if (sub_nsubs == 1) {
- vim_snprintf_add(msg_buf, sizeof(msg_buf),
- "%s", count_only ? _("1 match") : _("1 substitution"));
- } else {
- vim_snprintf_add(msg_buf, sizeof(msg_buf),
- count_only ? _("%" PRId64 " matches")
- : _("%" PRId64 " substitutions"),
- (int64_t)sub_nsubs);
- }
- if (sub_nlines == 1) {
- vim_snprintf_add(msg_buf, sizeof(msg_buf),
- "%s", _(" on 1 line"));
- } else {
- vim_snprintf_add(msg_buf, sizeof(msg_buf),
- _(" on %" PRId64 " lines"), (int64_t)sub_nlines);
- }
+
+ char *msg_single = count_only
+ ? NGETTEXT("%" PRId64 " match on %" PRId64 " line",
+ "%" PRId64 " matches on %" PRId64 " line", sub_nsubs)
+ : NGETTEXT("%" PRId64 " substitution on %" PRId64 " line",
+ "%" PRId64 " substitutions on %" PRId64 " line", sub_nsubs);
+ char *msg_plural = count_only
+ ? NGETTEXT("%" PRId64 " match on %" PRId64 " lines",
+ "%" PRId64 " matches on %" PRId64 " lines", sub_nsubs)
+ : NGETTEXT("%" PRId64 " substitution on %" PRId64 " lines",
+ "%" PRId64 " substitutions on %" PRId64 " lines", sub_nsubs);
+ vim_snprintf_add((char *)msg_buf, sizeof(msg_buf),
+ NGETTEXT(msg_single, msg_plural, sub_nlines),
+ (int64_t)sub_nsubs, (int64_t)sub_nlines);
if (msg((char_u *)msg_buf)) {
// save message to display it after redraw
set_keep_msg((char_u *)msg_buf, 0);