feat(file_format_params): Gettext PO header configuration with file format parameters#18982
Conversation
gersona
commented
Apr 13, 2026
- Fixes Migrate gettext specific settings to file format parameters #16971
- Add file format params for .po file headers
- migrate set_language_team attribute to File format params
- documentation update
- update backup schema
|
Should the gettext file format parameters also apply to the headers set in the PO exporters? For example, |
|
|
Yes, exporters honor params since #18830 |
9d08c23 to
bc121b2
Compare
There was a problem hiding this comment.
Pull request overview
Adds Gettext PO/POT header configuration via component-level file format parameters, migrating away from the legacy project-level set_language_team setting, and updates related backup/schema/docs/test coverage.
Changes:
- Introduces new
po_*file format parameters to control PO/POT header updates (Language-Team, Last-Translator, X-Generator, Report-Msgid-Bugs-To). - Migrates existing
Project.set_language_teaminto componentfile_format_paramsand removes the project field + associated UI/API/docs references. - Updates backup restore/migration CI scripts and expands tests to validate the new behavior.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
weblate/trans/tests/test_file_format_params.py |
Adds tests verifying PO header update behavior under the new file format params. |
weblate/trans/tests/test_backups.py |
Verifies backup restore migrates legacy set_language_team into component file format params. |
weblate/trans/models/translation.py |
Uses new gettext file format params to conditionally update PO headers and passes params into update_header. |
weblate/trans/models/project.py |
Removes legacy set_language_team project field. |
weblate/trans/migrations/0073_migrate_gettext_header_settings.py |
Data migration intended to copy legacy project setting into component file_format_params and set defaults. |
weblate/trans/migrations/0074_remove_project_set_language_team.py |
Removes the set_language_team DB field from Project. |
weblate/trans/forms.py |
Removes set_language_team from project forms/tabs. |
weblate/trans/fixtures/simple-project.json |
Drops set_language_team from fixture data. |
weblate/trans/file_format_params.py |
Adds po_* params definitions + registration for gettext header controls. |
weblate/trans/backups.py |
Attempts to migrate legacy set_language_team during restore into component file_format_params. |
weblate/formats/txt.py |
Adjusts type hint for create_new_file language argument to Language. |
weblate/formats/ttkit.py |
Threads file_format_params through untranslate_store/update_header and conditions header fields on the new params. |
weblate/formats/tests/test_exporters.py |
Adds exporter test coverage for toggling Language-Team and X-Generator headers. |
weblate/formats/external.py |
Passes file_format_params to untranslate_store during new file creation (but has a signature/type mismatch). |
weblate/formats/exporters.py |
Makes PO exporter header generation conditional on new params. |
weblate/formats/convert.py |
Adjusts type hint for create_new_file language argument to Language. |
weblate/formats/base.py |
Updates update_header signature and plumbs component file_format_params into format setup. |
weblate/api/serializers.py |
Removes set_language_team from Project API serializer fields. |
weblate/addons/tests.py |
Extends gettext addon tests to cover disabling Report-Msgid-Bugs-To header updates. |
weblate/addons/gettext.py |
Conditions Report-Msgid-Bugs-To updates on the new file format param and passes params to update_header. |
docs/specs/schemas/weblate-backup.schema.json |
Removes legacy set_language_team from backup schema required fields. |
docs/snippets/file-format-parameters.rst |
Documents the new gettext po_* file format parameters. |
docs/formats/gettext.rst |
Updates Gettext docs to reference file format params instead of the legacy project setting. |
docs/changes.rst |
Release notes for new file format params and deprecation/removal of set_language_team. |
docs/api.rst |
Removes set_language_team from documented project API response. |
docs/admin/projects.rst |
Removes the admin documentation section for the old project-level setting. |
ci/run-migrate |
Adds CI migration test setup/assert steps for gettext header settings migration. |
ci/migrate-scripts/setup-gettext-header-settings.py |
Adds migration test setup data for legacy set_language_team -> component params migration. |
ci/migrate-scripts/assert-gettext-header-settings.py |
Asserts migrated component file_format_params contain the expected new keys/values. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This will probably wait for the next release of Weblate schemas for all tests to pass |
2e04492 to
8f5bbed
Compare
for more information, see https://pre-commit.ci
| "po_set_x_generator": x_generator, | ||
| }, | ||
| ).decode() | ||
| self.assertEqual(language_team, "Language-Team: <http://example.com/" in result) |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
|
Merged, thanks for your contribution! |