Ok so I'm writing an international Django app, And the docs for doing localization are great except I can't seem to find a complete list of the supported languages anywhere. Where are they? What I really want to do is use the list to populate choices on a model, so if there is a way to get this programmatically that would be best.
Thanks!
Straight from the source. All languages Django (trunk) offers translations for.
http://code.djangoproject.com/browser/django/trunk/django/conf/locale
Cleaning up the pieces of answers:
from django.conf.global_settings import LANGUAGES
class MyModel(models.Model)
my_field = CharField(max_length=7, choices=LANGUAGES)
and you can see the code directly: global_settings and locale/__init__.py
For more complete instructions on how to build a more extensive list, check out the W3C Language Tag Page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With