Skip to content

Commit d7a13bf

Browse files
Update the instruction to translators to better match reality
The po4a details are handled by the build system now, and we use Weblate for translation, so no need to describe how to call po4a manually.
1 parent a5153f7 commit d7a13bf

1 file changed

Lines changed: 31 additions & 97 deletions

File tree

docs/README.adoc

Lines changed: 31 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -141,116 +141,50 @@ the Linux CNC community.
141141
- Set line thickness to 0.50mm
142142
- Export the image as 480 x 480 Resolution Auto .png
143143

144-
== Dealing with translations
145-
146-
Translation of our documentation is in transition at the moment.
147-
148-
We have some old-style translations that are separate asciidoc .adoc
149-
files checked into git. These started out as copies of the english
150-
master docs at some point, and diverged from there over time. This
151-
turned out not to be an ideal situation.
152-
153-
We are experimenting with a new system using
154-
https://po4a.alioth.debian.org/[po4a]. With po4a, the English text
155-
is the master document, and each paragraph is translated using
156-
gettext, just like the strings in our software.
157-
144+
== Provide translated documentation
145+
146+
The complete set of documents are translated using gettext PO files
147+
using the https://po4a.alioth.debian.org/[po4a]po4a system. If you
148+
want to contribute a translation, please use the
149+
link:https://hosted.weblate.org/projects/linuxcnc/[web based
150+
translation editor Weblate]. Registered Weblate users can translate
151+
directly, while non-registered users can propose translations for
152+
others to review. Translations are done paragraph by paragraph. If
153+
there is no existing translation of the documentation to your
154+
language, you can add it in the Weblate interface.
155+
156+
With po4a, the English text is the master document, and each paragraph
157+
is translated using gettext, just like the strings in our software.
158158
Some documentation of po4a is available in the
159159
https://po4a.alioth.debian.org/man/man7/po4a.7.php[po4a(7)] manpage.
160-
161-
We are using po4a version 0.62, available in Debian Bullseye.
162-
163-
=== Transfer a translated file to po4a
164-
165-
If there is a pre-existing translation of the file to your language,
166-
create a .po translation database seeded by the old translation.
167-
168-
If the english file is called "file.adoc" then the old pre-existing
169-
translated file is probably called "file_fr.adoc" (for the french
170-
translation, as an example), and the translation database should be
171-
called "file.fr.po". Creating PO file from adoc can be done by running
172-
this command:
173-
174-
```
175-
(f=getting-linuxcnc; l=cn; po4a-gettextize \
176-
> --format asciidoc \
177-
> -m ${f}.adoc -M utf8 \
178-
> -l ${f}_${l}.adoc -L utf8 \
179-
> -p ${f}.${l}.po)
180-
```
181-
182-
Similarly, for translated manual pages:
183-
184-
```
185-
(f=elbpcom.1; l=es; po4a-gettextize \
186-
> --format asciidoc \
187-
> -m man/man1/${f} -M utf8 \
188-
> -l man/${l}/man1/${f} -L utf8 \
189-
-p ${f}.${l}.po)
190-
```
191-
192-
To append the extracted translations to the combined PO file, do
193-
something like this:
194-
195-
```
196-
msgcat --use-first po/documentation.es.po \
197-
> elbpcom.1.es.po \
198-
> po/documentation.es.po
199-
```
200-
201-
=== To create a new po4a translation of an untranslated file
202-
203-
If there is no pre-existing translation of the file to your language,
204-
create an empty .po file to start with. If the english file is called
205-
"file.adoc" then the translation database should be called "file.se.po"
206-
(for the swedish translation, as an example). It is created by running
207-
this command:
208-
209-
```
210-
po4a-gettextize --format text \
211-
> -m file.adoc -M utf8 \
212-
> -p file.se.po
213-
```
214-
215-
=== Improving the translation of a po4a-managed file
216-
217-
Translations are done paragraph by paragraph.
218-
219-
You can use a GUI tool like Poedit or Gtranslator or others, or you can
220-
(carefully!) edit the .po file by hand.
221-
222-
The next time the translated document gets rebuilt, the updated
223-
translations will be used.
160+
As the po4a support for asciidoc has been rapidly improving since
161+
LinuxCNC started using it, based on bug reports from the LinuxCNC
162+
community, a very recent version of po4a is needed. At the moment, at
163+
least version 0.66 is needed, available in Debian Bookworm.
224164

225165
=== When the master document (english) changes
226166

227-
When the master document (english) file has changed, use the
228-
po4a-updatepo to update the .po files:
167+
When the master document (english) file has changed, the POT file with
168+
the set of translatable strings need to be updated, and the updates
169+
need to be propagated into the PO files for each translation. This
170+
can be done using the build system:
229171

230172
```
231-
po4a-updatepo -f text \
232-
> -m file.adoc \
233-
> -p file.fr.po
173+
make -C src translateddocs
234174
```
235175

236-
=== How to add a new translation language
176+
Once this is completed, the files in docs/po/ will be updated, and
177+
should be commited into git and pulled into Weblate.
237178

238-
Determine the ISO 639-1 code for your new language (for example:
239-
English -> "en", Vietnamese -> "vi", etc). This becomes the "NEWLANG"
240-
variable in the examples below. There is a list of codes here:
241-
<https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes>
179+
=== How to add a new translation language
242180

243-
Add the asciidoc source files containing your new translation. Usually
244-
that means copying the language files from one of the existing
245-
languages, probably English since that's usually the most up-to-date.
181+
Once a new PO files for a fresh translation is added via Weblate, and
182+
the translation level raise to a sensible level (for example not 0%),
183+
build rules need to be added to use the generated translations to
184+
build HTML and PDF editions of the translation.
246185

247-
Copy the docs/po/documentation.pot to docs/po/documentation.$LANG.po.
248-
where $LANG is a two letter language code according to ISO 639-1, or
249-
three letter code according to ISO 639-2 if no two letter code exist.
250186
Add the new language code to the proper place in docs/po4a.conf.
251-
252-
Add the new files in the correct place in `docs/src/Submakefile` to
253-
ensure they will be built.
187+
Update build rules for the new language in `docs/src/Submakefile`.
254188

255189
Edit debian/control.in to add the new linuxcnc-doc-$NEWLANG package.
256190
Add the new doc package to the "or" list of the "Recommends" line of the

0 commit comments

Comments
 (0)