MagicPO About Download Bugs/support git Manpage Dictionary manpage


MagicPO - automatically translate po-files


magicpo [OPTIONS]


MagicPO is a utility that assists in automated translation of files in the gettext PO format.

It can translate between similar languages (such as Norwegian Nynorsk and Norwegian Bokmaal, or Norwegian Bokmaal and Danish) using a dictionary, or insert previous translations from a database.

By default it uses a dictionary, is verbose and marks changed strings as fuzzy. The latter can be supressed with the --silent and --nomarkfuzzy commandline arguments.



-h, --help

Display the help screen

-s, --silent

Be silent (don't output anything other than syntax errors)


Display various information useful for debugging.

-r, --reformat

Don't perform any replacements or translations, just reformat the PO-file. Overrides everything else.


-d, --dict NAME

Use the dictionary supplied. Try --dict list to view a list of possible dictionaries. This searches through a preset list of directories for dictionaries, and generates simple shorthand names for those.

The searchpath is as follows: First it searches ~/, then the magicpo-dir/dictionaries, then magicpo-dir/ and finally ./

-f, --dictfile FILE

Use the dictionary FILE Using --dict is often easier, but this lets you explicitly set the file to use.

-t, --target FILE

Write the translated po-file to FILE instead of back to the original.


Selects the newer file for merging. See MERGING.


Selects the current (older) file for merging. See MERGING.


Replace fuzzy strings in --current file with non-fuzzy strings from --newer


Don't mark changed strings as fuzzy.


This lets you examine which regular expressions are changing a certain string. The parameter is the string number in the file (the header is string number 1). So if you want to see which dictionary entries keep messing up string number 5, supply --whatchanged 5.

You can also use --whatchanged ``String''. The string must then be EXACTLY as it is in the po-file. Also, this will not work when running on multiple files.


When either of these options are used, all dictionary-related commandline options will be ignored.

--mkdb FILE

Create a translation database in FILE for use with --dbfile.

This will create a single translation database comprised of all of the strings in all of the PO files you supply on the commandline. If the database already exists it will merely append to it. It ignores all fuzzy and untranslated strings in source files.

For instance, one might create a translation database from a large svn project where you know that all of the relevant po files will be named nn.po:

magicpo --mkdb nn-magicpo.db `find ~/svn -iname nn.po`

Or in a dir structure that already contains only po-files you want in the db:

magicpo --mkdb nn-magicpo.db `find ~/svn/nn -iname '*.po'`
--dbfile FILE

Translate all of the po-files supplied on the commandline using the translation database in FILE. These strings will not be marked as fuzzy at all, regardless of settings.


MagicPO can merge one po-file with another. Say for example that you have dayplanner.po in Norwegian Nynorsk for version 0.7 of Day Planner, but the Norwegian Bokmaal version is currently only updated for version 0.6. MagicPO can translate the Nynorsk file and add the new strings to the Bokmaal file, keeping all of the old Bokmaal strings intact.

To do this run MagicPO like this:

magicpo --current dayplanner_nb.po --newer dayplanner_nn.po

This will update dayplanner_nb.po to include the latest changes as per dayplanner_nn.po


MagicPO will display syntax error messages if it finds any. You are advised to check that the output file does not have any removed data when these appear (MagicPO will in most cases attempt to solve them).

If you find an invalid syntax error you should report this as a bug. First verify manually in the ORIGINAL file that it is not a syntax error. Then provide both the old and the new file, the output of magicpo --debuginfo and a copy of all the error messages MagicPO displayed. See BUGS AND LIMITATIONS for information on how to report.


0 for success, any nonzero value for failure.


MagicPO was originally TransPO. A simple perl program written by Harald Thingelstad to assist in automated translation. Eskild Hustvedt joined and became the primary maintainer of TransPO around 2005. In 2006 Harald had decided he wanted to rewrite TransPO in python, at this point Eskild forked it into MagicPO. Since then MagicPO has seen a lot of improvements, such as proper support for PO-files with tags, support for more advanced forms of PO-files and support for merging.


- Currently does not format po-files exactly the way msgmerge would.
- Doesn't handle more than three msgstr's per string.
- It is not possible to make it mark strings translated using the database as fuzzy

Probably others too. Send reports, with any relevant information and the output of magicpo --debuginfo to zerodogg -a-t- zerodogg dot org


Copyright (C) Eskild Hustvedt 2005, 2006, 2007, 2008

Forked from TransPO, Copyright (C) 2003, 2004 Harald Thingelstad

This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


magicpo.dict(5) - Dictionary syntax

Projects fcgim gpgpwd GoldenPod GRandomWallpaper jQsimple-class MagicPO migraineDiary mussort phpdocr SPGal SWEC wwine Show more