Skip to content

Backend localization fails due to missing compilemessages in build stage #12188

Closed

Description

@geekcj12

Please verify that this bug has NOT been raised before.

  • I checked and didn't find a similar issue

Describe the bug*

I am writing to report a localization gap in the standard Docker deployment, which causes the application to fail to render localized text (such as field label and help_text served by the backend API) when switching to any language other than English.

Root Cause:
After digging into the git history, I found that commit d557d2d modified the invoke update command and decoupled the localization generation logic from it. I assume the intention was to keep the container runtime environment clean and stateless, preventing the container from modifying source artifacts during startup (which makes total sense).

However, because *.mo files are excluded by .gitignore, removing this step from the runtime lifecycle without introducing it to the Docker image build stage (Dockerfile) leaves the localization pipeline uncompleted. In a production container environment, the backend currently has no way to serve compiled translation binaries out-of-the-box.

Steps to Reproduce

  1. Deploy InvenTree using the standard Docker / Docker-compose environment.
  2. Switch the application language to any language other than English (e.g., German, French, or Chinese).
  3. Inspect any dynamically rendered form and check its backend API response. (e.g., OPTIONS /api/part/)
  4. Notice that fields fallback to English because the backend cannot load .mo translations.
  5. Manually run python manage.py compilemessages inside the backend container and restart it, the translations instantly load correctly.

Expected behaviour

To close this loop while respecting the philosophy of keeping runtime clean, the translation messages should be compiled during the Docker image build phase in the Dockerfile (e.g., RUN python manage.py compilemessages or via an equivalent invoke task during multi-stage build).

Before I open a Pull Request to fix this, I wanted to check in with the team to confirm your thoughts: Is this an overlooked gap from the previous refactoring, or is there an alternative preferred pattern for handling production i18n in InvenTree Docker images?

Deployment Method

Docker

Version Information

Inventree Version: 1.3.5

Try to reproduce on the demo site

I tried to reproduce

Is the bug reproducible on the demo site?

Reproducible

Relevant log output

Activity

  1. added
    bug
    question
    triage:not-checked
    on Jun 17, 2026
  2. added
    docker
    setup
    and removed
    triage:not-checked
    on Jun 17, 2026
  3. SchrodingersGat commented on Jun 17, 2026

    @SchrodingersGat
    Member

    @geekcj12 thanks for raising this issue - this is an oversight, and certainly not intentional. The compiled translations should 100% be available in "off the shelf" docker image.

    If you are able to submit a fix for this, that's great. It would be good also to add a unit test to ensure that the message files are present in the built image

  4. added this to the 1.4.0 milestone on Jun 17, 2026
  5. geekcj12 commented on Jun 18, 2026

    @geekcj12
    ContributorAuthor

    Thanks for the quick confirmation. It makes total sense to ensure this with a unit test. I am on it—I'll implement the fix in the Dockerfile and add a corresponding test case to assert that the compiled translation assets are present. Will open a PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdockerquestionsetup

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions