Allow adding custom lines to xgettext POT header
Describe the problem
My scripts for .pot generation were injecting "Copyright (C)" and "SPDX-License-Identifier:" lines into .pot file using --copyright-holder xgettext flag and some postprocessing with sed.
Ideally, I'd want to add the same lines to Weblate-generated .pot file.
Solution brainstorm
Support for --copyright-holder flag alone would be better than the current situation (no way to customize the header at all), but it'll generate "Copyright (C) YEAR" instead of "Copyright (C) 2026".
Weblate already supports templates in multiple places (for example, commit messages and pull request descriptions). Ideally, I'd want a template that gets rendered (with "current year" supported as macro) and inserted into .pot file header comment.
Describe alternatives you have considered
Just not have the comment, add metadata in REUSE.toml/*.pot.license instead
Screenshots
No response
Additional context
This is primarily to comply with REUSE spec, with minimal number of extra metadata files
Hi @amezin, thanks for the detailed writeup and the alternatives you've considered!
I'd be interested in working on this once there's some direction on the preferred approach. A couple of questions to help me get started the right way:
Would the Weblate maintainers prefer the simpler --copyright-holder flag support first, even knowing it won't fully solve the "current year" formatting issue, as a smaller first step? Or is the templating approach (reusing the existing template system used for commit messages/PR descriptions) the preferred long-term direction? If templating is preferred, is there a specific example elsewhere in the codebase you'd point me to as a reference implementation to follow?
Happy to take this on once there's a decision on direction — let me know if it's alright to proceed once triaged.
weblate.utils.render.render_template is the helper to use for templating. I think that supporting this is the right direction rather than using the xgettext flag.