Installing on Debian and Ubuntu


Weblate 应该可以在所有现代硬件上正常运行,以下是在单个主机( Weblate ,数据库和 Web 服务器)上运行 Weblate 所需的最低配置:

  • 2 GB 的内存

  • 2 个 CPU 核心

  • 1 GB 的存储空间

内存越多越好 —— 用于所有级别的缓存(文件系统,数据库和 Weblate )。

许多并发用户会增加所需的 CPU 内核数量。对于数百个翻译组件,建议至少有 4 GB 的内存。


根据 Weblate 中管理的翻译大小,安装 Weblate 的实际要求差异很大。


System requirements

Install the dependencies needed to build the Python modules (see 软件要求):

apt install \
   libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev libyaml-dev \
   libcairo-dev gir1.2-pango-1.0 libgirepository1.0-dev libacl1-dev libssl-dev \
   build-essential python3-gdbm python3-dev python3-pip python3-virtualenv virtualenv git

Install wanted optional dependencies depending on features you intend to use (see 可选依赖性):

apt install tesseract-ocr libtesseract-dev libleptonica-dev

Optionally install software for running production server, see Running server, Database setup for Weblate, Background tasks using Celery. Depending on size of your installation you might want to run these components on dedicated servers.

The local installation instructions:

# Web server option 1: NGINX and uWSGI
apt install nginx uwsgi uwsgi-plugin-python3

# Web server option 2: Apache with ``mod_wsgi``
apt install apache2 libapache2-mod-wsgi

# Caching backend: Redis
apt install redis-server

# Database server: PostgreSQL
apt install postgresql postgresql-contrib

# SMTP server
apt install exim4

Python modules


We’re using virtualenv to install Weblate in a separate environment from your system. If you are not familiar with it, check virtualenv User Guide.

  1. Create the virtualenv for Weblate:

    virtualenv --python=python3 ~/weblate-env
  2. Activate the virtualenv for Weblate:

    . ~/weblate-env/bin/activate
  3. Install Weblate including all dependencies:

    pip install Weblate
  4. Install database driver:

    pip install psycopg2-binary
  5. Install wanted optional dependencies depending on features you intend to use (some might require additional system libraries, check 可选依赖性):

    pip install ruamel.yaml aeidon boto3 zeep chardet tesserocr

Configuring Weblate


Following steps assume virtualenv used by Weblate is active (what can be done by . ~/weblate-env/bin/activate). In case this is not true, you will have to specify full path to weblate command as ~/weblate-env/bin/weblate.

  1. Copy the file ~/weblate-env/lib/python3.7/site-packages/weblate/ to ~/weblate-env/lib/python3.7/site-packages/weblate/

  2. Adjust the values in the new file to your liking. You can stick with shipped example for testing purposes, but you will want changes for production setup, see Adjusting configuration.

  3. Create the database and its structure for Weblate (the example settings use PostgreSQL, check Database setup for Weblate for production ready setup):

    weblate migrate
  4. Create the administrator user account and copy the password it outputs to the clipboard, and also save it for later use:

    weblate createadmin
  5. Collect static files for web server (see Running server and Serving static files):

    weblate collectstatic
  6. Compress JavaScript and CSS files (optional, see Compressing client assets):

    weblate compress
  7. Start Celery workers. This is not necessary for development purposes, but strongly recommended otherwise. See Background tasks using Celery for more info:

    ~/weblate-env/lib/python3.7/site-packages/weblate/examples/celery start
  8. Start the development server (see Running server for production setup):

    weblate runserver

After installation

Congratulations, your Weblate server is now running and you can start using it.

  • You can now access Weblate on http://localhost:8000/.

  • Login with admin credentials obtained during installation or register with new users.

  • You can now run Weblate commands using weblate command when Weblate virtualenv is active, see Management commands.

  • You can stop the test server with Ctrl+C.

Adding translation

  1. Open the admin interface (http://localhost:8000/create/project/) and create the project you want to translate. See 项目配置 for more details.

    All you need to specify here is the project name and its website.

  2. Create a component which is the real object for translation - it points to the VCS repository, and selects which files to translate. See Component configuration for more details.

    The important fields here are: Component name, VCS repository address and mask for finding translatable files. Weblate supports a wide range of formats including gettext PO files, Android resource strings, iOS string properties, Java properties or Qt Linguist files, see 支持的文件格式 for more details.

  3. Once the above is completed (it can be lengthy process depending on the size of your VCS repository, and number of messages to translate), you can start translating.