在 Debian 和 Ubuntu 上安裝¶
硬體需求¶
Weblate should run on any contemporary hardware without problems, the following is the minimal configuration required to run Weblate on a single host (Weblate, database and web server):
3 GB 記憶體
2 CPU 核心
1 GB 儲存空間
備註
根據 Weblate 中管理的翻譯大小,安裝 Weblate 的實際需求差異很大。
記憶體使用¶
The more memory the better - it is used for caching on all levels (file system, database and Weblate). For hundreds of translation components, at least 4 GB of RAM is recommended.
提示
For systems with less memory than recommended, Single-process Celery setup is recommended.
CPU 使用¶
大量並行使用者會提高需要的 CPU 核心數。
儲存空間使用¶
The typical database storage usage is around 300 MB per 1 million hosted words.
Storage space needed for cloned repositories varies, but Weblate tries to keep their size minimal by doing shallow clones.
節點¶
For small and medium-sized sites (millions of hosted words), all Weblate components (see 架構概覽) can be run on a single node.
When you grow to hundreds of millions of hosted words, it is recommended to have a dedicated node for database (see Weblate 的資料庫設定).
安裝¶
系統需求¶
安裝所需的依賴項,來建立 Python 模組(請參閱 軟體需求):
apt install -y \
libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev libyaml-dev \
libffi-dev libcairo-dev gir1.2-pango-1.0 gir1.2-rsvg-2.0 libgirepository-2.0-dev \
libacl1-dev liblz4-dev libzstd-dev libxxhash-dev libssl-dev libpq-dev libjpeg-dev build-essential \
python3-gdbm python3-dev git
提示
Older distributions do not have libgirepository-2.0-dev, use
libgirepository1.0-dev instead. See also pip 安裝疑難排解.
根據您想使用的功能來安裝想要的可選依賴項(請參閱 Python 依賴項):
apt install -y \
libldap2-dev libldap-common libsasl2-dev \
libxmlsec1-dev
可選地安裝生產伺服器執行所需要的軟體,參閱 正在執行伺服器 、 Weblate 的資料庫設定 、 使用 Celery 的背景工作。根據於您的安裝所佔的空間,您會想要在特定的伺服器上執行這些組件。
本地安裝指示:
# Web server option 1: NGINX and uWSGI
apt install -y nginx uwsgi uwsgi-plugin-python3
# Web server option 2: Apache with ``mod_wsgi``
apt install -y apache2 libapache2-mod-wsgi-py3
# Caching backend: Valkey
apt install -y valkey-server
# Database server: PostgreSQL
apt install -y postgresql postgresql-contrib
# SMTP server
apt install -y exim4
# Gettext for the msgmerge add-on
apt install -y gettext
uv 套件管理器¶
提示
我們正在使用 uv 套件管理器來安裝 Weblate。
curl -LsSf https://astral.sh/uv/install.sh | sh
也參考
Python 模組¶
提示
我們正在單獨的 Python 環境中安裝 Weblate。
為 Weblate 建立 Python 環境:
uv venv ~/weblate-env
為 Weblate 啟動 Python 環境:
. ~/weblate-env/bin/activate安裝 Weblate,包括所有可選依賴項:
# Install Weblate with all optional dependencies uv pip install "weblate[all]"
Please check Python 依賴項 for fine-tuning of optional dependencies.
配置 Weblate¶
備註
The following assumes the Python environment used by Weblate is activated
(by executing . ~/weblate-env/bin/activate). If not, specify the full path
to the weblate command as ~/weblate-env/bin/weblate.
將文件
~/weblate-env/lib/python3.9/site-packages/weblate/settings_example.py複製為~/weblate-env/lib/python3.9/site-packages/weblate/settings.py。Adjust the values in the new
settings.pyfile to your liking. You will need to provide at least the database credentials and Django secret key, but you will want more changes for production setup, see 調整配置.Create the database and its structure for Weblate (the example settings use PostgreSQL, check Weblate 的資料庫設定 for a production-ready setup):
weblate migrate也參考
Create an administrator user account
admin, generate its password, and copy it to the clipboard; remember to save it for later use:weblate createadmin提示
If you previously missed/lost the admin password, you can generate a new one with the following command:
weblate createadmin --update
也參考
Collect the static files for your web server (see 正在執行伺服器 and 靜態檔案服務):
weblate collectstaticCompress the JavaScript and CSS files (optional, see 壓縮用戶端素材):
weblate compressStart the Celery workers. This is not necessary for development purposes, but strongly recommended otherwise. 使用 Celery 的背景工作 has more info:
celery --app=weblate.utils worker --beat --queues=celery,notify,memory,translate,backup
啟動開發伺服器(生產設定請參閱 正在執行伺服器 ):
weblate runserver
安裝後¶
恭喜,您的 Weblate 服務現在已上線了,您可以開始使用它。
您可以在
http://localhost:8000/存取 Weblate。Sign in with admin credentials obtained during installation or register with new users.
現在當 Weblate 的 Python 環境啟用時,您可以使用 weblate 來執行 Weblate 指令,請參閱 管理指令。
您可以使用 Ctrl+C 停止測試的伺服器。
Review potential issues with your installation either on
/manage/performance/URL (see 效能報告) or using weblate check --deploy, see 生產設定.
新增翻譯¶
開啟管理介面(
http://localhost:8000/create/project/),並新增您想要翻譯的專案。更多細節請參閱 專案配置。這裡所有需要您指定的只是專案名稱及其網站。
新增組件,它是翻譯的真實物件——它執行版本控制系統(VCS )儲存庫,並用於選擇那個文件被翻譯。更多細節請參閱 組件配置。
The important fields here are: 組件名稱, 原始碼儲存庫, and 檔案遮罩 for finding translatable files. Weblate supports a wide range of formats including GNU gettext PO (Portable Object), Android 字串資源, 蘋果 iOS 字串, Java 屬性, Stringsdict 格式 or 流暢的格式, see 在地化檔案格式 for more details.
一旦完成上面的工作(根據您的版本控制系統 VCS 儲存庫的大小,以及需要翻譯的資訊數量,這可能是個漫長的過程),您就可以開始翻譯了。