What is it?
Dennis is a Python command line
utility (and library) for working with localization. It includes:
a translator for strings .po files
a linter for finding problems in strings in .po files
v0.3.3 released!
This is the first blog-post-announced release. I think Dennis is good
enough for wider use. I've been using it for development work on both
kitsune (which drives Support) and fjord (which drives Input with great success.
Why Dennis?
It fills two basic needs I had:
translate .po files so I can find problems during development
related to localized strings, layout issues, unicode support, etc
lint translated .po files so that errors in translated strings
don't make it to production where they cause fires, make users
angry and make me very sad and tired
There's another project called Translate Toolkit
that you could use for item 1, but it doesn't have Pirate! and I like
my pipeline architecture since it's more "pluggable" (whatever that
means). Plus it didn't have a linter that covered my specific issues
nor does it return a non-zero exit status so I can't use it for
selective compiling.
Therefore I decided to write my own tool to meet my needs.
The ultra-basics
Install
Linting
Lint a single .po file for problems including mismatched/malformed
Python variables in translated strings:
Produces output like this:
If you have blessings
installed, it'll colorize that output.
You can also lint a directory structure of .po files:
I use this to compile only the error-free .po files to .mo
files and tell us which .po files have problems so we can fix
them.
Translating
You can translate a .po file in place into Pirate! to help find
l10n issues in your code:
This takes into account that the strings have HTML in them that should
be ignored when translating. It uses a pipeline architecture where the
output of one transform is fed as input to the next, so you can string
them along and get shouty extra-pirate with anglequotes:
Summary
That's the gist of it. In the Dennis documentation is a list of Dennis recipes covering
linting, translating, etc.
Yay for Dennis!
[Comments]