How did all that work?

As I promised at the start of the previous section, after seeing Django translations in action, we will now take a deeper look into all the steps we followed to get to this point and what each of these steps did.

The first thing that we did was load the i18n template tags library, which provides us with a variety of template tags to translate content in the template. The most important, and probably the one that you will use the most, is the trans tag. The trans tag accepts a string argument and, depending on the language that is active, outputs the correct translation for that string. If the translation cannot be found, the original string is output instead.

Almost any string that you write in your templates will end up being ...

Get Django Project Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.