I want to propose/discuss a possibility to add an i18n support for python-social-auth
Here's my patch with some notes
I just want to be sure, that I'm moving in right direction and there's a possibility for merge it with base project.
What I did:
I discovered a Strategy class and subclasses for each web framework, and decided to put internationalization stuff in this class. And these strategies are injected everywhere in library core
In base class I created a method ugettext, which, by default, just return a string, that was passed as only argument
In Django subclass (I have no much experience with other supported frameworks) I overrode it with Django's own ugettext function
I wrapped each message (all messages, that I could find) with backend.strategy.ugettext (or similar), so they are translated
For default django app I manually created django.po file with translations for Russian language
Other frameworks should provide their ugettext implementation and translation resources
I want to propose/discuss a possibility to add an i18n support for
python-social-auth
Here's my patch with some notes
I just want to be sure, that I'm moving in right direction and there's a possibility for merge it with base project.
What I did:
I discovered a
Strategy
class and subclasses for each web framework, and decided to put internationalization stuff in this class. And these strategies are injected everywhere in library coreIn base class I created a method
ugettext
, which, by default, just return a string, that was passed as only argumentIn
Django
subclass (I have no much experience with other supported frameworks) I overrode it with Django's ownugettext
functionI wrapped each message (all messages, that I could find) with
backend.strategy.ugettext
(or similar), so they are translatedFor default django app I manually created
django.po
file with translations for Russian languageOther frameworks should provide their
ugettext
implementation and translation resourcesAnd it all works as expected