From 5568267ccb94924b9dcf7bfa5d52da0f16d161e4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 27 Oct 2022 18:08:06 +0800 Subject: vim-patch:8.2.1544: cannot translate messages in a Vim script Problem: Cannot translate messages in a Vim script. Solution: Add gettext(). Try it out for a few messages in the options window. https://github.com/vim/vim/commit/0b39c3fd4c5d1c8ebd2efa85fced7df5e17efd3b Co-authored-by: Bram Moolenaar --- runtime/doc/builtin.txt | 14 ++++++++++++++ runtime/doc/usr_41.txt | 1 + 2 files changed, 15 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 2c00f755be..8c9c14ffde 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -220,6 +220,7 @@ gettabvar({nr}, {varname} [, {def}]) gettabwinvar({tabnr}, {winnr}, {name} [, {def}]) any {name} in {winnr} in tab page {tabnr} gettagstack([{nr}]) Dict get the tag stack of window {nr} +gettext({text}) String lookup translation of {text} getwininfo([{winid}]) List list of info about each window getwinpos([{timeout}]) List X and Y coord in pixels of the Vim window getwinposx() Number X coord in pixels of Vim window @@ -3584,6 +3585,19 @@ gettagstack([{winnr}]) *gettagstack()* Can also be used as a |method|: > GetWinnr()->gettagstack() + +gettext({text}) *gettext()* + Translate {text} if possible. + This is mainly for use in the distributed Vim scripts. When + generating message translations the {text} is extracted by + xgettext, the translator can add the translated message in the + .po file and Vim will lookup the translation when gettext() is + called. + For {text} double quoted strings are preferred, because + xgettext does not understand escaping in single quoted + strings. + + getwininfo([{winid}]) *getwininfo()* Returns information about windows as a |List| with Dictionaries. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index d2db967c97..6d139643d6 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -639,6 +639,7 @@ String manipulation: *string-functions* execute() execute an Ex command and get the output win_execute() like execute() but in a specified window trim() trim characters from a string + gettext() lookup message translation List manipulation: *list-functions* get() get an item without error for wrong index -- cgit From bbbcd5393dc1ad02effc87d55665412ffaa19cc8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 27 Oct 2022 22:07:30 +0800 Subject: vim-patch:8.2.1585: messages in globals.h not translated Problem: Messages in globals.h not translated, xgettext on MS-Windows not fully supported. Solution: Add globals.h to list of input files. Update MS-Windows makefiles to improve message translations. (Ken Takata, closes vim/vim#6858) https://github.com/vim/vim/commit/fa57335e532e505ce9229ddb2354a593fb057561 Also update gettext() docs to match latest Vim. --- runtime/doc/builtin.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 8c9c14ffde..cf12ec7568 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -3587,7 +3587,7 @@ gettagstack([{winnr}]) *gettagstack()* gettext({text}) *gettext()* - Translate {text} if possible. + Translate String {text} if possible. This is mainly for use in the distributed Vim scripts. When generating message translations the {text} is extracted by xgettext, the translator can add the translated message in the -- cgit