Skip to content

Commit 11dd8c1

Browse files
committed
patch 8.0.0411: menu translations don't match when case is changed.
Problem: We can't change the case in menu entries, it breaks translations. Solution: Ignore case when looking up a menu translation.
1 parent a54d2fc commit 11dd8c1

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/menu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2455,7 +2455,7 @@ menutrans_lookup(char_u *name, int len)
24552455
char_u *dname;
24562456

24572457
for (i = 0; i < menutrans_ga.ga_len; ++i)
2458-
if (STRNCMP(name, tp[i].from, len) == 0 && tp[i].from[len] == NUL)
2458+
if (STRNICMP(name, tp[i].from, len) == 0 && tp[i].from[len] == NUL)
24592459
return tp[i].to;
24602460

24612461
/* Now try again while ignoring '&' characters. */
@@ -2466,7 +2466,7 @@ menutrans_lookup(char_u *name, int len)
24662466
if (dname != NULL)
24672467
{
24682468
for (i = 0; i < menutrans_ga.ga_len; ++i)
2469-
if (STRCMP(dname, tp[i].from_noamp) == 0)
2469+
if (STRICMP(dname, tp[i].from_noamp) == 0)
24702470
{
24712471
vim_free(dname);
24722472
return tp[i].to;

src/testdir/test_menu.vim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
" Test that the system menu can be loaded.
22

3+
if !has('menu')
4+
finish
5+
endif
6+
37
func Test_load_menu()
48
try
59
source $VIMRUNTIME/menu.vim
610
catch
711
call assert_false(1, 'error while loading menus: ' . v:exception)
812
endtry
13+
source $VIMRUNTIME/delmenu.vim
14+
endfunc
15+
16+
func Test_translate_menu()
17+
if !has('multi_lang')
18+
return
19+
endif
20+
if !filereadable($VIMRUNTIME . '/lang/menu_de_de.latin1.vim')
21+
throw 'Skipped: translated menu not found'
22+
endif
23+
24+
set langmenu=de_de
25+
source $VIMRUNTIME/menu.vim
26+
call assert_match(':browse tabnew', execute(':menu File.In\ neuem\ Tab\ öffnen\.\.\.'))
27+
28+
source $VIMRUNTIME/delmenu.vim
929
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
411,
767769
/**/
768770
410,
769771
/**/

0 commit comments

Comments
 (0)