Reputation: 8525
I am trying to get in my views.py
a list of all the languages I have available.
This is easily done in a template through the tag
{% get_available_languages as LANGUAGES %}
(docs here), but I do not find its equivalent for the views.
Is there any simple way to get it?
Upvotes: 6
Views: 2227
Reputation: 2004
from django.conf import settings
settings.LANGUAGES
anyways you have to config LANGUAGES
in settings before like this:
from django.utils.translation import ugettext_lazy as _
LANGUAGES = [
('de', _('German')),
('en', _('English')),
]
Upvotes: 9