You are here

19 May 2016

This snippet shows you how to convert po files to mo files. Po is the raw plain-text translation file with key value storage format. Mo files are compiled po files, binary format allows you to read faster. Po file can be saved to version control and mo is better for caching, so you don't have to interpret it on every load.

Source code viewer
  1. import polib
  2.  
  3. languages = [
  4. 'en_GB',
  5. 'ru_RU',
  6. ]
  7.  
  8. for lang in languages:
  9. po = polib.pofile(lang + '/CORE.po')
  10. po.save_as_mofile(lang + '/CORE.mo')
  11.  
Programming Language: Python