Management Commands

Regenerate and compile the web console’s gettext message catalogs.

class smarter.apps.dashboard.management.commands.update_console_messages.Command(*args, **kwargs)[source]

Bases: SmarterCommand

Django manage.py update_console_messages command.

Regenerates smarter/smarter/locale/<language>/LC_MESSAGES/django.po, from the Django templates and Python code, and djangojs.po, from the React apps’ messages in react/i18n/messages.js, for each language in settings.LANGUAGES, then compiles them to .mo files. Translations already in the .po files are kept.

Run npm run i18n:extract in smarter/react first, or make i18n-messages, which does both.

add_arguments(parser)[source]

Entry point for subclassed commands to add custom arguments.

handle(*args, **options)[source]

Handle the command execution.

help = "Regenerate the web console's message catalogs, django.po and djangojs.po, in smarter/smarter/locale, for each language in settings.LANGUAGES, and compile them."
smarter.apps.dashboard.management.commands.update_console_messages.DJANGO_IGNORE_PATTERNS = ['react', 'static', 'staticfiles', 'node_modules', 'requirements', 'venv']

the.

React workspace (the djangojs domain), and static and third-party files, which hold no web console messages.

['react', 'static', 'staticfiles', 'node_modules', 'requirements', 'venv']
Type:

Directories, under the project root, that makemessages skips for the django domain

smarter.apps.dashboard.management.commands.update_console_messages.REACT_MESSAGES_DIR = PosixPath('react/i18n')

Where npm run i18n:extract writes messages.js, the React apps’ messages, relative to.

the project root. makemessages reads only this directory for the djangojs domain.