def test_is_django_module(self): for module, expected in ( (pytz, False), (sys, False), (autoreload, True) ): with self.subTest(module=module): self.assertIs(autoreload.is_django_module(module), expected)
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() 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")