Skip to main content

Okrand is an internationalization/translation tool for Django

Project description

Okrand is an internationalization/translation tool for Django.

It is a pure Python program so doesn’t rely on gettext.

Okrand will respect your .gitignore.

Django models

Okrand can upgrade Django models so translation is much easier. You don’t need to write verbose_name anymore! And if you do write them Okrand will upgrade raw strings to gettext_lazy.

Turn this feature on in your setup.cfg:


So concretely this model:

from django.utils.translation import gettext_lazy as _

class Book(Model):
    name = CharField(verbose_name=_('name'))
    isbn = CharField(verbose_name=_('ISBN'))

    class Meta:
        verbose_name = _('book')
        verbose_name = _('books')

Can now be changed to the more natural:

class Book(Model):
    name = CharField()
    isbn = CharField(verbose_name='ISBN')

Note that I don’t need to wrap the verbose_name in a gettext_lazy call anymore.


First pip install okrand, then add okrand to INSTALLED_APPS.

Add OKRAND_STATIC_PATH to settings, pointing to where Okrand should write the JavaScript catalog files. Typically something like:

OKRAND_STATIC_PATH = Path(BASE_DIR) / 'yourproject' / 'base' / 'static'

If you have a base app to put common stuff.


In setup.cfg you set:

  • additional ignore rules beyond .gitignore. These are regexes for the full path.

  • sorting: none (default), alphabetical

  • if the django model upgrade is enabled


What does “Okrand” mean?

Marc Okrand is a linguist who is best known for his work on Star Trek where he created the Klingon language.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

okrand-1.1.0.tar.gz (28.8 kB view hashes)

Uploaded Source

Built Distribution

okrand-1.1.0-py2.py3-none-any.whl (28.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page