Hello gettext, I'm looking into using gettext in a PHP project. A good portion of messages can be translated already. Extracting messages from PHP files is the easy part, because xgettext supports it directly. Template files using Twig syntax are a little harder, because they need to be compiled to PHP first, but its feasible and working already (a script compiles Twig files to PHP in a temporary directory and invokes xgettext on generated PHP files).
The remaining pieces are messages from a MySQL database and for that I would like to know your opinion about the best approach. On the web is an example[1] which writes translatable messages directly to a .po file. That's certainly doable for me, though surely it's better to let xgettext be the sole creator of .po files instead of a home brew solution? Instead, I could imagine writing to a JSON file that simply lists the messages like this: [ "Greece", "Nice and sunny", "Spain", "Just as nice and sunny" ] This file can be consumed by xgettext because JSON is a subset of JavaScript. A configuration file (YAML) lists columns which contain translatable messages and helps the JSON writing program build SQL queries. my_db: country: - name - title While I could hack at this right away, I'm wondering whether someone came up with a better solution I haven't dug up. Best regards, Aljosha Papsch [1] https://github.com/phpmyadmin/phpmyadmin/blob/master/scripts/advisor2po -- Mit freundlichen Grüßen Aljosha Papsch IT Wine-Logistix GmbH Eine Marke der Vinexus - Gruppe Perchstetten 5 35428 Langgöns Germany Tel.: +49 6403 / 504 6984 Fax: +49 6403 / 96 810 440 mailto:aljosha.pap...@vinexus.eu http://www.vinexus.de - .ch .nl .dk .eu Vinexus Wein Welten 2015 - Über 400 Weine aus aller Welt verkosten Alle Informationen finden Sie hier: www.vinexus.de/messe <http://www.vinexus.de/messe> Registergericht, Handelsregisternummer: Gießen, HRB 6789 Geschäftsführer: Ramona Stoll Diese E-Mail sowie jeglicher Anhang sind vertraulich und ausschließlich für den/die bezeichneten Adressaten bestimmt. Diese Mitteilung kann rechtlich geschützte, firmeninterne oder anderweitig vertrauliche Informationen enthalten, deren Weitergabe ohne unsere Zustimmung strengstens untersagt ist. Sofern Sie nicht der beabsichtigte Adressat sind oder diese E-Mail irrtümlich erhalten haben, sind Sie nicht autorisiert, diese Mitteilung bekannt zu machen, zu kopieren, weiterzugeben oder aufzubewahren. Bitte informieren Sie uns in diesem Fall unverzüglich und vernichten diese E-Mail. The information in this e-mail and in any attachments is confidential and intended solely for the attention and use of the named addressee(s). This information may be subject to legal, professional or other privilege and further distribution of it is strictly prohibited without our authority. If you are not the intended recipient, you are not authorised to and must not disclose, copy, distribute, or retain this message or any part of it, and should notify us immediately. This footnote also confirms that this email has been automatically scanned for the presence of computer viruses, profanities and certain file types.