Mercurial > vim
diff src/evalfunc.c @ 9754:a990e7ed260b v7.4.2152
commit https://github.com/vim/vim/commit/ee695f787ade7fd88fc5f5497553d95c0c3645b5
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Aug 3 22:08:45 2016 +0200
patch 7.4.2152
Problem: No proper translation of messages with a count.
Solution: Use ngettext(). (Sergey Alyoshin)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 03 Aug 2016 22:15:06 +0200 |
parents | 80ac9cf77c9b |
children | be9b5f8c3fd9 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -3448,6 +3448,7 @@ f_foldtext(typval_T *argvars UNUSED, typ char_u *r; int len; char *txt; + long count; #endif rettv->v_type = VAR_STRING; @@ -3478,14 +3479,15 @@ f_foldtext(typval_T *argvars UNUSED, typ s = skipwhite(s + 1); } } - txt = _("+-%s%3ld lines: "); + count = (long)(foldend - foldstart + 1); + txt = ngettext("+-%s%3ld line: ", "+-%s%3ld lines: ", count); r = alloc((unsigned)(STRLEN(txt) + STRLEN(dashes) /* for %s */ + 20 /* for %3ld */ + STRLEN(s))); /* concatenated */ if (r != NULL) { - sprintf((char *)r, txt, dashes, (long)(foldend - foldstart + 1)); + sprintf((char *)r, txt, dashes, count); len = (int)STRLEN(r); STRCAT(r, s); /* remove 'foldmarker' and 'commentstring' */ @@ -3505,7 +3507,7 @@ f_foldtextresult(typval_T *argvars UNUSE #ifdef FEAT_FOLDING linenr_T lnum; char_u *text; - char_u buf[51]; + char_u buf[FOLD_TEXT_LEN]; foldinfo_T foldinfo; int fold_count; #endif @@ -3520,8 +3522,7 @@ f_foldtextresult(typval_T *argvars UNUSE fold_count = foldedCount(curwin, lnum, &foldinfo); if (fold_count > 0) { - text = get_foldtext(curwin, lnum, lnum + fold_count - 1, - &foldinfo, buf); + text = get_foldtext(curwin, lnum, lnum + fold_count - 1, &foldinfo, buf); if (text == buf) text = vim_strsave(text); rettv->vval.v_string = text;