首先以 root
用户登录
This is the recommended method if you don’t want to concern yourself with further detail. This will create a separate Python environment for Weblate, possibly duplicating some of the Python libraries on the system.
Install the development files for libraries to be used during the building of the Python modules:
apt install libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev libyaml-dev python3-dev build-essential
Install pip
and virtualenv
. Usually they are shipped by your distribution or with Python:
apt install python3-pip python3-virtualenv virtualenv
Create and activate virtualenv for Weblate:
virtualenv --python=python3 ~/weblate-env
Activate the virtualenv for Weblate, so Weblate will look for Python libraries there first:
. ~/weblate-env/bin/activate
Install Weblate including all dependencies, you can also use pip
to install optional dependencies:
pip install Weblate
# Optional deps
pip install pytz python-bidi PyYAML pyuca
# Install database backend for PostgreSQL
pip install psycopg2-binary
# Install database backend for MySQL
apt install default-libmysqlclient-dev
pip install mysqlclient
Create your settings (in this example it would be in~/weblate-env/lib/python3.6/site-packages/weblate/settings.py
based on the settings_example.py
in the same directory).
cp ~/weblate-env/lib/python3.6/site-packages/weblate/settings_example.py
~/weblate-env/lib/python3.6/site-packages/weblate/settings.py
Optionally, adjust the values in the new settings.py
file.
允许访问地址
# List of URLs your site is supposed to serve
ALLOWED_HOSTS = ["67.218.132.50"]
配置 email
我用的是 aliyun 邮箱
找到 SMTP 地址和端口信息
EMAIL_HOST = 'smtp.mxhichina.com'
EMAIL_PORT = 25
EMAIL_HOST_USER = 'xxx@xxx.com'
EMAIL_HOST_PASSWORD = 'xxxxxxxx'
...
# E-mail address that error messages come from.
SERVER_EMAIL = 'iosdevlog@iosdevlog.com'
# Default email address to use for various automated correspondence from
# the site managers. Used for registration emails.
DEFAULT_FROM_EMAIL = 'iosdevlog@iosdevlog.com'
测试发送 email
weblate sendtestemail xxx@xxx.com
github 登录
https://github.com/settings/developers
Application name | Virgilio |
---|---|
Homepage URL | http://67.218.132.50 |
Authorization callback URL | http://67.218.132.50/accounts/complete/github/ |
Create the SQLite database and its structure for Weblate:
weblate migrate
Create the administrator user account and copy the password it outputs to the clipboard, and maybe also save it to a text file for later use:
weblate createadmin
Start the development server:
weblate runserver 67.218.132.50:80 -d
Open a web browser, go to http://67.218.132.50/accounts/login/ and login with the user name admin
and paste the password in.
Proceed with Adding translation to add some translatable contents to your test installation.
You can stop the test server with Ctrl+C, and leave the virtual environment with deactivate
. If you want to resume testing later, you need to repeat the steps 4, 8 and 11 each time to start the development server.
http://67.218.132.50/admin/performance/
example.com
打开 http://67.218.132.50/admin/sites/site/1/
修改 Domain name 域名
find . -name "*.md" -print0 | xargs -0 -I M extract M M.zh_Hans.xliff M.zh_Hans.skl en-US zh_Hans