Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I check in *.mo files?

Tags:

Should I check in *.mo translation files into my version control system?

This is a general question. But in particular I'm working on Django projects with git repositories.

like image 968
muhuk Avatar asked Jun 10 '09 09:06

muhuk


People also ask

What is a .MO file?

Binary data file that contains object data referenced by a program; typically used to translate program code; may be loaded or imported into the GNU gettext program. Since MO files are binary in nature, they are not human readable like . PO files.

How do I read a .MO file?

Simply double click a file to launch it instantly in Poedit. Because POT, . PO and . MO files are standard translation and language files, the Poedit software automatically lists the original string along with the translation.


2 Answers

The general answer is:
if you do need those files to compile or to deploy (in shot: to "work" with) your component (set of files queried from your VCS), then yes, they should be stored in it (here: in Git).
This is the same for other kind of files (like project files for instance)

.mo files are particular:

django-admin.py compilemessages utility. 

This tool runs over all available .po files and creates .mo files, which are binary files optimized for use by gettext

Meaning:

  • you should be able to rebuild them every time you need them (guarantying in effect that they are in synch with their .po couterparts)
  • Git is not so good with binary storage and that would avoid it to store a full version for every changes

So the specific answer is not so clear-cut:

  • if your po files are stables and will not evolve too often, you could definitively store the .mo file
  • you should absolutely store a big README file explaning how to generate mo from po files.
like image 195
VonC Avatar answered Sep 25 '22 15:09

VonC


The general answer is to not store generated contents in version control.

You can include it in tarball, if it requires rare tools, or even have separate repository or disconnected branch with only those generated files (like 'html' and 'man' branches in git.git repository).

like image 35
Jakub Narębski Avatar answered Sep 25 '22 15:09

Jakub Narębski