Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Django what is i18n?

Tags:

django

I'm looking at someone else's Django registration templates and I see the line {% load i18n %} in every file. What is i18n?

I know it has something to do with International and localization, but could someone explain it and give a detailed example? Thanks.

like image 656
hobbes3 Avatar asked Mar 08 '12 21:03

hobbes3


People also ask

What is i18n Django?

{% load i18n %} is needed for internationalization. The purpose of internationalization is to allow a single application to read in multiple languages. In order to do this: you need a few hooks called translation strings. To give your template access to these tags, put {% load i18n %} toward the top of your template..

Why is i18n important?

A successful i18n effort ensures that your app, website, or software is ready to be localized to meet the needs of different regional markets. Effective i18n allows you to translate and update every piece of text without changing the source code.

What is i18n localization?

Internationalization (sometimes shortened to "I18N , meaning "I - eighteen letters -N") is the process of planning and implementing products and services so that they can easily be adapted to specific local languages and cultures, a process called localization .


2 Answers

It loads translation tags such as {% trans "Text" %} that could be used in template. If you do not use it you can remove {% load i18n %}

When you use trans tag for all text that is not dynamic in templates you can then collect all such strings by running ./manage.py makemessages which creates .po file that would be used for translation.

like image 144
Marius Grigaitis Avatar answered Sep 23 '22 02:09

Marius Grigaitis


{% load i18n %} is needed for internationalization. The purpose of internationalization is to allow a single application to read in multiple languages. In order to do this: you need a few hooks called translation strings. To give your template access to these tags, put {% load i18n %} toward the top of your template..

Refer to this for more info: https://docs.djangoproject.com/en/1.10/topics/i18n/

like image 20
lakshmen Avatar answered Sep 22 '22 02:09

lakshmen