Mercurial > vim
annotate src/po/README.txt @ 21350:e5e32c9f711f
Added tag v8.2.1225 for changeset 8488d9cc3ccd623ea3a5968675d37d0e13967d5c
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 16 Jul 2020 22:30:05 +0200 |
parents | dc766e1b0c95 |
children | 52e970719f4b |
rev | line source |
---|---|
7 | 1 TRANSLATING VIM MESSAGES |
2 | |
3 In this directory you will find xx.po files, where "xx" is a language code. | |
4 Each file contains the translation of English Vim messages for one language. | |
5 The files are in "po" format, used by the gettext package. Please refer to | |
6 the gettext documentation for more information. | |
7 | |
8 The GNU gettext library, starting with version 0.10.37, supports converting | |
9 messages from one encoding to another. This requires that it was compiled | |
10 with HAVE_ICONV. The result is that the messages may be in any encoding | |
11 supported by iconv and will be automatically converted to the currently used | |
12 encoding. | |
13 | |
14 The GNU gettext library, starting with version 0.10.36, uses a new format for | |
1125 | 15 some encodings. This follows the C99 standard for strings. It means that |
16 when a multi-byte character includes the 0x5c byte, this is not recognized as | |
17 a backslash. Since this format is incompatible with Solaris, Vim uses the old | |
7 | 18 format. This is done by setting the OLD_PO_FILE_OUTPUT and OLD_PO_FILE_INPUT |
19 environment variables. When you use the Makefile in this directory that will | |
20 be done for you. This does NOT work with gettext 0.10.36. Don't use it, get | |
21 0.10.37. | |
22 | |
23 | |
24 ON MS-WINDOWS | |
25 | |
26 The distributed files are generated on Unix, but this should also be possible | |
27 on MS-Windows. Download the gettext packages, for example from: | |
28 | |
29 http://sourceforge.net/projects/gettext | |
30 | |
31 You might have to do the commands manually. Example: | |
32 | |
16023 | 33 cd c:\vim\vim81 |
7 | 34 mkdir runtime\lang\ja\LC_MESSAGES |
35 msgfmt -o runtime\lang\ja\LC_MESSAGES\vim.mo src\po\ja.po | |
36 | |
37 | |
38 WHEN THERE IS A MISTAKE | |
39 | |
40 If you find there is a mistake in one of the translations, please report this | |
41 to the maintainer of the translation. His/her E-mail address is in the | |
42 comments at the start of the file. You can also see this with the ":messages" | |
43 command in Vim when the translation is being used. | |
44 | |
45 | |
46 CREATING A NEW PO FILE | |
47 | |
48 We will use "xx.po" as an example here, replace "xx" with the name of your | |
49 language. | |
50 | |
51 - Edit Makefile to add xx to LANGUAGES and xx.mo to MOFILES. | |
14123 | 52 - If you haven't done so already, run ./configure in the top vim directory |
53 (i.e. go up two directories) and then come back here afterwards. | |
54 - Execute these commands: | |
55 % make vim.pot | |
56 % msginit -l xx | |
57 % rm vim.pot | |
58 The first command will generate a vim.pot file which is used by msginit to | |
59 generate a correct xx.po file. After that vim.pot is not needed. | |
7 | 60 - The remaining work is like updating, see the next section. |
61 | |
62 | |
63 UPDATING A PO FILE | |
64 | |
65 If you are the maintainer of a .po file, this is how you update the file. We | |
66 will use "xx.po" as an example here, replace "xx" with the name of your | |
67 language. | |
68 | |
69 (1) Add new and changed messages from the Vim sources: | |
70 | |
71 make xx | |
72 | |
73 This will extract all the strings from Vim and merge them in with the | |
4992 | 74 existing translations. Requires the GNU gettext utilities. |
7 | 75 Your original xx.po file will be copied to xx.po.orig |
76 | |
77 -- After you do this, you MUST do the next three steps! -- | |
78 | |
79 (2) Translate | |
80 See the gettext documentation on how to do this. You can also find | |
81 examples in the other po files. | |
82 Search the po file for items that require translation: | |
83 | |
84 /fuzzy\|^msgstr ""\(\n"\)\@! | |
85 | |
86 Remove the "#, fuzzy" line after adding the translation. | |
87 | |
88 There is one special message: | |
89 msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>" | |
90 You should include your name and E-mail address instead, for example: | |
91 msgstr "Berichten übersetzt bei: John Doe <john@doe.org>" | |
92 | |
11900
39e46ae74c69
patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
93 (3) Remove unused messages (optional) |
39e46ae74c69
patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
94 Remove messages that have been marked as obsolete. |
39e46ae74c69
patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
95 Such messages start with "#~". |
39e46ae74c69
patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
96 |
39e46ae74c69
patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
97 The cleanup script will also do that (see next step). |
39e46ae74c69
patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
98 |
39e46ae74c69
patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents:
11659
diff
changeset
|
99 (4) Clean up |
7 | 100 This is very important to make sure the translation works on all systems. |
101 Comment-out all non-translated strings. There are two types: | |
102 - items marked with "#, fuzzy" | |
103 - items with an empty msgstr | |
104 You can do this with the cleanup.vim script: | |
105 | |
106 :source cleanup.vim | |
107 | |
108 Background: on Solaris an empty msgstr results in an empty message; GNU | |
109 gettext ignores empty strings and items marked with "#, fuzzy". | |
110 | |
449 | 111 This also removes the line numbers from the file, so that patches are not |
112 messed up by changes in line numbers and show the actual changes in the | |
113 text. | |
114 | |
11914 | 115 (5) Check: |
7 | 116 |
11659
49c12c93abf3
Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents:
4992
diff
changeset
|
117 While editing the .po file: |
49c12c93abf3
Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents:
4992
diff
changeset
|
118 :source check.vim |
49c12c93abf3
Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents:
4992
diff
changeset
|
119 |
49c12c93abf3
Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents:
4992
diff
changeset
|
120 From the command line: |
440 | 121 vim -S check.vim xx.po |
7 | 122 make xx.mo |
123 | |
124 Look out for syntax errors and fix them. | |
4502
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
125 |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
126 |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
127 USING GETTEXT WITHOUT ICONV |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
128 |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
129 When using gettext which doesn't support iconv, the encoding of the .mo file |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
130 must match your active encoding. For that you must convert and change |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
131 encoding of *.po file in advance of generating the *.mo file. For example, to |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
132 convert ja.po to EUC-JP (supposed as your system encoding): |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
133 |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
134 (1) Convert the file encoding: |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
135 |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
136 mv ja.po ja.po.orig |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
137 iconv -f utf-8 -t euc-jp ja.po.orig > ja.po |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
138 |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
139 (2) Rewrite charset declaration in the file: |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
140 |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
141 Open ja.po find this line: |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
142 "Content-Type: text/plain; charset=utf-8\n" |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
143 You should change "charset" like this: |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
144 "Content-Type: text/plain; charset=euc-jp\n" |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
145 |
605c9ce57ec3
Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents:
1125
diff
changeset
|
146 There are examples in the Makefile for the conversions already supported. |