Django internationalization language codes


Question

Where can I find list of languages and language_code like this.

(Swedish,sv)
(English,en)
1
29
10/18/2014 11:16:45 AM

Accepted Answer

15
7/8/2010 6:06:53 AM

If you want something you can use from within django, try:

from django.conf import settings

this will be in the format above, making it perfect for assignment in one of your models choices= fields. (i.e. user_language = models.CharField(max_length=7, choices=settings.LANGUAGES))

LANGUAGES = (
    ('ar', gettext_noop('Arabic')),
    ('bg', gettext_noop('Bulgarian')),
    ('bn', gettext_noop('Bengali')),
    etc....
    )

Note about using settings:

Note that django.conf.settings isn’t a module


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon