PO4A-TRANSLATE.1P(1)

πŸ’… NAME πŸ’…

po4a-translate β€” bestie, it takes a PO file and turns it back into documentation format, no cap ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

po4a-translate -f fmt -m master.doc -p XX.po -l XX.doc

Heads up: XX.doc is the output, like, literally everything else is an input 🫢


🌸 DESCRIPTION 🌸

Okay so the whole po4a (PO for anything) project has one goal, and it's honestly iconic: make translations easier β€” and even more importantly, make maintaining those translations easier β€” by using gettext tools on places nobody expected them to go, like documentation. it's giving chaos but make it organized πŸ’…

The po4a-translate script is the main character here: its whole job is converting the translation (which you did in a PO file) back into the documentation format. And bestie, the PO file you feed it should be the translation of the POT file that po4a-gettextize(1) produced. no substitutions, periodt πŸ”₯


✨ OPTIONS ✨

  • -f, --format β€” the format of the documentation you wanna handle. not sure which ones exist? run the --help-format option and it'll list every available format for you πŸ’–
  • -a, --addendum β€” adds a file to the resulting file (perfect for dropping in the translator's name, or a whole "About this translation" section, for example). The first line of the file you're inserting has to be a PO4A header telling it where to go β€” check the section HOWTO add extra text to translations in po4a(7) πŸŽ€
  • -A, --addendum-charset β€” the charset of the addenda. Important: all the addenda should be in the same charset, okay? don't mix and match πŸ™ˆ
  • -m, --master β€” the file containing the master document you're translating πŸ“„
  • -M, --master-charset β€” charset of the file containing the document to translate 🧚
  • -l, --localized β€” the file where the localized (translated) document should be written ✍️
  • -L, --localized-charset β€” charset of the file containing the localized document 🌈
  • -p, --po β€” the file to read the message catalog from πŸ“
  • -o, --option β€” extra option(s) passed straight to the format plugin. Each plugin's docs explain which options are valid and what they mean. For example, you could hit the AsciiDoc parser with -o tablecells, while the text parser would accept -o tabs=split ⭐
  • -k, --keep β€” the minimal translation-percentage threshold for keeping (i.e. writing) the resulting file, default 80. So by default, files gotta be at least 80% translated to actually get written. the bar is on the floor but it's still a bar πŸ’€
  • -w, --width β€” the column to wrap the resulting file at, if the format supports it, default 76. And if you pass 0 or a negative value, the resulting file won't be wrapped at all β€” which is lowkey useful for formats that break when you rewrap them 🫢
  • -h, --help β€” shows a short help message, short and sweet πŸŽ€
  • --help-format β€” lists all the documentation formats po4a understands πŸ‘‘
  • -V, --version β€” displays the version of the script and exits, bye ✌️
  • -v, --verbose β€” cranks up the verbosity of the program πŸ”
  • -d, --debug β€” outputs some debugging information, for when you gotta see what's going on inside 🧐

πŸ’œ Adding content (beside translations) to generated files πŸ’œ

So you want extra content in the generated document beside what you translated? like the translator's name, or an "About this translation" section? The move is the --addendum option, that's literally what it's for 🫢

The first line of the addendum must be a header saying where to put it in the document β€” and it can go before or after a given part of the document. The rest of the file gets added verbatim to the resulting file, no further processing, untouched, main character energy ✨

⚠️ Okay this part matters: if po4a-translate fails to add one of the given files, it discards the whole translation. Why so dramatic? Because the missing file could be the one naming the author β€” which would leave users unable to contact them and report bugs in the translation. so yeah, it's a whole thing 😭

The header has a pretty rigid syntax, ngl. For more info on how to use this feature and how it actually works, go read the po4a(7) man page πŸ“–


πŸ¦‹ SEE ALSO πŸ¦‹

po4a-gettextize(1), po4a-normalize(1), po4a-updatepo(1), po4a(7)


πŸ‘‘ AUTHORS πŸ‘‘

  • Denis Barbier <barbier@linuxfr.org>
  • Nicolas FranΓ§ois <nicolas.francois@centraliens.net>
  • Martin Quinson (mquinson#debian.org)

Copyright 2002-2023 by SPI, inc.

This program is free software; you may redistribute it and/or modify it under the terms of GPL v2.0 or later (see the COPYING file).


okay that's the whole page bestie, go translate something iconic πŸ’–βœ¨πŸŽ€

perl v5.42.0 Β· 2025-07-13 β€” mwah, that's the version and date, catch you on the flip side πŸ«ΆπŸ’…

πŸ“¦ where this page comes from