.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "PO4A 1p" .TH PO4A 1p "2020-08-19" "Po4a Tools" "Po4a Tools" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" po4a \- update both the PO files and translated documents in one shot .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBpo4a\fR [\fIoptions\fR] \fIconfig_file\fR .SH "DESCRIPTION" .IX Header "DESCRIPTION" po4a (\s-1PO\s0 for anything) eases the maintenance of documentation translation using the classical gettext tools. The main feature of po4a is that it decouples the translation of content from its document structure. Please refer to the page \fBpo4a\fR\|(7) for a gentle introduction to this project. .PP When you run the \fBpo4a\fR program for the first time, with only a configuration file and the documents to translate (called master documents), it produces a \s-1POT\s0 file (also called translation template) that contains all of the translatable strings in the document in a form that eases the work of translators. .PP Those \s-1POT\s0 files can either be translated with a specific editor such as the \fB\s-1GNOME\s0 Translation Editor\fR, \s-1KDE\s0's \fBLokalize\fR or \fBpoedit\fR, or they can be integrated in an online localization platform such as \&\fBweblate\fR or \fBpootle\fR. The translation result is a set of \s-1PO\s0 files, one per language. .PP When you run the \fBpo4a\fR program with both the master documents and the \s-1PO\s0 files, it produces the translated documents by injecting the content's translation (found in the \s-1PO\s0 files) into the structure of the original master document. .PP If the master documents changed in the meanwhile, po4a will update the \s-1PO\s0 and \s-1POT\s0 files accordingly, so that the translators can easily detect the modifications and update their work. Depending on your settings, po4a will discard the partially translated documents, or produce a document mixing English (for the new or modified paragraphs) and the target language (for paragraphs where translation is already in the \s-1PO\s0 file). .PP By default, the translated documents are produced when at least 80% of their content is translated (see the \fI\-\-keep\fR option below). Discarding translations as soon as they are not 100% may be discouraging for the translators, while showing \*(L"translations\*(R" that are too incomplete may be troubling for the end users. .SS "Graphical overview" .IX Subsection "Graphical overview" .Vb 11 \& master documents \-\-\-+\-\-\-\->\-\-\-\-\-\-\-\->\-\-\-\-\-\-\-\-\-+ \& (doc authoring) | | \& V (po4a executions) >\-\-\-\-\-+\-\-> translations \& | | | \& existing PO files \-\->\-\-> updated PO files >\-+ | \& ^ | | \& | V | \& +\-\-\-\-\-\-\-\-\-\-<\-\-\-\-\-\-\-\-\-<\-\-\-\-\-\-\-+ ^ \& (manual translation process) | \& | \& addendum \-\->\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ .Ve .PP The master documents are authored by the documentation writers. Any changes are automatically reflected by po4a in the \s-1PO\s0 files, that are then updated by the translators. All changes to the \s-1PO\s0 files (either manual or by po4a) are automatically reflected in translated documents. You can mimic this behavior using the \fBpo4a\-updatepo\fR\|(1) and \fBpo4a\-translate\fR\|(1) scripts in makefiles, but this quickly becomes bothersome and repetitive (see \fBpo4a\fR\|(7)). It is highly recommended to use the \fBpo4a\fR program in your build process. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-k\fR, \fB\-\-keep\fR" 4 .IX Item "-k, --keep" Minimal threshold for translation percentage to keep (i.e. write) the resulting file (default: 80). I.e. by default, files have to be translated at least at 80% to be written on disk. .IP "\fB\-h\fR, \fB\-\-help\fR" 4 .IX Item "-h, --help" Show a short help message. .IP "\fB\-M\fR, \fB\-\-master\-charset\fR" 4 .IX Item "-M, --master-charset" Charset of the files containing the documents to translate. Note that all master documents must use the same charset. .IP "\fB\-L\fR, \fB\-\-localized\-charset\fR" 4 .IX Item "-L, --localized-charset" Charset of the files containing the localized documents. Note that all translated documents will use the same charset. .IP "\fB\-A\fR, \fB\-\-addendum\-charset\fR" 4 .IX Item "-A, --addendum-charset" Charset of the addenda. Note that all the addenda should be in the same charset. .IP "\fB\-V\fR, \fB\-\-version\fR" 4 .IX Item "-V, --version" Display the version of the script and exit. .IP "\fB\-v\fR, \fB\-\-verbose\fR" 4 .IX Item "-v, --verbose" Increase the verbosity of the program. .IP "\fB\-q\fR, \fB\-\-quiet\fR" 4 .IX Item "-q, --quiet" Decrease the verbosity of the program. .IP "\fB\-d\fR, \fB\-\-debug\fR" 4 .IX Item "-d, --debug" Output some debugging information. .IP "\fB\-o\fR, \fB\-\-option\fR" 4 .IX Item "-o, --option" Extra option(s) to pass to the format plugin. See the documentation of each plugin for more information about the valid options and their meanings. For example, you could pass '\-o tablecells' to the AsciiDoc parser, while the text parser would accept '\-o tabs=split'. .IP "\fB\-f\fR, \fB\-\-force\fR" 4 .IX Item "-f, --force" Always generate the \s-1POT\s0 and \s-1PO\s0 files, even if \fBpo4a\fR considers it is not necessary. .Sp The default behavior (when \fB\-\-force\fR is not specified) is the following: .RS 4 .Sp .RS 4 If the \s-1POT\s0 file already exists, it is regenerated if a master document or the configuration file is more recent (unless \fB\-\-no\-update\fR is provided). The \s-1POT\s0 file is also written in a temporary document and \fBpo4a\fR verifies that the changes are really needed. .Sp Also, a translation is regenerated only if its master document, the \s-1PO\s0 file, one of its addenda or the configuration file is more recent. To avoid trying to regenerate translations which do not pass the threshold test (see \fB\-\-keep\fR), a file with the \fI.po4a\-stamp\fR extension can be created (see \fB\-\-stamp\fR). .RE .RE .RS 4 .Sp If a master document includes files, you should use the \fB\-\-force\fR flag because the modification time of these included files are not taken into account. .Sp The \s-1PO\s0 files are always re-generated based on the \s-1POT\s0 with \fBmsgmerge \-U\fR. .RE .IP "\fB\-\-stamp\fR" 4 .IX Item "--stamp" Tells \fBpo4a\fR to create stamp files when a translation is not generated because it does not reach the threshold. These stamp files are named according to the expected translated document, with the \fI.po4a\-stamp\fR extension. .Sp Note: This only activates the creation of the \fI.po4a\-stamp\fR files. The stamp files are always used if they exist, and they are removed with \&\fB\-\-rm\-translations\fR or when the file is finally translated. .IP "\fB\-\-no\-translations\fR" 4 .IX Item "--no-translations" Do not generate the translated documents, only update the \s-1POT\s0 and \s-1PO\s0 files. .IP "\fB\-\-no\-update\fR" 4 .IX Item "--no-update" Do not change the \s-1POT\s0 and \s-1PO\s0 files, only the translation may be updated. .IP "\fB\-\-keep\-translations\fR" 4 .IX Item "--keep-translations" Keeps the existing translation files even if the translation doesn't meet the threshold specified by \fB\-\-keep\fR. This option does not create new translation files with few content, but it will save existing translations which decay because of changes to the master files. .Sp \&\s-1WARNING:\s0 This flag changes the po4a behavior in a rather drastic way: your translated files will not get updated at all until the translation improves. Only use this flag if you prefer shipping an outdated translated documentation rather than only shipping an accurate untranslated documentation. .IP "\fB\-\-rm\-translations\fR" 4 .IX Item "--rm-translations" Remove the translated files (implies \fB\-\-no\-translations\fR). .IP "\fB\-\-no\-backups\fR" 4 .IX Item "--no-backups" This flag does nothing since 0.41, and may be removed in later releases. .IP "\fB\-\-rm\-backups\fR" 4 .IX Item "--rm-backups" This flag does nothing since 0.41, and may be removed in later releases. .IP "\fB\-\-translate\-only\fR \fItranslated-file\fR" 4 .IX Item "--translate-only translated-file" Translate only the specified file. It may be useful to speed up processing if a configuration file contains a lot of files. Note that this option does not update \s-1PO\s0 and \s-1POT\s0 files. This option can be used multiple times. .IP "\fB\-\-variable\fR \fIvar\fR\fB=\fR\fIvalue\fR" 4 .IX Item "--variable var=value" Define a variable that will be expanded in the \fBpo4a\fR configuration file. Every occurrence of \fI$(var)\fR will be replaced by \fIvalue\fR. This option can be used multiple times. .IP "\fB\-\-srcdir\fR \fI\s-1SRCDIR\s0\fR" 4 .IX Item "--srcdir SRCDIR" Set the base directory for all input documents specified in the \fBpo4a\fR configuration file. .Sp If both \fIdestdir\fR and \fIsrcdir\fR are specified, input files are searched in the following directories, in order: \fIdestdir\fR, the current directory and \fIsrcdir\fR. Output files are written to \fIdestdir\fR if specified, or to the current directory. .IP "\fB\-\-destdir\fR \fI\s-1DESTDIR\s0\fR" 4 .IX Item "--destdir DESTDIR" Set the base directory for all the output documents specified in the \&\fBpo4a\fR configuration file (see \fB\-\-srcdir\fR above). .SS "Options modifying the \s-1POT\s0 header" .IX Subsection "Options modifying the POT header" .IP "\fB\-\-porefs\fR \fItype\fR" 4 .IX Item "--porefs type" Specify the reference format. Argument \fItype\fR can be one of \fBnever\fR to not produce any reference, \fBfile\fR to only specify the file without the line number, \fBcounter\fR to replace line number by an increasing counter, and \fBfull\fR to include complete references (default: full). .IP "\fB\-\-wrap\-po\fR \fBno\fR|\fBnewlines\fR|\fInumber\fR (default: 76)" 4 .IX Item "--wrap-po no|newlines|number (default: 76)" Specify how the po file should be wrapped. This gives the choice between either files that are nicely wrapped but could lead to git conflicts, or files that are easier to handle automatically, but harder to read for humans. .Sp Historically, the gettext suite has reformatted the po files at the 77th column for cosmetics. This option specifies the behavior of po4a. If set to a numerical value, po4a will wrap the po file after this column and after newlines in the content. If set to \fBnewlines\fR, po4a will only split the msgid and msgstr after newlines in the content. If set to \fBno\fR, po4a will not wrap the po file at all. The reference comments are always wrapped by the gettext tools that we use internally. .Sp Note that this option has no impact on how the msgid and msgstr are wrapped, ie on how newlines are added to the content of these strings. .IP "\fB\-\-master\-language\fR" 4 .IX Item "--master-language" Language of the source files containing the documents to translate. Note that all master documents must use the same language. .IP "\fB\-\-msgid\-bugs\-address\fR \fIemail@address\fR" 4 .IX Item "--msgid-bugs-address email@address" Set the report address for msgid bugs. By default, the created \s-1POT\s0 files have no Report-Msgid-Bugs-To fields. .IP "\fB\-\-copyright\-holder\fR \fIstring\fR" 4 .IX Item "--copyright-holder string" Set the copyright holder in the \s-1POT\s0 header. The default value is \&\*(L"Free Software Foundation, Inc.\*(R" .IP "\fB\-\-package\-name\fR \fIstring\fR" 4 .IX Item "--package-name string" Set the package name for the \s-1POT\s0 header. The default is \*(L"\s-1PACKAGE\*(R".\s0 .IP "\fB\-\-package\-version\fR \fIstring\fR" 4 .IX Item "--package-version string" Set the package version for the \s-1POT\s0 header. The default is \*(L"\s-1VERSION\*(R".\s0 .SS "Options to modify the \s-1PO\s0 files" .IX Subsection "Options to modify the PO files" .IP "\fB\-\-msgmerge\-opt\fR \fIoptions\fR" 4 .IX Item "--msgmerge-opt options" Extra options for \fBmsgmerge\fR(1). .Sp Note: \fB\f(CB$lang\fB\fR will be extended to the current language. .IP "\fB\-\-no\-previous\fR" 4 .IX Item "--no-previous" This option removes \fB\-\-previous\fR from the options passed to \fBmsgmerge\fR. This permits to support versions of \fBgettext\fR earlier than 0.16. .IP "\fB\-\-previous\fR" 4 .IX Item "--previous" This option adds \fB\-\-previous\fR to the options passed to \fBmsgmerge\fR. It requires \fBgettext\fR 0.16 or later, and is activated by default. .SH "CONFIGURATION FILE" .IX Header "CONFIGURATION FILE" po4a expects a configuration file as argument. This file must contain the following elements: .IP "\(bu" 4 The path to the \s-1PO\s0 files and the list of languages existing in the project; .IP "\(bu" 4 Optionally, some global options and so-called configuration aliases that are used as templates to configure individual master files; .IP "\(bu" 4 The list of each master file to translate, along with specific parameters. .PP All lines contain a command between square braces, followed by its parameters. Comments begin with the char '#' and run until the end of the line. You can escape the end of line to spread a command over several lines. .SS "Finding the \s-1PO\s0 and \s-1POT\s0 files" .IX Subsection "Finding the PO and POT files" The simplest solution is to give the path to the directory containing your translation project as follows. .PP .Vb 1 \& [po_directory] man/po/ .Ve .PP The provided directory must contain a set of \s-1PO\s0 files, each named \fI\s-1XX\s0.po\fR with \&\f(CW\*(C`XX\*(C'\fR the \s-1ISO 639\-1\s0 of the language used in this file. The directory must also contain a single \s-1POT\s0 file, with the \f(CW\*(C`.pot\*(C'\fR file extension. .PP If you prefer, you can give the same information explicitly as follows: .PP .Vb 1 \& [po4a_paths] man/po/project.pot de:man/po/de.po fr:man/po/fr.po .Ve .PP This specifies the path to the \s-1POT\s0 file first, and then the paths to the German and French \s-1PO\s0 files. .PP Finally, the same information can be written as follows: .PP .Vb 2 \& [po4a_langs] fr de \& [po4a_paths] man/po/project.pot $lang:man/po/$lang.po .Ve .PP The \f(CW$lang\fR component is automatically expanded using the provided languages list, reducing the risk of copy/paste error when a new language is added. .PP \fICentralized or split \s-1PO\s0 files?\fR .IX Subsection "Centralized or split PO files?" .PP By default, po4a produces one single \s-1PO\s0 file per target language, containing the whole content of your translation project. As your project grows, the size of these files may become problematic. When using weblate, it is possible to specify priorities for each translation segment (i.e., msgid) so that the important ones get translated first. Still, some translation teams prefer to split the content in several files. .PP To have one \s-1PO\s0 file per master file, you simply have to use the string \&\f(CW$master\fR in the name of your \s-1PO\s0 files on the \f(CW\*(C`[po4a_paths]\*(C'\fR line, as follows. .PP .Vb 1 \& [po4a_paths] doc/$master/$master.pot $lang:doc/$master/$lang.po .Ve .PP If there are name conflicts because several files have the same filename, the name of the master file can be specified by adding a \f(CW\*(C`master:file=\*(C'\fR\fIname\fR option: .PP .Vb 4 \& [po4a_langs] de fr ja \& [po4a_paths] l10n/po/$master.pot $lang:l10n/po/$master.$lang.po \& [type: xml] foo/gui.xml $lang:foo/gui.$lang.xml master:file=foo\-gui \& [type: xml] bar/gui.xml $lang:bar/gui.$lang.xml master:file=bar\-gui .Ve .PP In split mode, \fBpo4a\fR builds a temporary compendium during the \s-1PO\s0 update, to share the translations between all the \s-1PO\s0 files. If two \s-1PO\s0 files have different translations for the same string, \fBpo4a\fR will mark this string as fuzzy and will submit both translations in all the \s-1PO\s0 files containing this string. When unfuzzied by the translator, the translation is automatically used in every \s-1PO\s0 files. .SS "Specifying the documents to translate" .IX Subsection "Specifying the documents to translate" You must also list the documents that should be translated. For each master file, you must specify the format parser to use, the location of the translated document to produce, and optionally some configuration. Here is an example: .PP .Vb 5 \& [type: sgml] doc/my_stuff.sgml fr:doc/fr/mon_truc.sgml \e \& de:doc/de/mein_kram.sgml \& [type: man] script fr:doc/fr/script.1 de:doc/de/script.1 \& [type: docbook] doc/script.xml fr:doc/fr/script.xml \e \& de:doc/de/script.xml .Ve .PP But again, these complex lines are difficult to read and modify, e.g. when adding a new language. It is much simpler to reorganize things using the \f(CW$lang\fR template as follows: .PP .Vb 3 \& [type: sgml] doc/my_stuff.sgml $lang:doc/$lang/my_stuff.sgml \& [type: man] script.1 $lang:po/$lang/script.1 \& [type: docbook] doc/script.xml $lang:doc/$lang/script.xml .Ve .SS "Specifying options" .IX Subsection "Specifying options" There is two types of options: \fIpo4a options\fR are default values to the po4a command line options while \fIformat options\fR are used to change the behavior of the format parsers. As a \fIpo4a options\fR, you could for example specify in your configuration file that the default value of the \fB\-\-keep\fR command line parameter is 50% instead of 80%. \fIFormat options\fR are documented on the specific page of each parsing module, e.g. \fBLocale::Po4a::Xml\fR\|(3pm). You could for example pass \fBnostrip\fR to the \s-1XML\s0 parser to not strip the spaces around the extracted strings. .PP You can pass these options for a specific master file, or even for a specific translation of that file, using \f(CW\*(C`opt:\*(C'\fR and \f(CW\*(C`opt_XX:\*(C'\fR for the \f(CW\*(C`XX\*(C'\fR language. In the following example, the \fBnostrip\fR option is passed to the \s-1XML\s0 parser (for all languages), while the threshold will be reduced to 0% for the French translation (that is thus always kept). .PP .Vb 1 \& [type:xml] toto.xml $lang:toto.$lang.xml opt:"\-o nostrip" opt_fr:"\-\-keep 0" .Ve .PP In any case, these configuration chunks must be located at the end of the line. The declaration of files must come first, then the addendum if any (see below), and then only the options. The grouping of configuration chunks is not very important, since elements are internally concatenated as strings. The following examples are all equivalent: .PP .Vb 3 \& [type:xml] toto.xml $lang:toto.$lang.xml opt:"\-\-keep 20" opt:"\-o nostrip" opt_fr:"\-\-keep 0" \& [type:xml] toto.xml $lang:toto.$lang.xml opt:"\-\-keep 20 \-o nostrip" opt_fr:"\-\-keep 0" \& [type:xml] toto.xml $lang:toto.$lang.xml opt:\-\-keep opt:20 opt:\-o opt:nostrip opt_fr:\-\-keep opt_fr:0 .Ve .PP Note that language specific options are not used when building the \s-1POT\s0 file. It is for example impossible to pass \fBnostrip\fR to the parser only when building the French translation, because the same \s-1POT\s0 file is used to update every languages. So the only options that can be language-specific are the ones that are used when producing the translation, as the \f(CW\*(C`\-\-keep\*(C'\fR option. .PP \fIConfiguration aliases\fR .IX Subsection "Configuration aliases" .PP To pass the same options to several files, the best is to define a type alias as follows. In the next example, \f(CW\*(C`\-\-keep 0\*(C'\fR is passed to every Italian translation using this \f(CW\*(C`test\*(C'\fR type, that is an extension of the \f(CW\*(C`man\*(C'\fR type. .PP .Vb 2 \& [po4a_alias:test] man opt_it:"\-\-keep 0" \& [type: test] man/page.1 $lang:man/$lang/page.1 .Ve .PP You can also extend an existing type reusing the same name for the alias as follows. This is not interpreted as as an erroneous recursive definition. .PP .Vb 2 \& [po4a_alias:man] man opt_it:"\-\-keep 0" \& [type: man] man/page.1 $lang:man/$lang/page.1 .Ve .PP \fIGlobal default options\fR .IX Subsection "Global default options" .PP You can also use \f(CW\*(C`[options]\*(C'\fR lines to define options that must be used for all files, regardless of their type. .PP .Vb 1 \& [options] \-\-keep 20 \-\-option nostrip .Ve .PP As with the command line options, you can abbreviate the parameters passed in the configuration file: .PP .Vb 1 \& [options] \-k 20 \-o nostrip .Ve .PP \fIOption priorities\fR .IX Subsection "Option priorities" .PP The options of every sources are concatenated, ensuring that the default values can easily be overridden by more specific options. The order is as follows: .IP "\(bu" 4 \&\f(CW\*(C`[options]\*(C'\fR lines provide default values that can be overridden by any other source. .IP "\(bu" 4 Type aliases are then used. Language specific settings override the ones applicable to all languages. .IP "\(bu" 4 Settings that are specific to a given master file override both the default ones and the ones coming from the type alias. In this case also, language specific settings override the global ones. .IP "\(bu" 4 Finally, parameters provided on the \fBpo4a\fR command line override any settings from the configuration file. .PP \fIExample\fR .IX Subsection "Example" .PP Here is an example showing how to quote the spaces and quotes: .PP .Vb 1 \& [po_directory] man/po/ \& \& [options] \-\-master\-charset UTF\-8 \& \& [po4a_alias:man] man opt:"\-o \e"mdoc=NAME,SEE ALSO\e"" \& [type:man] t\-05\-config/test02_man.1 $lang:tmp/test02_man.$lang.1 \e \& opt:"\-k 75" opt_it:"\-L UTF\-8" opt_fr:\-\-verbose .Ve .SS "Addendum: Adding extra content in the translation" .IX Subsection "Addendum: Adding extra content in the translation" If you want to add an extra section to the translation, for example to give credit to the translator, then you need to define an addendum to the line defining your master file. Please refer to the page \fBpo4a\fR\|(7) for more details on the syntax of addendum files. .PP .Vb 2 \& [type: pod] script fr:doc/fr/script.1 \e \& add_fr:doc/l10n/script.fr.add .Ve .PP You can also use language templates as follow: .PP .Vb 2 \& [type: pod] script $lang:doc/$lang/script.1 \e \& add_$lang:doc/l10n/script.$lang.add .Ve .PP If an addendum fails to apply, the translation is discarded. .PP \fIModifiers for the addendum declaration\fR .IX Subsection "Modifiers for the addendum declaration" .PP Addendum modifiers can simplify the configuration file in the case where not all languages provide an addendum, or when the list of addenda changes from one language to the other. The modifier is a single char located before the file name. .IP "\fB?\fR" 2 .IX Item "?" Include \fIaddendum_path\fR if this file does exist, otherwise do nothing. .IP "\fB@\fR" 2 .IX Item "@" \&\fIaddendum_path\fR is not a regular addendum but a file containing a list of addenda, one by line. Each addendum may be preceded by modifiers. .IP "\fB!\fR" 2 .IX Item "!" \&\fIaddendum_path\fR is discarded, it is not loaded and will not be loaded by any further addendum specification. .PP The following includes an addendum in any language, but if only it exists. No error is reported if the addendum does not exist. .PP .Vb 1 \& [type: pod] script $lang:doc/$lang/script.1 add_$lang:?doc/l10n/script.$lang.add .Ve .PP The following includes a list of addendum for every language: .PP .Vb 1 \& [type: pod] script $lang:doc/$lang/script.1 add_$lang:@doc/l10n/script.$lang.add .Ve .SS "Filtering the translated strings" .IX Subsection "Filtering the translated strings" Sometimes, you want to hide some strings from the translation process. To that extend, you can give a \f(CW\*(C`pot_in\*(C'\fR parameter to your master file to specify the name of the file to use instead of the real master when building the \s-1POT\s0 file. Here is an example: .PP .Vb 3 \& [type:docbook] book.xml \e \& pot_in:book\-filtered.xml \e \& $lang:book.$lang.xml .Ve .PP With this setting, the strings to translate will be extracted from the \&\fIbook\-filtered.xml\fR (that must be produced before calling \fBpo4a\fR) while the translated files will be built from \fIbook.xml\fR. As a result, any string that is part of \fIbook.xml\fR but not in \fIbook\-filtered.xml\fR will not be included in the \&\s-1PO\s0 files, preventing the translators from providing a translation for them. So these strings will be left unmodified when producing the translated documents. This naturally decreases the level of translation, so you may need the \f(CW\*(C`\-\-keep\*(C'\fR option to ensure that the document is produced anyway. .SS "\s-1CONFIGURATION EXAMPLE\s0" .IX Subsection "CONFIGURATION EXAMPLE" \&\s-1TODO:\s0 Is this section really useful? .PP Let's assume you maintain a program named \fBfoo\fR which has a man page \fIman/foo.1\fR which naturally is maintained in English only. Now you as the upstream or downstream maintainer want to create and maintain the translation. First you need to create the \s-1POT\s0 file necessary to send to translators using \fBpo4a\-gettextize\fR\|(1). .PP So for our case we would call .PP .Vb 1 \& cd man && po4a\-gettextize \-f man \-m foo.1 \-p foo.pot .Ve .PP You would then send this file to the appropriate language lists or offer it for download somewhere on your website. .PP Now let's assume you received three translations before your next release: \&\fIde.po\fR (including an addendum \fIde.add\fR), \fIsv.po\fR and \fIpt.po\fR. Since you don't want to change your \fIMakefile\fR(s) whenever a new translation arrives you can use \fBpo4a\fR with an appropriate configuration file in your \fIMakefile\fR. Let's call it \fIpo4a.cfg\fR. In our example it would look like the following: .PP .Vb 1 \& [po_directory] man/po4a/po/ \& \& [type: man] man/foo.1 $lang:man/translated/$lang/foo.1 \e \& add_$lang:?man/po4a/add_$lang/$lang.add opt:"\-k 80" .Ve .PP In this example we assume that your generated man pages (and all \s-1PO\s0 and addenda files) should be stored in \fIman/translated/$lang/\fR (respectively in \fIman/po4a/po/\fR and \&\fIman/po4a/add_$lang/\fR) below the current directory. In our example the \fIman/po4a/po/\fR directory would include \fIde.po\fR, \fIpt.po\fR and \fIsv.po\fR, and the \fIman/po4a/add_de/\fR directory would include \fIde.add\fR. .PP Note the use of the modifier \fB?\fR as only the German translation (\fIde.po\fR) is accompanied by an addendum. .PP To actually build the translated man pages you would then (once!) add the following line in the \fBbuild\fR target of the appropriate \fIMakefile\fR: .PP .Vb 1 \& po4a po4a.cfg .Ve .PP Once this is set up you don't need to touch the \fIMakefile\fR when a new translation arrives, i.e. if the French team sends you \fIfr.po\fR and \fIfr.add\fR then you simply drop them respectively in \fIman/po4a/po/\fR and \&\fIman/po4a/add_fr/\fR and the next time the program is built the French translation is automatically build as well in \fIman/translated/fr/\fR. .PP Note that you still need an appropriate target to install localized manual pages with English ones. .PP Finally if you do not store generated files into your version control system, you will need a line in your \fBclean\fR target as well: \-rm \-rf man/translated .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBpo4a\-gettextize\fR\|(1), \&\fBpo4a\-normalize\fR\|(1), \&\fBpo4a\-translate\fR\|(1), \&\fBpo4a\-updatepo\fR\|(1), \&\fBpo4a\fR\|(7). .SH "AUTHORS" .IX Header "AUTHORS" .Vb 3 \& Denis Barbier \& Nicolas François \& Martin Quinson (mquinson#debian.org) .Ve .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 2002\-2020 by \s-1SPI,\s0 inc. .PP This program is free software; you may redistribute it and/or modify it under the terms of \s-1GPL\s0 (see the \s-1COPYING\s0 file).