Management Commands
Regenerate and compile the web console’s gettext message catalogs.
- smarter.apps.dashboard.management.commands.update_console_messages.CONSOLE_MESSAGES_DIR = PosixPath('console/i18n')
Where
scripts/fetch_console.pyinstallsmessages.js, the web console’s messages, relative to the project root.Each release of smarter-sh/smarter-console carries it, and
make consoleinstalls the pinned release’s. makemessages reads only this directory for the djangojs domain.
- class smarter.apps.dashboard.management.commands.update_console_messages.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]
Bases:
SmarterCommandDjango manage.py update_console_messages command.
Regenerates
smarter/smarter/locale/<language>/LC_MESSAGES/django.po, from the Django templates and Python code, anddjangojs.po, from the web console’s messages inconsole/i18n/messages.js, for each language insettings.LANGUAGES, then compiles them to.mofiles. A regional language code is written to its locale name’s directory, e.g.pt-brtolocale/pt_BR. Translations already in the.pofiles are kept.make consoleinstalls the pinned console release’smessages.jsfirst, andmake i18n-messagesruns this command in the smarter-api container. Withoutmessages.js, it exits with an error that says so.- add_arguments(parser)[source]
Add the
--languageand--no-compileoptions.- Parameters:
parser – The command’s argument parser.
- handle(*args, **options)[source]
Regenerate django.po and djangojs.po for each language, then compile them unless
--no-compile.Runs
makemessagesfrom the project root and from the React messages directory, and restores the working directory afterwards.- Parameters:
options – The command’s options:
languages,no_compileandverbosity.
- 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 = ['console', 'react', 'static', 'staticfiles', 'node_modules', 'requirements', 'venv']
Directories, under the project root, that makemessages skips for the django domain.
The web console’s messages (the djangojs domain), and static and third-party files, which hold no messages of Django’s own.
[ 'console', 'react', 'static', 'staticfiles', 'node_modules', 'requirements', 'venv', ]