django app with different and dynamic translation files

594 views Asked by At

currently I'm working over a task, which require every Django user to have different locale file and translation of course e.g. different translation for the same app.

I'm tried to do some changes on my own scenario and the next lines are finished and works fine but I also met some troubles

  1. whole app is translated on english and german

  2. when I create new user, I copy default translation file .po to new directory related to this user. For this case I made container app which hold all custom translation and directory with schema like this 'apps/trans/locale/user1/', 'apps/trans/locale/user2/' and so on. these paths are added into settings.LOCALE_PATHS when app is started.

  3. I have implemented rosetta into my Django admin and display correct .po file for all of them (custom .po)

  4. The Django tempalatetags i18n.py was copied into my teplatetags directory and was extended for my purpose

I also want to do some custom modification into django.core.translation module and I also copy this file into my project, but now I do not know how to load this module correctly to override the default Django functionality, because I want to replace the default translation with custom here

for now I use _ _ import _ _ and then I just replace sys.modules['django.utils.translation'] with my module. is this a correct way?

So anyone with idea?

Thanks

0

There are 0 answers