I plan to allow users to create .POT / .PO files through the PHP user interface as part of the CMS solution. Once these files have been generated (easy bit), I would like to allow my system to automatically convert these files to .MO files in response to a user request (POST).
I saw the following question about SO:
.po to.mo convertor in php?
I understand that I could run msgfmt using the PHP exec() function, but this seems like a Linux-only solution, if I am right? How can I do this on other operating systems? Some sample code on how this can be done in practice will also be really helpful if someone is kind enough to demonstrate. This is very different from the work that I usually do!
This is only a concept at the moment, but I hope that I will go on the right line. If you have any additional thoughts / suggestions regarding this method, I would be glad to hear them. Reference information is provided.
Additional reference information - not required:
I extract the source text in English by analyzing simple template files that consist of no more than the main HTML code and calls to <?php _('the gettext method'); ?> <?php _('the gettext method'); ?> . These patterns are parsed during editing / saving and language records are retrieved. Then a .POT file will be created. Now the user will need to edit translations manually (via a simple interface, and not directly) to update / prepare all .PO files. Once this is done, I will need to convert them to .MO files, as well as the title of my question.
source share