From 4d522bdc6e65bd84e74487611cc24022469e6af3 Mon Sep 17 00:00:00 2001 From: kyouryuukunn Date: Sat, 8 Sep 2018 21:03:49 +0900 Subject: [PATCH 1/3] Fixed a problem about the vim translated to Japanese --- autoload/vebugger/util.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/autoload/vebugger/util.vim b/autoload/vebugger/util.vim index 1c7f33e..82721ec 100644 --- a/autoload/vebugger/util.vim +++ b/autoload/vebugger/util.vim @@ -126,7 +126,14 @@ endfunction function! s:listSigns(filter) abort let l:result = [] - for l:line in split(execute('sign place '.a:filter), '\n') + if v:lang == 'ja' + let $LANG = 'en' + let l:lines = execute('sign place '.a:filter) + let $LANG = 'ja' + else + let l:lines = execute('sign place '.a:filter) + endif + for l:line in split(l:lines, '\n') let l:match = matchlist(l:line, '\C\v^\s+line\=(\d+)\s+id\=(\d+)\s+name\=(.+)$') if !empty(l:match) call add(l:result, { From 17f8dad2daf7a54d24ea5d8706520de1585f472c Mon Sep 17 00:00:00 2001 From: kyouryuukunn Date: Sun, 9 Sep 2018 07:08:05 +0900 Subject: [PATCH 2/3] Allow other languages --- autoload/vebugger/util.vim | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/autoload/vebugger/util.vim b/autoload/vebugger/util.vim index 82721ec..2cde034 100644 --- a/autoload/vebugger/util.vim +++ b/autoload/vebugger/util.vim @@ -126,13 +126,12 @@ endfunction function! s:listSigns(filter) abort let l:result = [] - if v:lang == 'ja' - let $LANG = 'en' - let l:lines = execute('sign place '.a:filter) - let $LANG = 'ja' - else - let l:lines = execute('sign place '.a:filter) - endif + + let l:lang = matchstr(execute('language messages'), '"\zs.*\ze"') + if l:lang !~ 'en' | language messages en_US.utf8 | endif + let l:lines = execute('sign place '.a:filter) + if l:lang !~ 'en' | language messages l:lang | endif + for l:line in split(l:lines, '\n') let l:match = matchlist(l:line, '\C\v^\s+line\=(\d+)\s+id\=(\d+)\s+name\=(.+)$') if !empty(l:match) From 5388d2793838a3ee4b72589e9d2bb8348c1bf504 Mon Sep 17 00:00:00 2001 From: kyouryuukunn Date: Sat, 15 Sep 2018 16:21:09 +0900 Subject: [PATCH 3/3] Extracted to a function. --- autoload/vebugger/util.vim | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/autoload/vebugger/util.vim b/autoload/vebugger/util.vim index 2cde034..d8b5523 100644 --- a/autoload/vebugger/util.vim +++ b/autoload/vebugger/util.vim @@ -124,15 +124,20 @@ function! vebugger#util#listify(stringOrList) endif endfunction -function! s:listSigns(filter) abort - let l:result = [] - +" Return the resul of a:command in English, even if language messages set +" others. +function! vebugger#util#EnglishExecute(command) abort let l:lang = matchstr(execute('language messages'), '"\zs.*\ze"') if l:lang !~ 'en' | language messages en_US.utf8 | endif - let l:lines = execute('sign place '.a:filter) + let l:result = execute(a:command) if l:lang !~ 'en' | language messages l:lang | endif - for l:line in split(l:lines, '\n') + return l:result +endfunction + +function! s:listSigns(filter) abort + let l:result = [] + for l:line in split(vebugger#util#EnglishExecute('sign place '.a:filter), '\n') let l:match = matchlist(l:line, '\C\v^\s+line\=(\d+)\s+id\=(\d+)\s+name\=(.+)$') if !empty(l:match) call add(l:result, {