Okrand - an internationalization/translation tool for Django

I released Okrand today, which is something I’ve been working on a little while. The i18n system in Django is 15 years old and it shows, with the dependency on the gettext tool being the biggest liability. Okrand is a pure python tool, and has a built in view to make translation easy. This tool also highlights some common mistakes.

Check out the readme for more.


Hi @boxed! It is indeed good to see people think about improvements to the i18n system. My first though was that this would replace the po and mo files to use e.g. JSON but this doesn’t seem to be the case.

So if I understand it well, the project aims to make po files translatable in an iommi admin, correct? Are there any other goals?

My first goal was to have tooling that I could work with. My first feature addition was to collect model field names and translate them without the need to add gettext_lazy for every field that is the same as the field name. Never send a man to do a machine’s job :slight_smile:

I am very open to adding json support. This would be very easy because the code of Okrand is very small, well tested, and easy to reason about.

There are other features one could add like getting the field names for forms so you don’t need to write explicit gettext calls for them either.

I see! I am unsure whether it is worth replacing po and mo files, on the project at work we use a separate SPA frontend with translations stored in JSON and it is good for manual edits. But we also need to add entries manually. So perhaps the Django translations is good when working with po files is abstracted, and it ultimately doesn’t matter what format it is stored in.

Yea, if it’s PO files or not seems not really very significant. You can check out the Okrand source code. The po-file handling is quite trivial. I use polib in a simple way (vendored because reasons). It could easily write to and from json files if you want.

Btw, I forgot that I also had lots of trouble with the javascript catalog thing in Django so that was also a factor in me getting angry enough to write Okrand :stuck_out_tongue:

1 Like