MCPcopy
hub / github.com/django/django / update_catalogs

Function update_catalogs

scripts/manage_translations.py:207–227  ·  view source on GitHub ↗

Update the en/LC_MESSAGES/django.po (main and contrib) files with new/updated translatable strings.

(resources=None, languages=None, verbosity=0)

Source from the content-addressed store, hash-verified

205
206
207def update_catalogs(resources=None, languages=None, verbosity=0):
208 """
209 Update the en/LC_MESSAGES/django.po (main and contrib) files with
210 new/updated translatable strings.
211 """
212 settings.configure()
213 django.setup()
214 if resources is not None:
215 print("`update_catalogs` will always process all resources.")
216 contrib_dirs = _get_locale_dirs(None, include_core=False)
217
218 os.chdir(os.path.join(os.getcwd(), "django"))
219 print("Updating en catalogs for Django and contrib apps...")
220 call_command("makemessages", locale=["en"], verbosity=verbosity)
221 print("Updating en JS catalogs for Django and contrib apps...")
222 call_command("makemessages", locale=["en"], domain="djangojs", verbosity=verbosity)
223
224 # Output changed stats
225 _check_diff("core", os.path.join(os.getcwd(), "conf", "locale"))
226 for name, dir_ in contrib_dirs:
227 _check_diff(name, dir_)
228
229
230def lang_stats(resources=None, languages=None, verbosity=0):

Callers

nothing calls this directly

Calls 6

call_commandFunction · 0.90
_get_locale_dirsFunction · 0.85
_check_diffFunction · 0.85
configureMethod · 0.80
setupMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected