Register file watchers for .mo files in potential locale paths.
(sender, **kwargs)
| 7 | |
| 8 | |
| 9 | def watch_for_translation_changes(sender, **kwargs): |
| 10 | """Register file watchers for .mo files in potential locale paths.""" |
| 11 | from django.conf import settings |
| 12 | |
| 13 | if settings.USE_I18N: |
| 14 | directories = [Path("locale")] |
| 15 | directories.extend( |
| 16 | Path(config.path) / "locale" |
| 17 | for config in apps.get_app_configs() |
| 18 | if not is_django_module(config.module) |
| 19 | ) |
| 20 | directories.extend(Path(p) for p in settings.LOCALE_PATHS) |
| 21 | for path in directories: |
| 22 | sender.watch_dir(path, "**/*.mo") |
| 23 | |
| 24 | |
| 25 | def translation_file_changed(sender, file_path, **kwargs): |