Skip to content

feat(file_format_params): Gettext PO header configuration with file format parameters#18982

Merged
nijel merged 19 commits intoWeblateOrg:mainfrom
gersona:16971_gettex_settings_as_file_format_params
May 6, 2026
Merged

feat(file_format_params): Gettext PO header configuration with file format parameters#18982
nijel merged 19 commits intoWeblateOrg:mainfrom
gersona:16971_gettex_settings_as_file_format_params

Conversation

@gersona
Copy link
Copy Markdown
Contributor

@gersona gersona commented Apr 13, 2026

@gersona
Copy link
Copy Markdown
Contributor Author

gersona commented Apr 13, 2026

Should the gettext file format parameters also apply to the headers set in the PO exporters? For example, weblate/formats/exporters.py (lines 71–78) always sets x_generator, language_team, etc., without consulting file_format_params.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@nijel
Copy link
Copy Markdown
Member

nijel commented Apr 14, 2026

Yes, exporters honor params since #18830

@gersona gersona changed the title feat(file_format_params): Gettexdt PO header configuration with file format parameters feat(file_format_params): Gettext PO header configuration with file format parameters Apr 14, 2026
@gersona gersona force-pushed the 16971_gettex_settings_as_file_format_params branch from 9d08c23 to bc121b2 Compare April 15, 2026 08:31
@gersona gersona marked this pull request as ready for review April 15, 2026 08:32
@nijel nijel requested a review from Copilot April 16, 2026 06:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_team into component file_format_params and 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.

Comment thread ci/migrate-scripts/setup-gettext-header-settings.py
Comment thread weblate/trans/migrations/0073_migrate_gettext_header_settings.py Outdated
Comment thread weblate/trans/backups.py Outdated
Comment thread weblate/trans/backups.py
Comment thread weblate/formats/external.py
@gersona
Copy link
Copy Markdown
Contributor Author

gersona commented Apr 23, 2026

This will probably wait for the next release of Weblate schemas for all tests to pass

@nijel
Copy link
Copy Markdown
Member

nijel commented May 5, 2026

@gersona Can you please update this on top of the current main? #19327 pulled in updated schema.

@gersona gersona force-pushed the 16971_gettex_settings_as_file_format_params branch from 2e04492 to 8f5bbed Compare May 6, 2026 05:18
@nijel nijel self-assigned this May 6, 2026
@nijel nijel added this to the 2026.5 milestone May 6, 2026
@nijel nijel requested a review from Copilot May 6, 2026 06:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 30 changed files in this pull request and generated 4 comments.

"po_set_x_generator": x_generator,
},
).decode()
self.assertEqual(language_team, "Language-Team: <http://example.com/" in result)
Comment thread weblate/trans/backups.py
Comment thread weblate/trans/migrations/0075_migrate_gettext_header_settings.py
Comment thread ci/run-migrate
@argos-ci
Copy link
Copy Markdown

argos-ci Bot commented May 6, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 21 changed May 6, 2026, 6:58 AM

@nijel nijel merged commit 70049b2 into WeblateOrg:main May 6, 2026
55 of 57 checks passed
@nijel
Copy link
Copy Markdown
Member

nijel commented May 6, 2026

Merged, thanks for your contribution!

@gersona gersona deleted the 16971_gettex_settings_as_file_format_params branch May 6, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate gettext specific settings to file format parameters

3 participants