Upgrade von Weblate

Docker-Image-Upgrades

The official Docker image (see Installation über Docker) has all Weblate upgrade steps integrated. There are typically no manual steps needed besides pulling latest version.

Allgemeine Upgrade-Anweisungen

Before upgrading, please check the current Software-Anforderungen as they might have changed. Once all requirements are installed or updated, please adjust your settings.py to match changes in the configuration (consult settings_example.py for correct values).

Always check Versionsspezifische Anweisungen before upgrade. In case you are skipping some versions, please follow instructions for all versions you are skipping in the upgrade. Sometimes it’s better to upgrade to some intermediate version to ensure a smooth migration. Upgrading across multiple releases should work, but is not as well tested as single version upgrades.

Bemerkung

Es wird empfohlen, vor dem Upgrade eine vollständige Datenbanksicherung durchzuführen, damit Sie die Datenbank zurücksetzen können, falls das Upgrade fehlschlägt, siehe Sichern und Verschieben von Weblate.

  1. Stop wsgi and Celery processes. The upgrade can perform incompatible changes in the database, so it is always safer to avoid old processes running while upgrading.

  2. Upgrade Weblate code.

    For pip installs it can be achieved by:

    pip install -U "Weblate[all]==version"
    

    Oder wenn Sie einfach nur die neueste Version erhalten möchten:

    pip install -U "Weblate[all]"
    

    If you don’t want to install all of the optional dependencies do:

    pip install -U Weblate
    

    With Git checkout you need to fetch new source code and update your installation:

    cd weblate-src
    git pull
    # Update Weblate inside your virtualenv
    . ~/weblate-env/bin/pip install -e .
    # Install dependencies directly when not using virtualenv
    pip install --upgrade -r requirements.txt
    # Install optional dependencies directly when not using virtualenv
    pip install --upgrade -r requirements-optional.txt
    
  3. New Weblate release might have new Optionale Abhängigkeiten, please check if they cover features you want.

  4. Upgrade configuration file, refer to settings_example.py or Versionsspezifische Anweisungen for needed steps.

  5. Upgrade database structure:

    weblate migrate --noinput
    
  6. Collect updated static files (see Laufender Server and Bereitstellung statischer Dateien):

    weblate collectstatic --noinput --clear
    
  7. Compress JavaScript and CSS files (optional, see Client-Assets komprimieren):

    weblate compress
    
  8. If you are running version from Git, you should also regenerate locale files every time you are upgrading. You can do this by invoking:

    weblate compilemessages
    
  9. Verify that your setup is sane (see also Produktionseinrichtung):

    weblate check --deploy
    
  10. Celery-Worker neu starten (siehe Hintergrundaufgaben mit Celery).

Versionsspezifische Anweisungen

Upgrade von 2.x

Wenn Sie von der Version 2.x upgraden, sollten Sie immer zuerst auf 3.0.1 upgraden und dann mit der 3.x-Serie fortfahren. Upgrades, die diesen Schritt überspringen, werden nicht unterstützt und führen zu Fehlern.

Upgrade von 3.x

Wenn Sie von der Version 3.x aktualisieren, führen Sie immer zuerst ein Upgrade auf 4.0.4 oder 4.1.1 durch und setzen Sie dann das Upgrade in der 4.x-Serie fort. Upgrades, die diesen Schritt überspringen, werden nicht unterstützt und führen zu Fehlern.

Siehe auch

Upgrade von 3.11 auf 4.0 in der Weblate-4.0-Dokumentation <https://docs.weblate.org/en/weblate-4.0.4/admin/upgrade.html#upgrade-from-3-11-to-4-0>`_

Upgrade von 4.0 auf 4.1

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

Notable configuration or dependencies changes:

  • There are several changes in settings_example.py, most notable middleware changes, please adjust your settings accordingly.

  • There are new file formats, you might want to include them in case you modified the WEBLATE_FORMATS.

  • There are new quality checks, you might want to include them in case you modified the CHECK_LIST.

  • There is change in DEFAULT_THROTTLE_CLASSES setting to allow reporting of rate limiting in the API.

  • Es gibt einige neue und aktualisierte Anforderungen.

  • There is a change in INSTALLED_APPS.

  • Die Einstellung MT_DEEPL_API_VERSION wurde in Version 4.7 entfernt. Die maschineller Übersetzung DeepL verwendet nun stattdessen MT_DEEPL_API_URL. Möglicherweise müssen Sie MT_DEEPL_API_URL an Ihre Abonnements anpassen.

