1Locale::Po4a::Man(3)  User Contributed Perl Documentation Locale::Po4a::Man(3)
2
3
4

NAME

6       Locale::Po4a::Man - convert manual pages from/to PO files
7

DESCRIPTION

9       The po4a (PO for anything) project goal is to ease translations (and
10       more interestingly, the maintenance of translations) using gettext
11       tools on areas where they were not expected like documentation.
12
13       Locale::Po4a::Man is a module to help the translation of documentation
14       in the nroff format (the language of manual pages) into other [human]
15       languages.
16

TRANSLATING WITH PO4A::MAN

18       This module tries pretty hard to make translator's life easier. For
19       that, the text presented to translators isn't a verbatim copy of the
20       text found in the man page. Indeed, the cruder parts of the nroff
21       format are hidden, so that translators can't mess up with them.
22
23   Text wrapping
24       Unindented paragraphs are automatically rewrapped for the translator.
25       This can lead to some minor difference in the generated output, since
26       the rewrapping rules used by groff aren't very clear. For example, two
27       spaces after a parenthesis are sometimes preserved.
28
29       Anyway, the difference will only be about the position of the extra
30       spaces in wrapped paragraph, and I think it's worth.
31
32   Font specification
33       The first change is about font change specifications.  In nroff, there
34       are several ways to specify if a given word should be written in small,
35       bold or italics. In the text to translate, there is only one way,
36       borrowed from the POD (Perl online documentation) format:
37
38       I<text> -- italic text
39           equivalent to \fItext\fP or ".I text"
40
41       B<text> -- bold text
42           equivalent to \fBtext\fP or ".B text"
43
44       R<text> -- roman text
45           equivalent to \fRtext\fP
46
47       CW<text> -- constant width text
48           equivalent to \f(CWtext\fP or ".CW text"
49
50       Remark: The CW face is not available for all groff devices. It is not
51       recommended to use it. It is provided for your convenience.
52
53   Automatic characters transliteration
54       Po4a automatically transliterate some characters to ease the
55       translation or the review of the translation.  Here is the list of the
56       transliterations:
57
58       hyphens
59           Hyphens (-) and minus signs (\-) in man pages are all
60           transliterated as simple dashes (-) in the PO file.  Then all dash
61           are transliterated into roff minus signs (\-) when the translation
62           is inserted into the output document.
63
64           Translators can force an hyphen by using the roff glyph '\[hy]' in
65           their translations.
66
67       non-breaking spaces
68           Translators can use non-breaking spaces in their translations.
69           These non-breaking spaces (0xA0 in latin1) will be transliterated
70           into a roff non-breaking space ('\ ').
71
72       quotes transliterations
73           `` and '' are respectively tranliterated into \*(lq and \*(rq.
74
75           To avoid these transliterations, translators can insert a zero
76           width roff character (i.e., using `\&` or '\&' respectively).
77
78   Putting '<' and '>' in translations
79       Since these chars are used to delimit parts under font modification,
80       you can't use them verbatim. Use E<lt> and E<gt> instead (as in POD,
81       one more time).
82

OPTIONS ACCEPTED BY THIS MODULE

84       These are this module's particular options:
85
86       debug
87           Activate debugging for some internal mechanisms of this module.
88           Use the source to see which parts can be debugged.
89
90       verbose
91           Increase verbosity.
92
93       groff_code
94           This option permits to change the behavior of the module when it
95           encounter a .de, .ie or .if section. It can take the following
96           values:
97
98           fail
99               This is the default value.  The module will fail when a .de,
100               .ie or .if section is encountered.
101
102           verbatim
103               Indicates that the .de, .ie or .if sections must be copied as
104               is from the original to the translated document.
105
106           translate
107               Indicates that the .de, .ie or .if sections will be proposed
108               for the translation.  You should only use this option if a
109               translatable string is contained in one of these section.
110               Otherwise, verbatim should be preferred.
111
112       generated
113           This option specifies that the file was generated, and that po4a
114           should not try to detect if the man pages was generated from
115           another format.  This permits to use po4a on generated man pages.
116           This option does not take any argument.
117
118       mdoc
119           This option is only useful for mdoc pages.
120
121           It selects a stricter support of the mdoc format by telling po4a
122           not to translate the 'NAME' section.  mdoc pages whose 'NAME'
123           section is translated won't generate any header of footer.
124
125           According to the groff_mdoc page, the NAME, SYNOPSIS and
126           DESCRIPTION sections are mandatory.  There are no known issues with
127           translated SYNOPSIS or DESCRIPTION section, but you can also
128           specify these sections this way:
129            -o mdoc=NAME,SYNOPSIS,DESCRIPTION
130
131           This mdoc issue can also be solved with an addendum like this one:
132            PO4A-HEADER:mode=before;position=^.Dd
133            .TH DOCUMENT_TITLE 1 "Month day, year" OS "Section Name"
134
135       The following options permit to specify the behavior of a new macro
136       (defined with a .de request), or of a macro not supported by po4a.
137       They take in argument a coma separated list of macros.  For example:
138
139        -o noarg=FO,OB,AR -o translate_joined=BA,ZQ,UX
140
141       Note: if a macro is not supported by po4a and if you consider that it
142       is a standard roff macro, you should submit it to the po4a development
143       team.
144
145       untranslated
146           untranslated indicates that this macro (at its arguments) don't
147           have to be translated.
148
149       noarg
150           noarg is like untranslated, except that po4a will verify that no
151           argument is added to this macro.
152
153       translate_joined
154           translate_joined indicates that po4a must propose to translate the
155           arguments of the macro.
156
157       translate_each
158           With translate_each, the arguments will also be proposed for the
159           translation, except that each one will be translated separately.
160
161       no_wrap
162           This option takes in argument a list of coma-separated couples
163           begin:end, where begin and end are commands that delimit the begin
164           and end of a section that should not be rewrapped.
165
166           Note: no test is done to ensure that an end command matches its
167           begin command; any ending command stop the no_wrap mode.  If you
168           have a begin (respectively end) macro that has no end (respectively
169           begin), you can specify an existing end (like fi) or begin (like
170           nf) as a counterpart.  These macros (and their arguments) wont be
171           translated.
172
173       inline
174           This option specifies a list of coma-separated macros that must not
175           split the current paragraph. The string to translate will then
176           contain foo <.bar baz qux> quux, where bar is the command that
177           should be inlined, and baz qux its arguments.
178
179       unknown_macros
180           This option indicates how po4a should behave when an unknown macro
181           is found.  By default, po4a fails with a warning.  It can take the
182           following values: failed (the default value), untranslated, noarg,
183           translate_joined, translate_each.
184

AUTHORING MAN PAGES COMPLIANT WITH PO4A::MAN

186       This module is still very limited, and will always be, because it's not
187       a real nroff interpreter. It would be possible to do a real nroff
188       interpreter, to allow authors to use all the existing macros, or even
189       to define new ones in their pages, but we didn't want to. It would be
190       too difficult, and we thought it wasn't necessary. We do think that if
191       manpages' authors want to see their productions translated, they may
192       have to adapt to ease the work of translators.
193
194       So, the man parser implemented in po4a have some known limitations we
195       are not really inclined to correct, and which will constitute some
196       pitfalls you'll have to avoid if you want to see translators taking
197       care of your documentation.
198
199   Don't program in nroff
200       nroff is a complete programming language, with macro definition,
201       conditionals and so on. Since this parser isn't a fully featured nroff
202       interpreter, it will fail on pages using these facilities (There are
203       about 200 such pages on my box).
204
205   Use the plain macro set
206       There are still some macros which are not supported by po4a::man. This
207       is only because I failed to find any documentation about them. Here is
208       the list of unsupported macros used on my box. Note that this list
209       isn't exhaustive since the program fails on the first encountered
210       unsupported macro. If you have any information about some of these
211       macros, I'll happily add support for them. Because of these macros,
212       about 250 pages on my box are inaccessible to po4a::man.
213
214        ..               ."              .AT             .b              .bank
215        .BE              ..br            .Bu             .BUGS           .BY
216        .ce              .dbmmanage      .do                             .En
217        .EP              .EX             .Fi             .hw             .i
218        .Id              .l              .LO             .mf
219        .N               .na             .NF             .nh             .nl
220        .Nm              .ns             .NXR            .OPTIONS        .PB
221        .pp              .PR             .PRE            .PU             .REq
222        .RH              .rn             .S<             .sh             .SI
223        .splitfont       .Sx             .T              .TF             .The
224        .TT              .UC             .ul             .Vb             .zZ
225
226   Hiding text to po4a
227       Sometimes, the author knows that some parts are not translatable, and
228       should not be extracted by po4a. For example, an option may accept an
229       other argument, and other may also appear as the last item of a list.
230       In the first case, other should be not be translatable. And in the
231       second case, other should be translated.
232
233       In such case, the author can avoid po4a to extract some strings, using
234       some special groff constructs:
235
236        .if !'po4a'hide' .B other
237
238       (this will require the -o groff_code=verbatim option)
239
240       A new macro can also be defined to automate this:
241        .de IR_untranslated
242        .    IR \\$@
243        ..
244
245        .IR_untranslated \-q ", " \-\-quiet
246
247       (this will require the options -o groff_code=verbatim and -o
248       untranslated=IR_untranslated; with this construct, the .if !'po4a'hide'
249       conditional is not strictly needed since po4a will not parse the
250       internal of the macro definition)
251
252       or using an alias:
253        .als IR_untranslated IR
254
255        .IR_untranslated \-q ", " \-\-quiet
256
257       (this will require the -o untranslated=als,IR_untranslated option)
258
259   Conclusion
260       To summarise this section, keep simple, and don't try to be clever
261       while authoring your man pages. A lot of things are possible in nroff,
262       and not supported by this parser. For example, don't try to mess with
263       \c to interrupt the text processing (like 40 pages on my box do). Or,
264       be sure to put the macro arguments on the same line that the macro
265       itself. I know that it's valid in nroff, but would complicate too much
266       the parser to be handled.
267
268       Of course, another possibility is to use another format, more
269       translator friendly (like POD using po4a::pod, or one of the XML
270       familly like SGML), but thanks to po4a::man it isn't needed anymore.
271       That being said, if the source format of your documentation is POD, or
272       XML, it may be clever to translate the source format and not this
273       generated one. In most cases, po4a::man will detect generated pages and
274       issue a warning. It will even refuse to process POD generated pages,
275       because those pages are perfectly handled by po4a::pod, and because
276       their nroff counterpart defines a lot of new macros I didn't want to
277       write support for. On my box, 1432 of the 4323 pages are generated from
278       POD and will be ignored by po4a::man.
279
280       In most cases, po4a::man will detect the problem and refuse to process
281       the page, issuing an adapted message. In some rare cases, the program
282       will complete without warning, but the output will be wrong. Such cases
283       are called "bugs" ;) If you encounter such case, be sure to report
284       this, along with a fix when possible...
285

STATUS OF THIS MODULE

287       This module can be used for most of the existing man pages.
288
289       Some tests are regularly run on Linux boxes:
290
291       ·   one third of the pages are refused because they were generated from
292           another format supported by po4a (e.g. POD or SGML).
293
294       ·   10% of the remaining pages are rejected with an error (e.g. a groff
295           macro is not supported).
296
297       ·   Then, less than 1% of the pages are accepted silently by po4a, but
298           with significant issues (i.e. missing words, or new words inserted)
299
300       ·   The other pages are usually handled without differences more
301           important than spacing differences or line rewrapped (font issues
302           in less than 10% of the processed pages).
303

SEE ALSO

305       po4a(7), Locale::Po4a::TransTractor(3pm), Locale::Po4a::Pod(3pm).
306

AUTHORS

308        Denis Barbier <barbier@linuxfr.org>
309        Nicolas Francois <nicolas.francois@centraliens.net>
310        Martin Quinson (mquinson#debian.org)
311
313       Copyright 2002-2008 by SPI, inc.
314
315       This program is free software; you may redistribute it and/or modify it
316       under the terms of GPL (see the COPYING file).
317
318
319
320perl v5.12.2                      2010-12-01              Locale::Po4a::Man(3)
Impressum