Debian Codegraph @

doc/source/contribution/documentation/i18n.rst

raw
1 .. -*- rst -*-
2
3 I18N
4 ====
5
6 We only had documentation in Japanese. We start to support
7 I18N documentation by gettext based `Sphinx I18N feature`_.
8 We'll use English as base language and translate
9 English into other languages such as Japanese. We'll put
10 all documentations into doc/source/ and process them by
11 Sphinx.
12
13 .. _Sphinx I18N feature: https://www.sphinx-doc.org/en/master/usage/advanced/intl.html
14
15 But we still use Japanese in doc/source/ for now. We need to
16 translate Japanese documentation in doc/source/ into
17 English. We welcome to you help us by translating
18 documentation.
19
20 Translation flow
21 ----------------
22
23 After doc/source/\*.txt are updated, we can start translation.
24
25 Here is a translation flow:
26
27 1. Install Sphinx, if it is not installed.
28 2. Clone Groonga repository.
29 3. Update ``.edit`` files
30 4. Edit ``.edit`` files
31 5. Update ``.po`` files.
32 6. Generate HTML files.
33 7. Confirm HTML output.
34 8. Repeat 3.-7. until you finish to translate.
35 9. Send your works to us!
36
37 Here are command lines to do the above flow. Following
38 sections describes details.
39
40 ::
41
42 # Please fork https://github.com/groonga/groonga on GitHub
43 % git clone https://github.com/${YOUR_GITHUB_ACCOUNT}/groonga.git
44 % ./autogen.sh
45 % ./configure --enable-document
46 % cd doc/locale/${LANGUAGE}/LC_MESSAGES # ${LANGUAGE} is language code such as 'ja'.
47 % make # *.edit are updated
48 % editor *.edit # translate *.edit # you can use your favorite editor
49 % make # *.po are updated
50 % cd ..
51 % make html
52 % browser html/index.html # confirm translation
53 % git add LC_MESSAGES/*.po
54 % git commit
55 % git push
56
57 How to install Sphinx
58 ---------------------
59
60 See the :doc:`introduction`.
61
62 How to clone Groonga repository
63 -------------------------------
64
65 First, please fork Groonga repository on GitHub. You
66 just access https://github.com/groonga/groonga and press
67 `Fork` button. Now you can clone your Groonga repository::
68
69 % git clone https://github.com/${YOUR_GITHUB_ACCOUNT}/groonga.git
70
71 Then you need to configure your cloned repository::
72
73 % cd groonga
74 % ./autogen.sh
75 % ./configure --enable-document
76
77 The above steps are just needed at the first setup.
78
79 If you have troubles on the above steps, you can use source
80 files available on https://packages.groonga.org/source/groonga/ .
81
82 How to update ``.edit`` files
83 -----------------------------
84
85 You can update ``.edit`` files by running ``make`` on
86 ``doc/locale/${LANGUAGE}/LC_MESSAGES``. (Please replace
87 `${LANGUAGE}` with your language code such as 'ja'.)::
88
89 % cd doc/locale/ja/LC_MESSAGES
90 % make
91
92 How to edit ``.edit``
93 ---------------------
94
95 Both of ``.edit`` files and ``.po`` files are `PO files <https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html>`_.
96 ``.edit`` files are for editing and ``.po`` files are for versioning.
97
98 In order to edit ``.edit`` files, there are some tools to edit.
99 ``.edit`` files are just text, so you can use your favorite editor.
100
101 Here is a list of editors specialized for editing ``.po`` files.
102 You can use these editors to edit ``.edit`` files because they are actually
103 ``.po`` files.
104
105 Emacs's po-mode_
106 It is bundled in gettext.
107
108 Poedit_
109 It is a ``.po`` editor and works on many platform.
110
111 gted
112 It is also a ``.po`` editor and is implemented as Eclipse plugin.
113
114 .. _po-mode: http://www.gnu.org/s/hello/manual/gettext/PO-Mode.html
115 .. _Poedit: http://www.poedit.net/
116 .. _gted: http://www.gted.org/
117
118 How to update ``.po`` files
119 ---------------------------
120
121 After editing ``.edit`` files, you can update ``.po`` files by running ``make`` on
122 ``doc/locale/${LANGUAGE}/LC_MESSAGES``. (Please replace
123 `${LANGUAGE}` with your language code such as 'ja'.)
124
125 .. code-block ::
126
127 % cd doc/locale/ja/LC_MESSAGES
128 % make
129
130 How to generate HTML files
131 --------------------------
132
133 You can generate HTML files with updated ``.po`` files by
134 running `make html` on doc/locale/${LANGUAGE}. (Please
135 substitute `${LANGUAGE}` with your language code such as
136 'ja'.)::
137
138 % cd doc/locale/ja/
139 % make html
140
141 You can also generate HTML files for all languages by
142 running `make html` on doc/locale::
143
144 % cd doc/locale
145 % make html
146
147 .. note::
148
149 .mo files are updated automatically by `make html`. So
150 you don't care about .mo files.
151
152 How to confirm HTML output
153 --------------------------
154
155 HTML files are generated in
156 doc/locale/${LANGUAGE}/html/. (Please substitute
157 `${LANGUAGE}` with your language code such as 'ja'.) You can
158 confirm HTML output by your favorite browser::
159
160 % firefox doc/locale/ja/html/index.html
161
162 How to send your works
163 ----------------------
164
165 We can receive your works via pull request on GitHub or
166 E-mail attachment patch or ``.po`` files themselves.
167
168 How to send pull request
169 ++++++++++++++++++++++++
170
171 Here are command lines to send pull request::
172
173 % git add doc/locale/ja/LC_MESSAGES/*.po
174 % git commit
175 % git push
176
177 Now you can send pull request on GitHub. You just access
178 your repository page on GitHub and press `Pull Request`
179 button.
180
181 .. seealso:: `Help.GitHub - Sending pull requests <http://help.github.com/pull-requests/>`_.
182
183 How to send patch
184 +++++++++++++++++
185
186 Here are command lines to create patch::
187
188 % git add doc/locale/ja/LC_MESSAGES/*.po
189 % git commit
190 % git format-patch origin/main
191
192 You can find 000X-YYY.patch files in the current
193 directory. Please send those files to us!
194
195 .. seealso:: :doc:`/community` describes our contact information.
196
197 How to send ``.po`` files
198 +++++++++++++++++++++++++
199
200 Please archive doc/locale/${LANGUAGE}/LC_MESSAGES/ (Please
201 substitute `${LANGUAGE}` with your language code such as
202 'ja'.) and send it to us! We extract and merge them to the
203 Groonga repository.
204
205 .. seealso:: :doc:`/community` describes our contact information.
206
207 How to add new language
208 -----------------------
209
210 Here are command lines to add new translation language::
211
212 % cd doc/locale
213 % make add LOCALE=${LANGUAGE} # specify your language code such as 'de'.
214
215 Please substitute `${LANGUAGE}` with your language code such
216 as 'ja'.
217
218 .. seealso:: `Codes for the Representation of Names of Languages <http://www.loc.gov/standards/iso639-2/php/English_list.php>`_.