Export translations that were changed in Launchpad
Implementation of the blueprint export-changed-in-launchpad.
Analysis of existing code
There is already code to
- Export files in PO format
- Select only those files that where changed in Launchpad (for display)
Export of a PO file
Call Hierarchy
The cron script is doing this:
scripts.po_export_py.process_request:161 -> ITranslationExporter.getExporterProducingTargetFileFormat
pofile.zcml.subscriber:30 -> GettextPOExporter
scripts.po_export_py.process_request:183 -> generate_translatoinfiledata
scripts.po_export_py.generate_translatoinfiledata:149 -> ITranslationFileData(IPOFile)
pofile.zcml.adapter:23 -> POFileToTranslationFileDataAdapter
database.pofile.py.POFileToTranslationFileDataAdapter.init:1277 -> _getMessages
database.pofile.py.POFileToTranslationFileDataAdapter._getMessages:1359 -> get_pofile_rows
database.vpoexport.py.VPOExportSet.get_pofile_rows:117 -> _select
database.vpoexport.py.VPOExportSet.get_pofile_rows:94 -> cur.execute database.vpoexport.py.VPOExportSet.get_pofile_rows:97 -> yield VPOExport
scripts.po_export_py.process_request:182 -> exportTranslationFiles
- translationformat.gettext_po_exporter.exportTranslationFiles
Issues
- The export uses the POExport view and selects the relevant messages from in get_pofile_rows. This select could be adapted to retrieve only the changed rows.
- The ITranslationFormatExporter is selected using the file format but this has no influence on generate_translationfiledata. This information would have to be passed down to get_pofile_rows.
- A seperate ITranslationFormatExporter is needed for this because the file will ommit the header, and add a warning, too. This should share code with the existing POFormatExporter.
Selection of changed translations
POFile has a method getPOTMsgSetChangedInLaunchpad that returns a POTMsgSet with the relevant messages. This could be adapted to ITranslationFileData like POFile itself but then it would not use the export view. What is the difference between the view and the query in this method?