po: only substitute, if value is present in string

This commit is contained in:
Christian Brabandt 2018-11-01 11:14:57 +01:00
parent 6508558c3d
commit fc021cf4e8
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 3 additions and 1 deletions

View File

@ -18,8 +18,10 @@ function! airline#extensions#po#shorten()
let untranslated = ''
let messages = ''
" Shorten [120 translated, 50 fuzzy, 4 untranslated] to [120T/50F/4U]
if b:airline_po_stats =~ 'untranslated\|fuzzy'
if b:airline_po_stats =~ 'fuzzy'
let fuzzy = substitute(b:airline_po_stats, '.*\(\d\+\) fuzzy.*', '\1F', '')
endif
if b:airline_po_stats =~ 'untranslated'
let untranslated = substitute(b:airline_po_stats, '.*\(\d\+\) untranslated.*', '\1U', '')
endif
let messages = substitute(b:airline_po_stats, '\(\d\+\) translated.*', '\1T', '')