Django internationalization and localization

2455
0

Django's i18n framework supports multiple languages. I mark strings for translation with gettext() or _(). The makemessages command extracts strings to .po files. Translators fill in translations, then compilemessages creates binary .mo files. I use {% trans %} and {% blocktrans %} in templates. The LocaleMiddleware sets language from URL prefix, cookie, or Accept header. For dates and numbers, I use l10n formatting. This enables global reach without code duplication per language.