annotate src/po/README.txt @ 11900:39e46ae74c69 v8.0.0830

patch 8.0.0830: translating messages is not ideal commit https://github.com/vim/vim/commit/aaef1bae3cc331e7a7bb9c698e707c90cd4ded15 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Aug 1 17:40:23 2017 +0200 patch 8.0.0830: translating messages is not ideal Problem: Translating messages is not ideal. Solution: Add a remark about obsolete messages. Use msgfmt in the check script. (Christian Brabandt)
author Christian Brabandt <cb@256bit.org>
date Tue, 01 Aug 2017 17:45:04 +0200
parents 49c12c93abf3
children 4f7081eb1e26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 TRANSLATING VIM MESSAGES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 In this directory you will find xx.po files, where "xx" is a language code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 Each file contains the translation of English Vim messages for one language.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 The files are in "po" format, used by the gettext package. Please refer to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 the gettext documentation for more information.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 The GNU gettext library, starting with version 0.10.37, supports converting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 messages from one encoding to another. This requires that it was compiled
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 with HAVE_ICONV. The result is that the messages may be in any encoding
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 supported by iconv and will be automatically converted to the currently used
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 encoding.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 The GNU gettext library, starting with version 0.10.36, uses a new format for
1125
96cd8222a819 updated for version 7.1a
vimboss
parents: 449
diff changeset
15 some encodings. This follows the C99 standard for strings. It means that
96cd8222a819 updated for version 7.1a
vimboss
parents: 449
diff changeset
16 when a multi-byte character includes the 0x5c byte, this is not recognized as
96cd8222a819 updated for version 7.1a
vimboss
parents: 449
diff changeset
17 a backslash. Since this format is incompatible with Solaris, Vim uses the old
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 format. This is done by setting the OLD_PO_FILE_OUTPUT and OLD_PO_FILE_INPUT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 environment variables. When you use the Makefile in this directory that will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 be done for you. This does NOT work with gettext 0.10.36. Don't use it, get
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 0.10.37.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 ON MS-WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 The distributed files are generated on Unix, but this should also be possible
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 on MS-Windows. Download the gettext packages, for example from:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 http://sourceforge.net/projects/gettext
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 You might have to do the commands manually. Example:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
1125
96cd8222a819 updated for version 7.1a
vimboss
parents: 449
diff changeset
33 cd c:\vim\vim71
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 mkdir runtime\lang\ja\LC_MESSAGES
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 msgfmt -o runtime\lang\ja\LC_MESSAGES\vim.mo src\po\ja.po
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 WHEN THERE IS A MISTAKE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 If you find there is a mistake in one of the translations, please report this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 to the maintainer of the translation. His/her E-mail address is in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 comments at the start of the file. You can also see this with the ":messages"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 command in Vim when the translation is being used.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 CREATING A NEW PO FILE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 We will use "xx.po" as an example here, replace "xx" with the name of your
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 language.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 - Edit Makefile to add xx to LANGUAGES and xx.mo to MOFILES.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 - Copy the header of an existing file, e.g., de.po, to xx.po. Do not copy any
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 of the translated messages, delete everything after the "msgstr".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 - The remaining work is like updating, see the next section.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 UPDATING A PO FILE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 If you are the maintainer of a .po file, this is how you update the file. We
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 will use "xx.po" as an example here, replace "xx" with the name of your
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 language.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 (1) Add new and changed messages from the Vim sources:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 make xx
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 This will extract all the strings from Vim and merge them in with the
4992
ceb5f21cda79 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4502
diff changeset
68 existing translations. Requires the GNU gettext utilities.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 Your original xx.po file will be copied to xx.po.orig
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 -- After you do this, you MUST do the next three steps! --
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 (2) Translate
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 See the gettext documentation on how to do this. You can also find
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 examples in the other po files.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 Search the po file for items that require translation:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 /fuzzy\|^msgstr ""\(\n"\)\@!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 Remove the "#, fuzzy" line after adding the translation.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 There is one special message:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 You should include your name and E-mail address instead, for example:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 msgstr "Berichten übersetzt bei: John Doe <john@doe.org>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
11900
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
87 (3) Remove unused messages (optional)
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
88 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
89 Such messages start with "#~".
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
90
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
91 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
92
39e46ae74c69 patch 8.0.0830: translating messages is not ideal
Christian Brabandt <cb@256bit.org>
parents: 11659
diff changeset
93 (4) Clean up
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 This is very important to make sure the translation works on all systems.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 Comment-out all non-translated strings. There are two types:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 - items marked with "#, fuzzy"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 - items with an empty msgstr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 You can do this with the cleanup.vim script:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 :source cleanup.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 Background: on Solaris an empty msgstr results in an empty message; GNU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 gettext ignores empty strings and items marked with "#, fuzzy".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104
449
3709cf52b9b5 updated for version 7.0119
vimboss
parents: 440
diff changeset
105 This also removes the line numbers from the file, so that patches are not
3709cf52b9b5 updated for version 7.0119
vimboss
parents: 440
diff changeset
106 messed up by changes in line numbers and show the actual changes in the
3709cf52b9b5 updated for version 7.0119
vimboss
parents: 440
diff changeset
107 text.
3709cf52b9b5 updated for version 7.0119
vimboss
parents: 440
diff changeset
108
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 (4) Check:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110
11659
49c12c93abf3 Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents: 4992
diff changeset
111 While editing the .po file:
49c12c93abf3 Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents: 4992
diff changeset
112 :source check.vim
49c12c93abf3 Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents: 4992
diff changeset
113
49c12c93abf3 Updated runtime files and translations.
Christian Brabandt <cb@256bit.org>
parents: 4992
diff changeset
114 From the command line:
440
eb531146be0e updated for version 7.0114
vimboss
parents: 7
diff changeset
115 vim -S check.vim xx.po
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 make xx.mo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 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
119
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
120
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
121 USING GETTEXT WITHOUT ICONV
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
122
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
123 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
124 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
125 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
126 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
127
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
128 (1) Convert the file encoding:
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
129
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
130 mv ja.po ja.po.orig
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
131 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
132
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
133 (2) Rewrite charset declaration in the file:
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
134
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
135 Open ja.po find this line:
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
136 "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
137 You should change "charset" like this:
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
138 "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
139
605c9ce57ec3 Updated runtime files, language files and translations.
Bram Moolenaar <bram@vim.org>
parents: 1125
diff changeset
140 There are examples in the Makefile for the conversions already supported.