Opened 8 years ago
Last modified 2 years ago
#23321 new Cleanup/optimization
Remove .mo files from the Django Git repository
Reported by: | Claude Paroz | Owned by: | nobody |
---|---|---|---|
Component: | Internationalization | Version: | dev |
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 |
Description
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 (8)
comment:1 Changed 8 years ago by
Cc: | slav0nic@… added |
---|
comment:2 Changed 8 years ago by
comment:3 Changed 8 years ago by
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 8 years ago by
Here's a branch where I started working on this: https://github.com/claudep/django/tree/23321
comment:6 Changed 8 years ago by
Triage Stage: | Accepted → 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 7 years ago by
Patch needs improvement: | set |
---|---|
Triage Stage: | Ready for checkin → 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 trans_real.py
- 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.
comment:8 Changed 2 years ago by
On the repo size issue, for some occasions I've taken to cloning using the depth
option, which restricts the fetched history. e.g. --depth=1000
is more than enough for a lot of cases. Perhaps we could add that as an example to the docs, so that folks don't need to clone the whole history. (?)
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.