Skip to content

django-i18n

Django provides a built-in i18n module that allows you to translate your website into multiple languages. However, the built-in i18n module is not very flexible and can be difficult to use. django-i18n is an alternative to Django's built-in i18n module that is more flexible and easier to use.

Why use django-i18n?

If you are familiar with Vue i18n, you may have worked with the yaml files to store translations. django-i18n uses the same approach to store translations, making it easier to manage and maintain translations.

The approach of the django-i18n library is extremely similar to the Vue i18n library, making it easier for developers to work with translations in Django.

You can use it directly in Python:

python
from django_i18n.tools import translate as t
# We like to alias the translate function to t, but it's not required

print(t('my.key'))  # Hello, World!

Also, you can use it in your Django templates:

html
{% load t from django_i18n %}
<h1>{% t 'my.key' %} {# Hello, World! #}</h1>

For more information, checkout the README file on GitHub.

Where can I get the library?

You can get the library from pypi.org.

Can I contribute to the library?

Of course! Feel free to contribute to the library on GitHub.

Where are the source code?

You can find the source code on GitHub.