Ticket #18395: 18395-1.diff

File 18395-1.diff, 686 bytes (added by Claude Paroz, 12 years ago)

Reset translation global variables with setting_changed

  • django/test/signals.py

    diff --git a/django/test/signals.py b/django/test/signals.py
    index 81808df..d7d63e3 100644
    a b def update_connections_time_zone(**kwargs):  
    4646def clear_context_processors_cache(**kwargs):
    4747    if kwargs['setting'] == 'TEMPLATE_CONTEXT_PROCESSORS':
    4848        context._standard_context_processors = None
     49
     50
     51@receiver(setting_changed)
     52def language_changed(**kwargs):
     53    if kwargs['setting'] in ('LOCALE_PATHS', 'LANGUAGE_CODE'):
     54        from django.utils.translation import trans_real
     55        trans_real._default = None
     56        if kwargs['setting'] == 'LOCALE_PATHS':
     57            trans_real._translations = {}
Back to Top