diff options
| author | Tom Forbes <tom@tomforb.es> | 2020-04-18 21:32:19 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-05-04 09:13:47 +0200 |
| commit | c00bc27945d195295101c695e2a901b06b10fe96 (patch) | |
| tree | 1b479c0b9279ba94a124d8862f2aacaaede192a5 /django/utils/translation | |
| parent | 8f10ceaa907f3f608494f782f65070d0bb8b9587 (diff) | |
Refs #30372 -- Stopped watching built-in Django translation files by auto-reloader.
Diffstat (limited to 'django/utils/translation')
| -rw-r--r-- | django/utils/translation/reloader.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/django/utils/translation/reloader.py b/django/utils/translation/reloader.py index 41d0623568..0e5a83699d 100644 --- a/django/utils/translation/reloader.py +++ b/django/utils/translation/reloader.py @@ -5,13 +5,22 @@ from asgiref.local import Local from django.apps import apps +def _is_django_module(module): + """Return True if the given module is nested under Django.""" + return module.__name__.startswith('django.') + + def watch_for_translation_changes(sender, **kwargs): """Register file watchers for .mo files in potential locale paths.""" from django.conf import settings if settings.USE_I18N: directories = [Path('locale')] - directories.extend(Path(config.path) / 'locale' for config in apps.get_app_configs()) + directories.extend( + Path(config.path) / 'locale' + for config in apps.get_app_configs() + if not _is_django_module(config.module) + ) directories.extend(Path(p) for p in settings.LOCALE_PATHS) for path in directories: sender.watch_dir(path, '**/*.mo') |
