I started trying to translate a few of the most used text entries in a C program using gettext, but when digging into this I got a little bit confused about all the different file formats since there seems to be some overlap in functionality?
I would like get an overview of the different formats
.po
.pot
.mo
.gmo
and learn
(1) I know that msgunfmt can convert from .mo to .po, but since .mo is the final end format I assume this is not a lossless process. I.e. if I convert from hello1.mo to hello2.po and then convert from hello2.po to hello3.mo, I assume that hello1.mo and hello3.mo will contain identical language strings but that some meta information will be lost along the way, right?
In computing, gettext is an internationalization and localization (i18n and l10n) system commonly used for writing multilingual programs on Unix-like computer operating systems. One of the main benefits of gettext is that it separates programming from translating.
po files means Portable Object, to distinguish it from . mo files, where MO stands for Machine Object.
gettext utilities are a set of tools that provides a framework to help other packages produce multi-lingual messages. The minimum version of the gettext utilities supported is 0.19.
The gettext module provides internationalization (I18N) and localization (L10N) services for your Python modules and applications. It supports both the GNU gettext message catalog API and a higher level, class-based API that may be more appropriate for Python files.
I could be wrong but:
.pot - human readable gettext template file - this what you would give to translator (person?).
.po - human readable gettext translated file based on POT - this is what translator gives you back.
.mo - machine readable code (bytecode?) to be used by PHP when doing actual translation. This format is what you would feed to php. It's a generic format understood by most programs but it might not support all gnu gettext features. This is where gmo comes in place.
.gmo - files ending with .gmo are really MO files, when it is known that these files use the GNU format.
You can use poedit to handle .pot -> .po -> .mo
more info
P.S. with that being said - only programmers would call formats like PO or XML a human-readable. also - you probably won't need to convert .mo to .po...well..At least this doesn't seem like a common scenario to me :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With