jonge-democraten / website

JD website
https://jongedemocraten.nl
MIT License
6 stars 2 forks source link

Where possible, language/localization should be set to 'Dutch' #143

Closed Pi2048 closed 8 years ago

Pi2048 commented 8 years ago

Especially on frontend.

Pi2048 commented 8 years ago

Most frontend effects have been resolved by setting LANGUAGE_CODE = "nl_NL" in local_settings.py. Some noted exceptions: the date format in occurrence_detail.html (because of a hard-coded format in the template tag code of fullcalendar) and the form fields date_of_birth and date.

Pi2048 commented 8 years ago

By using USE_L10N = True in local_settings.py, I made the form date fields work in 'Dutch' localization as well. All that remains for the frontend is the dates in the occurrence_detail.html template.

Pi2048 commented 8 years ago

I changed the localization in the occurrence_duration template tag to obey mezzanine.LANGUAGE_CODE. The date is now set in Dutch.

Pi2048 commented 8 years ago

The code works, but the tests fail because of our internationalization settings. See https://travis-ci.org/jonge-democraten/website/builds/87356173 for details. The problem is the redirects for internationalization, which yield a 302 instead of a 404 directly. I do not fully understand how the system works, so I am reluctant to change the test without understanding it.

bartromgens commented 8 years ago

http://jd.local:8000/admin/ redirects to http://jd.local:8000/en-us/admin/ now that the LANGUAGE_CODE is set correctly. This is why the unit tests fail. I will fix the tests by setting follow=True such that the tests follow the redirect.

Let me know if you still have questions on how this works.

bartromgens commented 8 years ago

@Pieter1024: The Django documentation of LANGUAGE_CODE, https://docs.djangoproject.com/en/1.8/ref/settings/#language-code, says that "USE_I18N must be active for this setting to have any effect.". However, we have USE_I18N = False in our settings.py. Any idea why this works anyway? Is it overruled by Mezzanine? I found something that might set it in mezzanine.utils.conf.set_dynamic_settings(). May be it. Not important, although we may just set it to True in our settings.py for clarity, if we use it.

Pi2048 commented 8 years ago

No, I have no idea why this may be the case. I felt poorly equipped to handle this myself, so I am glad that you have stepped in.

Pi2048 commented 8 years ago

I consider this issue closed, as I have just confirmed the tests are working again :).