Upgrade von 4.1 auf 4.2

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

Notable configuration or dependencies changes:

  • Upgrades von 3.x Versionen werden nicht mehr unterstützt, bitte aktualisieren Sie zuerst auf 4.0 oder 4.1.

  • Es gibt einige neue und aktualisierte Anforderungen.

  • There are several changes in settings_example.py, most notable new middleware and changed application ordering.

  • The keys for JSON based formats no longer include leading dot. The strings are adjusted during the database migration, but external components might need adjustment in case you rely on keys in exports or API.

  • The Celery configuration was changed to no longer use memory queue. Please adjust your startup scripts and CELERY_TASK_ROUTES setting.

  • The Weblate domain is now configured in the settings, see SITE_DOMAIN (or WEBLATE_SITE_DOMAIN). You will have to configure it before running Weblate.

  • The username and email fields on user database now should be case insensitive unique. It was mistakenly not enforced with PostgreSQL.

Upgrade von 4.2 auf 4.3

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

Notable configuration or dependencies changes:

  • There are some changes in quality checks, you might want to include them in case you modified the CHECK_LIST.

  • The source language attribute was moved from project to a component what is exposed in the API. You will need to update Weblate-Client in case you are using it.

  • The database migration to 4.3 might take long depending on number of strings you are translating (expect around one hour of migration time per 100,000 source strings).

  • There is a change in INSTALLED_APPS.

  • There is a new setting SESSION_COOKIE_AGE_AUTHENTICATED which complements SESSION_COOKIE_AGE.

  • In case you were using hub or lab to integrate with GitHub or GitLab, you will need to reconfigure this, see GITHUB_CREDENTIALS and GITLAB_CREDENTIALS.

Geändert in Version 4.3.1:

  • The Celery configuration was changed to add memory queue. Please adjust your startup scripts and CELERY_TASK_ROUTES setting.

Geändert in Version 4.3.2:

  • The post_update method of add-ons now takes extra skip_push parameter.

Upgrade von 4.3 auf 4.4

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

Notable configuration or dependencies changes:

  • There is a change in INSTALLED_APPS, weblate.configuration has to be added there.

  • Django 3.1 ist jetzt erforderlich.

  • In case you are using MySQL or MariaDB, the minimal required versions have increased, see MySQL und MariaDB.

Geändert in Version 4.4.1:

  • Monolingual gettext now uses both msgid and msgctxt when present. This will change identification of translation strings in such files breaking links to Weblate extended data such as screenshots or review states. Please make sure you commit pending changes in such files prior upgrading and it is recommended to force loading of affected component using loadpo.

  • Increased minimal required version of translate-toolkit to address several file format issues.

Upgrade von 4.4 auf 4.5

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

Notable configuration or dependencies changes:

  • Bei umfangreichen Glossaren kann die Migration viel Zeit in Anspruch nehmen.

  • Glossare werden jetzt als reguläre Komponenten gespeichert.

  • Die Glossar-API wurde entfernt. Verwenden Sie die reguläre Übersetzungs-API für den Zugriff auf Glossare.

  • There is a change in INSTALLED_APPS - weblate.metrics should be added.

Geändert in Version 4.5.1:

  • Es gibt eine neue Abhängigkeit vom Modul pyahocorasick.

Upgrade von 4.5 auf 4.6

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

Notable configuration or dependencies changes:

Upgrade von 4.6 auf 4.7

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

Notable configuration or dependencies changes:

  • Es gibt mehrere Änderungen in settings_example.py, vor allem in der Middleware (MIDDLEWARE), bitte passen Sie Ihre Einstellungen entsprechend an.

  • Die maschinelle Übersetzung deepl hat jetzt eine allgemeine Einstellung MT_DEEPL_API_URL, um sich flexibler an verschiedene Abonnementmodelle anzupassen. Die Einstellung MT_DEEPL_API_VERSION wird nicht mehr verwendet.

  • Django 3.2 ist jetzt erforderlich.

Upgrade von 4.7 auf 4.8

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

In dieser Version sind keine zusätzlichen Upgrade-Schritte erforderlich.

Upgrade von 4.8 auf 4.9

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

  • There is a change in storing metrics, the upgrade can take long time on larger sites.

