MCPcopy
hub / github.com/django/django / watch_for_translation_changes

Function watch_for_translation_changes

django/utils/translation/reloader.py:9–22  ·  view source on GitHub ↗

Register file watchers for .mo files in potential locale paths.

(sender, **kwargs)

Source from the content-addressed store, hash-verified

7
8
9def 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
25def translation_file_changed(sender, file_path, **kwargs):

Callers 6

test_i18n_disabledMethod · 0.90
test_i18n_enabledMethod · 0.90
test_i18n_app_dirsMethod · 0.90

Calls 4

is_django_moduleFunction · 0.90
extendMethod · 0.80
get_app_configsMethod · 0.80
watch_dirMethod · 0.80

Tested by 6

test_i18n_disabledMethod · 0.72
test_i18n_enabledMethod · 0.72
test_i18n_app_dirsMethod · 0.72