Translate country names to match browser language preference

326 Views Asked by At

I want Azerbaijan to show up in the browser as as Azerbaïdjan (French spelling).

1) I placed the django_countries dir (downloaded from https://pypi.python.org/pypi/django-countries) in my project root.

2) added "django_countries" to my INSTALLED_APPS

3) added "from django.utils.translation import ugettext_lazy as _ " in my app1/forms.py

4) changed the following (in the forms.ModelForm subclass):

def clean_name(self): return self.cleaned_data['name'] to:

def clean_name(self): return _(self.cleaned_data['name'])

5) changed the language preference in Chrome to French

What am I missing? Thanks

1

There are 1 best solutions below

0
On