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
- import polib
- languages = [
- for lang in languages:
- po = polib.pofile(lang + '/CORE.po')
- po.save_as_mofile(lang + '/CORE.mo')
- Programming Language: Python