2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-04-04 10:31:03 +00:00

fix(i18n): compile backend translations during update (#11613)

* fix(i18n): compile backend translations during update

* fix(i18n): make backend translation compile optional in update

* ci: add fork ghcr publish workflow

* fix(ci): use valid docker build-push action ref

* ci: add gcp deploy workflow via iap ssh

* Delete .github/scripts/deploy_inventree_remote.sh

* Delete .github/workflows/fork_deploy_gce.yaml

* Delete .github/workflows/fork_publish_ghcr.yaml

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
HuaYangTian
2026-03-31 10:02:54 +08:00
committed by GitHub
parent d5fdedff4a
commit d557d2dff9

View File

@@ -796,6 +796,15 @@ def translate(c, ignore_static=False, no_frontend=False):
success('Translation files built successfully') success('Translation files built successfully')
@task
@state_logger('backend_trans')
def backend_trans(c):
"""Compile backend Django translation files."""
info('Compiling backend translations')
manage(c, 'compilemessages')
success('Backend translations compiled successfully')
@task( @task(
help={ help={
'clean': 'Clean up old backup files', 'clean': 'Clean up old backup files',
@@ -962,6 +971,8 @@ def showmigrations(c, app=''):
post=[clean_settings], post=[clean_settings],
help={ help={
'skip_backup': 'Skip database backup step (advanced users)', 'skip_backup': 'Skip database backup step (advanced users)',
'backend': 'Force backend translation compilation step (ignores INVENTREE_DOCKER)',
'no_backend': 'Skip backend translation compilation step',
'frontend': 'Force frontend compilation/download step (ignores INVENTREE_DOCKER)', 'frontend': 'Force frontend compilation/download step (ignores INVENTREE_DOCKER)',
'no_frontend': 'Skip frontend compilation/download step', 'no_frontend': 'Skip frontend compilation/download step',
'skip_static': 'Skip static file collection step', 'skip_static': 'Skip static file collection step',
@@ -972,6 +983,8 @@ def showmigrations(c, app=''):
def update( def update(
c, c,
skip_backup: bool = False, skip_backup: bool = False,
backend: bool = False,
no_backend: bool = False,
frontend: bool = False, frontend: bool = False,
no_frontend: bool = False, no_frontend: bool = False,
skip_static: bool = False, skip_static: bool = False,
@@ -985,6 +998,7 @@ def update(
The following tasks are performed, in order: The following tasks are performed, in order:
- install - install
- backend_trans (optional)
- backup (optional) - backup (optional)
- migrate - migrate
- frontend_compile or frontend_download (optional) - frontend_compile or frontend_download (optional)
@@ -996,6 +1010,16 @@ def update(
# Ensure required components are installed # Ensure required components are installed
install(c, uv=uv) install(c, uv=uv)
# Skip backend translation compilation on docker, unless explicitly requested.
# Users can also forcefully disable the step via `--no-backend`.
if (is_docker_environment() and not backend) or no_backend:
if no_backend:
info('Skipping backend translation compilation (no_backend flag set)')
else:
info('Skipping backend translation compilation (INVENTREE_DOCKER flag set)')
else:
backend_trans(c)
if not skip_backup: if not skip_backup:
backup(c) backup(c)
@@ -2255,6 +2279,7 @@ internal = Collection(
) )
ns = Collection( ns = Collection(
backend_trans,
backup, backup,
export_records, export_records,
frontend_download, frontend_download,