ITSTOOL(1)

πŸ“¦
version 2.0.7 Β· 2 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, centos-stream 10, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

πŸ’– ITSTOOL β€” okay bestie, let's talk ✨

So like, itstool is the little command-line icon from the General Commands Manual crew, and she's here to convert between XML and PO using ITS. That's the whole vibe. Fr fr.


πŸ¦‹ SYNOPSIS πŸ¦‹

itstool [OPTIONS] XMLFILES...
itstool -m <MOFILE> [OPTIONS] XMLFILES...
itstool -j <XMLFILE> [OPTIONS] MOFILES...

Three whole modes. Pick your fighter. πŸ’…


✨ DESCRIPTION ✨

Okay so here's the tea, bestie: itstool extracts messages from XML files and outputs PO template files, and then it merges translations from MO files to create translated XML files. Iconic behaviour honestly.

The way it knows what to translate and how to chunk it into messages? It uses the W3C Internationalization Tag Set (ITS). That's the secret sauce. No cap. 🧚

Wanna extract messages from XML files XMLFILES and dump them into OUT.pot? Say less:

itstool -o OUT.pot XMLFILES

Then after you merge with existing translations (or translate the strings yourself, main character energy), generate an MO file with msgfmt(1), and then output the translated files into the directory DIR:

itstool -m OUT.mo -o DIR XMLFILES

And if you want a single multilingual XML output file β€” like, one file, all the languages β€” you can use an input XML file plus a set of MO files:

itstool -j FILE.xml -o OUT.xml MOFILES

Now, where do ITS definitions come from? Great question, I'm so glad you asked. 🫢 They get loaded from:

  • the built-in rules
  • rules embedded in the source XML files
  • files passed with the -i option
  • ITS attributes in the source XML files

And here's the important bit: later definitions take precedence. So the order matters, bestie. And if you're feeling rebellious, you can disable the built-in rules entirely by passing -n. Periodt. πŸ’€


πŸŽ€ OPTIONS πŸŽ€

🌸 Extracting

  • -o OUT.pot, --out OUT.pot β€” output PO template to the file OUT.pot

πŸ¦‹ Merging

  • -m MOFILE XMLFILES, --merge MOFILE XMLFILES β€” merge from an MO file MOFILE and output translated XML files for source XMLFILES
  • -l LANG, --lang LANG β€” explicitly set the language code output to XML
  • -o OUT, --out OUT β€” output XML files in the directory OUT

πŸ’œ Joining

  • -j MLIFILE MOFILES, --join XMLFILE MOFILES β€” join translations from MOFILES into a multilingual file based on source XMLFILE
  • -o OUT.xml, --out OUT.xml β€” output to the XML file OUT.xml

⭐ Common

  • -i ITS, --its ITS β€” load the ITS rules in the file ITS (can specify multiple times)
  • -n, --no-builtins β€” do not apply the built-in ITS rules that ship with itstool
  • -s, --strict β€” exit with error when PO files contain broken XML
  • -d, --load-dtd β€” load external DTDs used by input XML files
  • -k, --keep-entities β€” keep entity references unexpanded in PO files
  • -p NAME VALUE, --param NAME VALUE β€” define ITS parameter NAME to the value VALUE (can specify multiple times)
Lowkey note: -i and -p can both be specified multiple times. Stack 'em up, bestie. πŸ‘‘

πŸ‘‘ AUTHOR πŸ‘‘

Shaun McCance <shaunm@gnome.org> β€” the legend, the blueprint, the moment. πŸ’œ


🌈 SEE ALSO 🌈

More documentation for itstool is maintained online. For more information, see:

http://itstool.org/documentation/

And that's the whole page, bestie! This lil masterpiece is from itstool 2.0.7, dated December 2013, and she lives in the ITSTOOL(1) section of the manual. Go translate something gorgeous, mwah. πŸ’–βœ¨πŸŽ€