Skip to content

QuickBook Format Handler (formats/quickbook.py) #5

@whisper67265

Description

@whisper67265

Problem

Weblate needs a registered monolingual format so .qbk files can be opened, converted to a translation store, and written back using the same patterns as other ConvertFormat types (for example AsciiDoc). Without a dedicated handler, QuickBook sources cannot participate in the normal Weblate convert workflow.

Acceptance Criteria

  • QuickBookFormat subclasses Weblate’s ConvertFormat and declares name, autoload patterns (*.qbk), format_id, and monolingual.
  • convertfile builds a store from uploaded .qbk bytes via the shared QuickBook parser utilities and respects duplicate handling (msgctxt vs merge) when merge_duplicates is set in format params.
  • save_content reconstructs .qbk output from the current store plus a template store (raises clearly if the template is missing), matching the expected Weblate convert round-trip contract.
  • mimetype / extension return sensible values for QuickBook.
  • boost_weblate.formats.__all__ exposes QuickBookFormat for discovery/registration.

Implementation Notes

  • Keep the class thin: delegate parsing to QuickBookFile and serialization to QuickBookTranslator from boost_weblate.utils.quickbook.
  • Mirror control flow and responsibilities of upstream ConvertFormat usage (see Weblate’s AsciiDocFormat / convert tests for precedent).
  • Use NamedBytesIO (or equivalent) so the parser receives a file-like object with the raw template bytes.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions