4

I've just discovered the .po and .mo files with Django.

They are used for internationalization and localization.

It looks like .po are plain text files whereas .mo are optimized byte compiled files from .po.

Process is always compiling to .mo after editing .po files.

What is the best option:

  1. Versionning only .po in git and have an automatic compilation from .po to .mo in the deployment process?
  2. Versionning both .po and .mo (maybe with a precommit hook for automatic compilation)?
Benjamin Toueg
  • 10,511
  • 7
  • 48
  • 79

1 Answers1

4

It is generally considered bad practice to version files that can be generated from the files already versioned, especially when those output files are binaries. It clutters the history with files Git is unable to version efficiently.

1ace
  • 5,272
  • 4
  • 23
  • 30
  • Agree. Oddly enough, the django ecosystem and the framework itself do deliberately version *.mo files! – N1ngu Aug 30 '23 at 14:16