Atualizando o Weblate¶
Atualizações de imagem Docker¶
A imagem Docker oficial (veja Instalando a usar Docker) possui todas as etapas de atualização integradas. Não há nenhuma etapa manual além de buscar a versão mais recente.
Instruções genéricas de atualização¶
Antes de atualizar, verifique os atuais Requisitos de software, pois eles podem ter mudado. Uma vez que todos os requisitos estejam instalados ou atualizados, ajuste o seu settings.py
para corresponder às mudanças na configuração (consulte settings_example.py
para os valores corretos).
Always check Instruções específicas de versão 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.
Nota
It is recommended to perform a full database backup prior to upgrade so that you can roll back the database in case upgrade fails, see Fazer backup e mover o Weblate.
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.
Upgrade Weblate code.
Para instalações pip, isso pode ser alcançado da seguinte forma:
pip install -U Weblate
Com um checkout do Git, precisa obter o novo código-fonte e atualizar a sua instalação:
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
Atualize o ficheiro de configuração, consulte o
settings_example.py
ou :ref:`version-specific-instructions`para os passos necessários.Atualize estrutura do banco de dados:
weblate migrate --noinput
Colete ficheiros estáticos atualizados (veja Executar o servidor e Servir ficheiros estáticos):
weblate collectstatic --noinput
Compactar ficheiros JavaScript e CSS (opcional, veja Comprimir os ativos do cliente):
weblate compress
Se está a usar uma versão do Git, também deve gerar novamente ficheiros locais toda vez que estiver atualizando. Pode fazer isso a invocar:
weblate compilemessages
Verifique que a sua configuração é sana (ver também Configuração de produção):
weblate check --deploy
Restart Celery worker (see Tarefas de fundo a usar o Celery).
Instruções específicas de versão¶
Atualizar de 2.x¶
Se está a atualizar da versão 2.x, sempre atualize para a 3.0.1 antes e depois continue atualizando na série 3.x. Atualizações pulando esse passo não são suportadas e não funcionarão corretamente.
Upgrade from 3.x¶
If you are upgrading from 3.x release, always first upgrade to 4.0.4 or 4.1.1 and then continue upgrading in the 4.x series. Upgrades skipping this step are not supported and will break.
Upgrade from 4.0 to 4.1¶
Please follow Instruções genéricas de atualização 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.There are some new and updated requirements.
There is a change in
INSTALLED_APPS
.The
MT_DEEPL_API_VERSION
setting has been removed in Version 4.7. The DeepL machine translation now uses the newMT_DEEPL_API_URL
instead. You might need to adjustMT_DEEPL_API_URL
to match your subscription.
Veja também
Upgrade from 4.1 to 4.2¶
Please follow Instruções genéricas de atualização in order to perform update.
Notable configuration or dependencies changes:
Upgrade from 3.x releases is not longer supported, please upgrade to 4.0 or 4.1 first.
There are some new and updated requirements.
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 andCELERY_TASK_ROUTES
setting.The Weblate domain is now configured in the settings, see
SITE_DOMAIN
(orWEBLATE_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.
Veja também
Upgrade from 4.2 to 4.3¶
Please follow Instruções genéricas de atualização 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 Cliente Weblate 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 complementsSESSION_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
andGITLAB_CREDENTIALS
.
Alterado na versão 4.3.1:
The Celery configuration was changed to add
memory
queue. Please adjust your startup scripts andCELERY_TASK_ROUTES
setting.
Alterado na versão 4.3.2:
The
post_update
method of addons now takes extraskip_push
parameter.
Veja também
Upgrade from 4.3 to 4.4¶
Please follow Instruções genéricas de atualização 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 is now required.
In case you are using MySQL or MariaDB, the minimal required versions have increased, see MySQL e MariaDB.
Alterado na versão 4.4.1:
Gettext monolíngue now uses both
msgid
andmsgctxt
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 recommeded to force loading of affected component usingloadpo
.Increased minimal required version of translate-toolkit to address several file format issues.
Veja também
Upgrade from 4.4 to 4.5¶
Please follow Instruções genéricas de atualização in order to perform update.
Notable configuration or dependencies changes:
The migration might take considerable time if you had big glossaries.
Glossaries are now stored as regular components.
The glossary API is removed, use regular translation API to access glossaries.
There is a change in
INSTALLED_APPS
-weblate.metrics
should be added.
Alterado na versão 4.5.1:
There is a new dependency on the pyahocorasick module.
Veja também
Upgrade from 4.5 to 4.6¶
Please follow Instruções genéricas de atualização in order to perform update.
Notable configuration or dependencies changes:
There are new file formats, you might want to include them in case you modified the
WEBLATE_FORMATS
.A API para a criação de componentes agora usa automaticamente URLs internas do Weblate, veja
POST /api/projects/(string:project)/components/
.There is a change in dependencies and
PASSWORD_HASHERS
to prefer Argon2 for passwords hashing.
Veja também
Upgrade from 4.6 to 4.7¶
Please follow Instruções genéricas de atualização in order to perform update.
Notable configuration or dependencies changes:
There are several changes in
settings_example.py
, most notable middleware changes (MIDDLEWARE
), please adjust your settings accordingly.The DeepL machine translation now has a generic
MT_DEEPL_API_URL
setting to adapt to different subscription models more flexibly. TheMT_DEEPL_API_VERSION
setting is no longer used.Django 3.2 is now required.
Veja também
Upgrading from Python 2 to Python 3¶
Weblate no longer supports Python older than 3.5. In case you are still running on older version, please perform migration to Python 3 first on existing version and upgrade later. See Upgrading from Python 2 to Python 3 in the Weblate 3.11.1 documentation.
Migrando de outros bancos de dados para o PostgreSQL¶
If you are running Weblate on other dabatase than PostgreSQL, you should consider migrating to PostgreSQL as Weblate performs best with it. The following steps will guide you in migrating your data between the databases. Please remember to stop both web and Celery servers prior to the migration, otherwise you might end up with inconsistent data.
Criar um banco de dados no PostgreSQL¶
Geralmente é uma boa ideia executar o Weblate num banco de dados separado e separar a conta do utilizador:
# 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
Migrating using Django JSON dumps¶
The simplest approach for migration is to utilize Django JSON dumps. This works well for smaller installations. On bigger sites you might want to use pgloader instead, see Migrating to PostgreSQL using pgloader.
Add PostgreSQL as additional database connection to the
settings.py
:
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": "",
},
}
Run migrations and drop any data inserted into the tables:
weblate migrate --database=postgresql
weblate sqlflush --database=postgresql | weblate dbshell --database=postgresql
Dump legacy database and import to PostgreSQL
weblate dumpdata --all --output weblate.json
weblate loaddata weblate.json --database=postgresql
Adjust
DATABASES
to use just PostgreSQL database as default, remove legacy connection.
Weblate should be now ready to run from the PostgreSQL database.
Migrating to PostgreSQL using pgloader¶
The pgloader is a generic migration tool to migrate data to PostgreSQL. You can use it to migrate Weblate database.
Adjust your
settings.py
to use PostgreSQL as a database.Migrate the schema in the PostgreSQL database:
weblate migrate weblate sqlflush | weblate dbshell
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
.