pennersr/django-allauth — pull request #74 by facugaich (2012-07-05 22:02:54+00:00)
Title: Customizing Facebook JS-SDK locale, take two

Hi, it took me a while and some rebasing but I've finished the locale customization system.

The setting, `LOCALE_FUNC`, can take either a callable or a path to a callable. (As TODOed in the code, the logic for dynamic callable importing should be factored out in the future).

Then, the locale can be inferred from the request using `facebook_provider.get_locale_from_request(request)`. I took care to cache the callable and to only load the default mapping if it is required.

Probably the most, erm, controversial addition is that of the FacebookLocales.xml file itself, plus the logic for parsing it. At first I had written the parsing logic just to take its output and paste a giant dict directly into the code. Then I realized I had to commit the parsing logic somewhere so the language choices could be updated. So I thought that, given that the parsing logic is already in the code and having an XML is not that much different from having a giant static dict, having the original file itself makes it much easier to maintain, you just update it. Lastly, as I said before, this file is only read and parsed if the default locale mapping is in effect.

Tell me what you think,
Facundo