Mercurial > vim
annotate src/po/README_mvc.txt @ 36242:b2a5d49fcedb
runtime(comment): consider &tabstop in lines after whitespace indent
Commit: https://github.com/vim/vim/commit/7b27fc49a8c4ce480f759dc33082e6150fb94238
Author: Konfekt <Konfekt@users.noreply.github.com>
Date: Sat Oct 5 16:17:04 2024 +0200
runtime(comment): consider &tabstop in lines after whitespace indent
The count `strlen()` in
```vim
line = printf(indent_start .. substitute(cms, '%s\@!', '%%', 'g'),
strpart(getline(lnum), strlen(indent_start)))
```
is too large if the block of lines to be operated on contains different
whitespace indenting (tab vs. spaces).
Considering using `2gcc` on the first line with 4 spaces as indenting
and on the next line using a single tab character (with &tabstop value
of 8):
Using `strlen(indent_start) = 4` for an initial indent of 4 spaces is
correct for the first line, but wrong for the next line and will
therefore wrongly comment out the tab-indented line (and possibly
deleting some content).
The new check is still too simple because it assumes that as soon as
there's a tab the whole indent is made of tabs; it's a start of entering
the mixed tab and whitespace indent rabbit hole.
fixes: #15797
closes: #15805
Signed-off-by: Konfekt <Konfekt@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 05 Oct 2024 16:30:07 +0200 |
parents | c21bafafb59d |
children |
rev | line source |
---|---|
7 | 1 TRANSLATING VIM MESSAGES |
2 | |
2472
3567e0d56891
Updated version of gettext for use with MVC. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents:
1121
diff
changeset
|
3 This file explains how to create and maintain po files using a number of |
3567e0d56891
Updated version of gettext for use with MVC. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents:
1121
diff
changeset
|
4 GnuWin packages. You will need gettext, libiconv and libexpat. As of |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
5 January 2024 the versions known to work are gettext 0.14.4, libiconv 1.9.2-1 |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
6 and expat 2.5.0. Gettext and libiconv can be found at: |
2472
3567e0d56891
Updated version of gettext for use with MVC. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents:
1121
diff
changeset
|
7 |
3567e0d56891
Updated version of gettext for use with MVC. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents:
1121
diff
changeset
|
8 http://gnuwin32.sourceforge.net/ |
7 | 9 |
2472
3567e0d56891
Updated version of gettext for use with MVC. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents:
1121
diff
changeset
|
10 expat can be found at: |
3567e0d56891
Updated version of gettext for use with MVC. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents:
1121
diff
changeset
|
11 |
3567e0d56891
Updated version of gettext for use with MVC. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents:
1121
diff
changeset
|
12 http://sourceforge.net/projects/expat/ |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
13 or |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
14 https://github.com/libexpat/libexpat |
2472
3567e0d56891
Updated version of gettext for use with MVC. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents:
1121
diff
changeset
|
15 |
3567e0d56891
Updated version of gettext for use with MVC. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents:
1121
diff
changeset
|
16 expat will install into its own directory. You should copy libexpat.dll into |
3567e0d56891
Updated version of gettext for use with MVC. (Mike Williams)
Bram Moolenaar <bram@vim.org>
parents:
1121
diff
changeset
|
17 the bin directory created from the gettext/libiconv packages. |
33823
45c0a5330758
patch 9.0.2127: translation Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
7374
diff
changeset
|
18 Or Michele Locati kindly provides precompiled binaries gettext 0.21 and |
45c0a5330758
patch 9.0.2127: translation Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
7374
diff
changeset
|
19 iconv 1.16 for Windows on his site: |
45c0a5330758
patch 9.0.2127: translation Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
7374
diff
changeset
|
20 |
45c0a5330758
patch 9.0.2127: translation Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
7374
diff
changeset
|
21 https://mlocati.github.io/articles/gettext-iconv-windows.html |
45c0a5330758
patch 9.0.2127: translation Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
7374
diff
changeset
|
22 |
7 | 23 First read the README.txt file in this directory for general remarks on |
24 translating Vim messages. | |
25 | |
26 | |
27 SETUP | |
28 | |
1121 | 29 Set the environment variable LANGUAGE to the language code for the language |
30 you are translating Vim messages to. Language codes are typically two | |
31 characters and you can find a list of them at: | |
7 | 32 |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
33 https://www.loc.gov/standards/iso639-2/php/code_list.php |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
34 https://www.science.co.il/language/Codes.php |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
35 https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes |
7 | 36 |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
37 Another possibility is to use the GnuWin32 port of gettext. This is |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
38 recommended especially if you use already GnuWin32 tools to gunzip, bunzip, |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
39 patch etc. these files. You find the GnuWin32 version of gettext here: |
1121 | 40 |
41 http://gnuwin32.sourceforge.net/packages/gettext.htm | |
42 | |
43 Yet another very strait forward way is to get the sources of gettext from | |
44 | |
45 http://www.gnu.org/software/gettext/gettext.html | |
46 | |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
47 and build your own version of these tools. The documentation states that this |
1121 | 48 should be possible with MSVC4.0, MSVC5.0, MSVC6.0 or MSVC7.0, but you can |
49 build it even successfully with MSVC8.0. | |
50 | |
7 | 51 The LANGUAGE environment variable can be set from the command line, by adding |
52 a line to your autoexec.bat file, or by defining a user variable from the | |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
53 Advanced tab in the System control panel. If the LANGUAGE environment |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
54 variable has not been set in any of the above ways, the value of this variable |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
55 will be set automatically according to the language used in the OS. This |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
56 value will be valid until the "nmake.exe" program terminates. |
7 | 57 |
58 Next, edit Make_mvc.mak so that GETTEXT_PATH points the binary directory of | |
1121 | 59 the installation. |
7 | 60 |
61 | |
62 CREATING A NEW TRANSLATION | |
63 | |
64 When creating a new translation you must add your language code to the | |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
65 Make_all.mak file in the lines defining LANGUAGES and MOFILES, POFILES and |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
66 CHECKFILES. If the encoding of the translation text differs from the default |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
67 UTF-8, add a corresponding entry in MOCONVERTED, specifying the required |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
68 encoding. |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
69 To create the initial .po file for your language you must use the command: |
7 | 70 |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
71 nmake.exe -f Make_mvc.mak first_time |
7 | 72 |
73 Note: You need to be in the po directory when using this makefile. | |
74 | |
75 Once you have your new .po file load it into Vim and source cleanup.vim, this | |
76 will convert untranslated messages to comments. If you have syntax | |
77 highlighting turned on then untranslated messages will stand out more easily. | |
78 | |
79 You will also need to edit the file names in the comments in the .po file. | |
80 You need to remove the absolute directory specification (which has the form | |
33823
45c0a5330758
patch 9.0.2127: translation Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
7374
diff
changeset
|
81 c:\vim91\src\). You can do this in Vim with the following command with the |
1121 | 82 appropriate directory specification for where you have installed the Vim |
7 | 83 source: |
84 | |
33823
45c0a5330758
patch 9.0.2127: translation Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
7374
diff
changeset
|
85 %s/c:\\vim91\\src\\//g |
7 | 86 |
87 | |
88 UPDATING A TRANSLATION | |
89 | |
90 If there are new or changed messages in Vim that need translating, then the | |
91 first thing to do is merge them into the existing translations. This is done | |
92 with the following command: | |
93 | |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
94 nmake.exe -f Make_mvc.mak xx |
7 | 95 |
1121 | 96 where xx is the language code for the language needing translations. The |
7 | 97 original .po file is copied to xx.po.orig. |
98 | |
99 | |
100 DOING THE TRANSLATION | |
101 | |
102 Now that you have a .po file you can do the translations for all messages that | |
103 need it. See README.txt for specific instructions. | |
104 | |
105 Once you have finished translating the messages you should make sure all | |
106 non-translated strings are commented out. This can be done by sourcing | |
107 cleanup.vim once again. | |
108 | |
109 | |
110 CHECKING THE TRANSLATION | |
111 | |
112 Check the translation with the following command: | |
113 | |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
114 nmake.exe -f Make_mvc.mak xx.ck |
7 | 115 |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
116 Correct any errors reported. When there are no more errors, the translation |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
117 is ready to be installed. |
7 | 118 |
119 | |
120 INSTALLING THE TRANSLATION | |
121 | |
122 Install your translation with the following command: | |
123 | |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
124 nmake.exe -f Make_mvc.mak install |
7 | 125 |
126 This will create the xx\LC_MESSAGES directory in runtime\lang if it does not | |
127 already exist. | |
7374
7e367104f6b6
commit https://github.com/vim/vim/commit/013806229a1e15480592f6bc8453130685ec750b
Christian Brabandt <cb@256bit.org>
parents:
2472
diff
changeset
|
128 You can also use the following command to install all languages: |
7e367104f6b6
commit https://github.com/vim/vim/commit/013806229a1e15480592f6bc8453130685ec750b
Christian Brabandt <cb@256bit.org>
parents:
2472
diff
changeset
|
129 |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
130 nmake.exe -f Make_mvc.mak install-all |
7 | 131 |
132 | |
34178
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
133 AFTER ALL OF THESE STEPS |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
134 |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
135 Clean the "po" directory of all temporary and unnecessary files. Execute the |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
136 command: |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
137 |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
138 nmake.exe -f Make_mvc.mak clean |
c5a10c03afb8
patch 9.1.0044: po Makefiles can be improved
Christian Brabandt <cb@256bit.org>
parents:
33823
diff
changeset
|
139 |
35634
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
140 |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
141 TRANSLATION OF VIM THE EDITOR PLUG-INS |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
142 |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
143 Vim supports displaying plugin messages for various native languages. |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
144 Translation is available both for plugins that are supplied as part of the Vim |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
145 editor (e.g. "optwin.vim") and for third-party plugin packages. |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
146 |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
147 To translate the plugins supplied with the Vim editor, you must specify a |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
148 gettext() function call for the strings you want to translate. |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
149 The translation of these strings will be retrieved by gettext() from the MO |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
150 file "vim.mo". |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
151 |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
152 For third-party plugins, it is necessary to specify a one-time call to the |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
153 bindtextdomain() function in scripts containing translation strings and for |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
154 all message strings to add a {package} argument to the gettext() function. For |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
155 more information, see ":help package-translation". |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
156 |
c21bafafb59d
patch 9.1.0559: translation of vim scripts can be improved
Christian Brabandt <cb@256bit.org>
parents:
34178
diff
changeset
|
157 |
7 | 158 vim:tw=78: |