Upgrade von 4.0 auf 4.10

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

  • There is a change in per-project groups, the upgrade can take long time on sites with thousands of projects.

  • Django 4.0 has made some incompatible changes, see Backwards incompatible changes in 4.0. Weblate still supports Django 3.2 for now, in case any of these are problematic. Most notable changes which might affect Weblate:

    • Die Unterstützung für PostgreSQL 9.6 eingestellt, Django 4.0 unterstützt PostgreSQL 10 und höher.

    • Das Format von CSRF_TRUSTED_ORIGINS wurde geändert.

  • Der Docker-Container verwendet jetzt Django 4.0, siehe oben für Änderungen.

Upgrade von 4.10 auf 4.11

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

  • Weblate erfordert jetzt Python 3.7 oder neuer.

  • Die Implementierung von Verwaltung der projektspezifischen Zugriffssteuerung wurde geändert, indem das Projektpräfix aus den Gruppennamen entfernt wurde. Dies betrifft API-Benutzer.

  • Weblate verwendet jetzt das Modul charset-normalizer anstelle von chardet für die Zeichensatzerkennung.

  • Geändert in 4.11.1: Es gibt eine Änderung in REST_FRAMEWORK (Entfernung eines der Backends in DEFAULT_AUTHENTICATION_CLASSES).

Upgrade von 4.11 auf 4.12

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

  • Es sind keine besonderen Schritte erforderlich.

Upgrade von 4.12 auf 4.13

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

  • Die Sprachdefinitionen werden nun automatisch bei einem Upgrade aktualisiert, verwenden Sie UPDATE_LANGUAGES um dies zu deaktivieren.

  • Handling of context and location has been changed for Windows RC-Dateien, HTML-Dateien, IDML-Format, and Textdateien file formats. In most cases the context is now shown as location.

  • Die maschinellen Übersetzungsdienste werden nun über die Benutzeroberfläche konfiguriert, die Einstellungen aus der Konfigurationsdatei werden bei der Datenbankmigration importiert.

Upgrade von 4.13 auf 4.14

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

  • Die Java-Formatierungsprüfungen entsprechen nun den GNU-gettext-Markierungen. Die in Weblate gesetzten Markierungen werden automatisch migriert, aber Skripte von Drittanbietern müssen java-printf-format anstelle von java-format und java-format anstelle von java-messageformat verwenden.

  • Die jellyfish-Abhängigkeit wurde durch rapidfuzz ersetzt.

  • Geändert in 4.14.2: Die unsichere Konfiguration von API-Schlüsseln der VCS-Dienste über _TOKEN/_USERNAME-Konfiguration anstelle der _CREDENTIALS-Liste wurde eingestellt. In Docker bitte die passende _HOST-Direktive hinzufügen. Siehe zum Beispiel WEBLATE_GITHUB_HOST und GITHUB_CREDENTIALS.

Upgrade von 4.14 auf 4.15

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

  • Weblate benötigt jetzt die btree_gin Erweiterung in PostgreSQL. Der Migrationsprozess wird sie installieren, wenn er genügend Rechte hat. Siehe Erstellen einer Datenbank in PostgreSQL für die manuelle Einrichtung.

  • Das Docker-Image aktiviert den Debugmodus nicht mehr standardmäßig. Falls Sie ihn wünschen, aktivieren Sie ihn in der Einsatzumgebung mit WEBLATE_DEBUG.

  • Die Datenbankmigration kann bei größeren Instanzen Stunden dauern, da einige der Indizes neu erstellt werden müssen.

  • Geändert in 4.15.1: Der Standardwert für DEFAULT_PAGINATION_CLASS in den Rest-Framework-Einstellungen geändert.

Upgrade von 4.15 auf 4.16

Please follow Allgemeine Upgrade-Anweisungen in order to perform update.

  • Celery Beat speichert nun den Aufgabenplan in der Datenbank, CELERY_BEAT_SCHEDULER und INSTALLED_APPS müssen dafür geändert werden.

  • The deprecated VCS setting for credentials is no longer supported, see Upgrade von 4.13 auf 4.14.

  • Upgrade of django-crispy-forms requires changes in INSTALLED_APPS.

  • Integration of django-cors-headers requires changes in INSTALLED_APPS and MIDDLEWARE.

Upgrade von Python 2 auf Python 3

Weblate unterstützt kein Python das älter als 3.6 ist. Falls Sie noch mit einer älteren Version arbeiten, führen Sie bitte zuerst die Migration auf Python 3 mit der bestehenden Version durch und aktualisieren Sie später. Siehe Upgrade von Python 2 auf Python 3 in der Weblate-3.11.1-Dokumentation.

