Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
9753:bba3d9fa5a35 | 9754:a990e7ed260b |
---|---|
3446 linenr_T lnum; | 3446 linenr_T lnum; |
3447 char_u *s; | 3447 char_u *s; |
3448 char_u *r; | 3448 char_u *r; |
3449 int len; | 3449 int len; |
3450 char *txt; | 3450 char *txt; |
3451 long count; | |
3451 #endif | 3452 #endif |
3452 | 3453 |
3453 rettv->v_type = VAR_STRING; | 3454 rettv->v_type = VAR_STRING; |
3454 rettv->vval.v_string = NULL; | 3455 rettv->vval.v_string = NULL; |
3455 #ifdef FEAT_FOLDING | 3456 #ifdef FEAT_FOLDING |
3476 s = skipwhite(ml_get(lnum + 1)); | 3477 s = skipwhite(ml_get(lnum + 1)); |
3477 if (*s == '*') | 3478 if (*s == '*') |
3478 s = skipwhite(s + 1); | 3479 s = skipwhite(s + 1); |
3479 } | 3480 } |
3480 } | 3481 } |
3481 txt = _("+-%s%3ld lines: "); | 3482 count = (long)(foldend - foldstart + 1); |
3483 txt = ngettext("+-%s%3ld line: ", "+-%s%3ld lines: ", count); | |
3482 r = alloc((unsigned)(STRLEN(txt) | 3484 r = alloc((unsigned)(STRLEN(txt) |
3483 + STRLEN(dashes) /* for %s */ | 3485 + STRLEN(dashes) /* for %s */ |
3484 + 20 /* for %3ld */ | 3486 + 20 /* for %3ld */ |
3485 + STRLEN(s))); /* concatenated */ | 3487 + STRLEN(s))); /* concatenated */ |
3486 if (r != NULL) | 3488 if (r != NULL) |
3487 { | 3489 { |
3488 sprintf((char *)r, txt, dashes, (long)(foldend - foldstart + 1)); | 3490 sprintf((char *)r, txt, dashes, count); |
3489 len = (int)STRLEN(r); | 3491 len = (int)STRLEN(r); |
3490 STRCAT(r, s); | 3492 STRCAT(r, s); |
3491 /* remove 'foldmarker' and 'commentstring' */ | 3493 /* remove 'foldmarker' and 'commentstring' */ |
3492 foldtext_cleanup(r + len); | 3494 foldtext_cleanup(r + len); |
3493 rettv->vval.v_string = r; | 3495 rettv->vval.v_string = r; |
3503 f_foldtextresult(typval_T *argvars UNUSED, typval_T *rettv) | 3505 f_foldtextresult(typval_T *argvars UNUSED, typval_T *rettv) |
3504 { | 3506 { |
3505 #ifdef FEAT_FOLDING | 3507 #ifdef FEAT_FOLDING |
3506 linenr_T lnum; | 3508 linenr_T lnum; |
3507 char_u *text; | 3509 char_u *text; |
3508 char_u buf[51]; | 3510 char_u buf[FOLD_TEXT_LEN]; |
3509 foldinfo_T foldinfo; | 3511 foldinfo_T foldinfo; |
3510 int fold_count; | 3512 int fold_count; |
3511 #endif | 3513 #endif |
3512 | 3514 |
3513 rettv->v_type = VAR_STRING; | 3515 rettv->v_type = VAR_STRING; |
3518 if (lnum < 0) | 3520 if (lnum < 0) |
3519 lnum = 0; | 3521 lnum = 0; |
3520 fold_count = foldedCount(curwin, lnum, &foldinfo); | 3522 fold_count = foldedCount(curwin, lnum, &foldinfo); |
3521 if (fold_count > 0) | 3523 if (fold_count > 0) |
3522 { | 3524 { |
3523 text = get_foldtext(curwin, lnum, lnum + fold_count - 1, | 3525 text = get_foldtext(curwin, lnum, lnum + fold_count - 1, &foldinfo, buf); |
3524 &foldinfo, buf); | |
3525 if (text == buf) | 3526 if (text == buf) |
3526 text = vim_strsave(text); | 3527 text = vim_strsave(text); |
3527 rettv->vval.v_string = text; | 3528 rettv->vval.v_string = text; |
3528 } | 3529 } |
3529 #endif | 3530 #endif |