Opened 2 years ago

Last modified 21 months ago

#23321 new Cleanup/optimization

Remove .mo files from the Django Git repository

Reported by: claudep Owned by: nobody
Component: Internationalization Version: master
Severity: Normal Keywords:
Cc: slav0nic@… Triage Stage: Someday/Maybe
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no


Binary/generated files are no good candidates to be included in a Git repository. They unnecessarily bloat the repository without added value.
It would be nice to compile those .mo files at package build time.

Change History (7)

comment:1 Changed 2 years ago by slav0nic

  • Cc slav0nic@… added

comment:2 Changed 2 years ago by aaugustin

That change would make it a bit more error-prone to work on i18n'd projects with the development version of Django.

I'm not saying we can't remove the .mo files, but we need to think about the consequences. They add some value.

comment:3 Changed 2 years ago by claudep

I think it would be possible to check the presence of .mo files in runserver and output an appropriate warning. I understand the commodity of having .mo files in the repo, but I don't think this justifies having generated binary files in a VCS.

comment:4 Changed 23 months ago by claudep

Here's a branch where I started working on this:

comment:6 Changed 23 months ago by timgraham

  • Triage Stage changed from Accepted to Ready for checkin

Code looks fine to me, but would be good to get an opinion from another person familiar with translations too.

comment:7 Changed 21 months ago by jezdez

  • Patch needs improvement set
  • Triage Stage changed from Ready for checkin to Someday/Maybe

I don't think we should go that route as it would introduce a couple of issues that make it harder for our users and from a maintenance standpoint:

  • The most pressing issues IMO will show up for users that are using not-yet-released versions of Django, e.g. translators and contributors.
    • there are differences in gettext versions that we would not be able to fix
    • Windows users don't usually have gettext installed
  • The test system would have to compile the po files on every test run to make sure to have a consistent set to base tests on
  • Users on system with a non-writable file system may have problems with the subprocess call as part of
  • The Django release manager would have to have gettext installed and run an additional command to build the tarball, something that I think is better suited for the translation manager (who has to pull files from Transifex anyways)

I understand that having compiled files in a VCS aren't good, but the proposed plan doesn't convince me to drop the mo files.

If only we'd use Babel instead.. it does have the ability to compile po files to mo files without dependency on gettext.

Note: See TracTickets for help on using tickets.
Back to Top