Migration von anderen Datenbanken zu PostgreSQL

Wenn Sie Weblate auf einer anderen Datenbank als PostgreSQL betreiben, sollten Sie eine Migration zu PostgreSQL in Betracht ziehen, da Weblate damit am besten funktioniert. Die folgenden Schritte werden Sie bei der Migration Ihrer Daten zwischen den Datenbanken anleiten. Bitte denken Sie daran, sowohl den Web- als auch den Celery-Server vor der Migration zu stoppen, da es sonst zu inkonsistenten Daten kommen kann.

Erstellen einer Datenbank in PostgreSQL

Normalerweise ist es eine gute Idee, Weblate in einer separaten Datenbank und unter einem separaten Benutzerkonto laufen zu lassen:

# If PostgreSQL was not installed before, set the main password
sudo -u postgres psql postgres -c "\password postgres"

# Create a database user called "weblate"
sudo -u postgres createuser -D -P weblate

# Create the database "weblate" owned by "weblate"
sudo -u postgres createdb -E UTF8 -O weblate weblate

Migration mit Django-JSON-Dumps

Der einfachste Ansatz für die Migration ist die Verwendung von Django-JSON-Dumps. Dies funktioniert gut für kleinere Installationen. Bei größeren Sites sollten Sie stattdessen pgloader verwenden, siehe Migration zu PostgreSQL mit pgloader.

  1. Fügen Sie PostgreSQL als zusätzliche Datenbankverbindung in settings.py ein:

DATABASES = {
    "default": {
        # Database engine
        "ENGINE": "django.db.backends.mysql",
        # Database name
        "NAME": "weblate",
        # Database user
        "USER": "weblate",
        # Database password
        "PASSWORD": "password",
        # Set to empty string for localhost
        "HOST": "database.example.com",
        # Set to empty string for default
        "PORT": "",
        # Additional database options
        "OPTIONS": {
            # In case of using an older MySQL server, which has MyISAM as a default storage
            # 'init_command': 'SET storage_engine=INNODB',
            # Uncomment for MySQL older than 5.7:
            # 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
            # If your server supports it, see the Unicode issues above
            "charset": "utf8mb4",
            # Change connection timeout in case you get MySQL gone away error:
            "connect_timeout": 28800,
        },
    },
    "postgresql": {
        # Database engine
        "ENGINE": "django.db.backends.postgresql",
        # Database name
        "NAME": "weblate",
        # Database user
        "USER": "weblate",
        # Database password
        "PASSWORD": "password",
        # Set to empty string for localhost
        "HOST": "database.example.com",
        # Set to empty string for default
        "PORT": "",
    },
}
  1. Führen Sie die Migration durch und löschen Sie alle in die Tabellen eingefügten Daten:

weblate migrate --database=postgresql
weblate sqlflush --database=postgresql | weblate dbshell --database=postgresql
  1. Dump der Legacy-Datenbank und Import in PostgreSQL

weblate dumpdata --all --output weblate.json
weblate loaddata weblate.json --database=postgresql
  1. Passen Sie DATABASES an, um nur die PostgreSQL-Datenbank als Standard zu verwenden, entfernen Sie die Legacy-Verbindung.

Weblate sollte nun bereit sein, um von der PostgreSQL-Datenbank aus zu laufen.

Migration zu PostgreSQL mit pgloader

Der pgloader ist ein allgemeines Migrationswerkzeug für die Migration von Daten nach PostgreSQL. Sie können es verwenden, um Weblate-Datenbanken zu migrieren.

  1. Passen Sie settings.py an, um PostgreSQL als Datenbank zu verwenden.

  2. Migrate the schema in the PostgreSQL database:

    weblate migrate
    weblate sqlflush | weblate dbshell
    
  3. Run the pgloader to transfer the data. The following script can be used to migrate the database, but you might want to learn more about pgloader to understand what it does and tweak it to match your setup:

    LOAD DATABASE
         FROM      mysql://weblate:password@localhost/weblate
         INTO postgresql://weblate:password@localhost/weblate
    
    WITH include no drop, truncate, create no tables, create no indexes, no foreign keys, disable triggers, reset sequences, data only
    
    ALTER SCHEMA 'weblate' RENAME TO 'public'
    ;
    

Migrating from Pootle

As Weblate was originally written as replacement from Pootle, it is supported to migrate user accounts from Pootle. You can dump the users from Pootle and import them using importusers.