weblate/ci/migrate-scripts/setup-gettext-header-settings.py
Gersona 70049b244e
feat(file_format_params): Gettext PO header configuration with file format parameters (#18982)
* Add file format params for .po file headers

* migrate set_language_team attribute to File format params

* documentation update

* update backup schema

* handle old backups containing project.set_language_team

* configure exporter headers with file_format_params

* set GettextSetLanguageTeamHeader default to True

* docs: Documentation snippets update

* chore(docs): update OpenAPI schema

* correct fallback value for `po_set_language_team`

* fix migration conflict

* fix mypy enforced errors

* fix migration conflict

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* typo fix

* chore(docs): update OpenAPI schema

* docs: Documentation snippets update

* fix changes entries

* Add back missing changelog entries

---------

Co-authored-by: gersona <6675010+gersona@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Michal Čihař <michal@weblate.org>
2026-05-06 09:45:39 +02:00

38 lines
1 KiB
Python
Vendored

# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Migrate project set language team settings to file format params."""
from weblate.trans.models import Component, Project
project1, project2 = Project.objects.bulk_create(
[
Project(
name="set-language_team-off",
slug="set-language_team-off",
set_language_team=False,
),
Project(
name="set-language_team-on",
slug="set-language_team-on",
set_language_team=True,
),
]
)
Component.objects.bulk_create(
[
Component(
name="Gettext headers settings component 1",
slug="gettext-header-settings-component-1",
project=project1,
file_format="po",
),
Component(
name="Gettext headers settings component 2",
slug="gettext-header-settings-component-2",
project=project2,
file_format="po",
),
]
)