Optional Weblate modules#
可以獲得幾個可選的模組來組態您的設定。
Git 導出器#
使用 HTTP(S) 為您提供對底層 Git 倉儲的只讀訪問。
安裝#
將
weblate.gitexport
添加到settings.py
中安裝的 apps 中:
INSTALLED_APPS += ("weblate.gitexport",)
通過安裝後遷移資料庫,將現有的倉儲導出:
weblate migrate
使用#
模組自動鉤入 Weblate,並且在 組件配置 中設定匯出儲存庫 URL。儲存庫在 Weblate URL 的 /git/
部分下是可以訪問的,例如 https://example.org/git/weblate/main/
。
公共可用項目的倉儲可以被克隆而無需認證:
git clone 'https://example.org/git/weblate/main/'
對儲存庫的受限制的存取(使用 Private 存取控制 或在 REQUIRE_LOGIN
處於啟用狀態時)需要一個 API 代符,獲取位置在您的 :ref: user-profile <user-profile>:
git clone 'https://user:KEY@example.org/git/weblate/main/'
提示
成員或 Users 使用者組與匿名使用者預設通過 Access repository 和 Power user 角色訪問公開項目。
帳單#
這用在 Hosted Weblate 上來確定付費套餐,跟踪收據和使用限制。
安裝#
1. Add weblate.billing
to installed apps in
settings.py
:
INSTALLED_APPS += ("weblate.billing",)
執行資料庫遷移,來可選地為模組安裝另外的資料庫結構:
weblate migrate
使用#
安裝後您可以在管理界面控制賬單。允許了賬單的使用者將在他們的 使用者個人檔案 中得到新的 Billing 標籤。
帳單模組額外允許專案管理員在不是超級使用者的情況下去建立新的專案和組件(請參見 添加翻譯項目和組件)。當後面的條件滿足是這是可能的:
賬單在其配置的限制下(任何過度的使用都會阻止新建項目/組件),並且被支付(如果價格為非零值的話)
使用者是現有的帶有賬單項目的管理員,或者使用者是賬單的所有者(當為使用者新建新的賬單,而允許導入新的項目時,後者是必要的)。
在新建項目時,使用者在訪問多個賬單的情況下,能夠選擇將項目記在哪個賬單上。
法律#
這用在 Hosted Weblate 上,來提供所需的法律文件。它開始時提供空白文件,會希望您填充文件中後面的模板:
legal/documents/tos.html
服務條款文件
legal/documents/privacy.html
Privacy policy document
legal/documents/summary.html
服務條款與隱私政策的簡短概覽
On changing the terms of service documents, please adjust
LEGAL_TOS_DATE
so that users are forced to agree with the updated
documents.
備註
可以在這個 Git 倉儲 <https://github.com/WeblateOrg/wllegal/tree/main/wllegal/templates/legal/documents> 中獲取 Hosted Weblate 的法律文件。
這些很可能對您沒有直接的用處,但如果調整來滿足您的需求時,以此作為起點可能會比較方便。
安裝#
1. Add weblate.legal
to installed apps in
settings.py
:
INSTALLED_APPS += ("weblate.legal",)
# Optional:
# Social auth pipeline to confirm TOS upon registration/subsequent sign in
SOCIAL_AUTH_PIPELINE += ("weblate.legal.pipeline.tos_confirm",)
# Middleware to enforce TOS confirmation of signed in users
MIDDLEWARE += [
"weblate.legal.middleware.RequireTOSMiddleware",
]
執行資料庫遷移,來可選地為模組安裝另外的資料庫結構:
weblate migrate
編輯
weblate/legal/templates/legal/
文件夾中的而法律文件,與您的服務匹配。
使用#
安裝並編輯後,法律文件顯示在 Weblate UI 中。
頭像#
頭像在服務器端下載並緩存,來減少對預設服務的網站的洩露。通過為其配置的電子郵件地址來取回頭像的內建支持,可以使用 ENABLE_AVATARS
來關閉。
Weblate currently supports:
針對垃圾郵件的保護#
您可以免受使用者發送垃圾郵件的侵擾,方法是使用 Akismet 服務。
安裝 akismet Python 模組(這已包含在官方 Docker image 中)。
獲取 Akismet API 密鑰。
將其存儲為:設置:akismet_api_key`或:envvar:`weblate_akismet_api_key in docker。
以下內容被發送到AkisMet進行檢查:
Suggestions from unauthenticated users
Project and component descriptions and links
備註
這(除了其它事情以外)依賴於客戶端的 IP 地址,適當的配置請參見: 在反向代理後面運行。
簽署 GnuPG 的 Git 承諾#
在 3.1 版新加入.
所有的承諾可以由 Weblate 時間的 GnuPG 密鑰簽署。
1. Turn on WEBLATE_GPG_IDENTITY
. (Weblate will generate a GnuPG
key when needed and will use it to sign all translation commits.)
這個特性需要安裝 GnuPG 2.1 或更新版。
您可以在 DATA_DIR
中找到密鑰,而公鑰顯示在“關於”頁面上:

2. Alternatively you can also import existing keys into Weblate, just set
HOME=$DATA_DIR/home
when invoking gpg.
頻次限制#
在 3.2 版的變更: 頻次限制先擇接受更細粒度的配置。
在 4.6 版的變更: 速率限制不再適用於超級使用者。
Weblate 的一些操作受到頻次限制。在 RATELIMIT_WINDOW
的秒數內最多允許 RATELIMIT_ATTEMPTS
次數的嘗試。然後阻止使用者 RATELIMIT_LOCKOUT
時間。還有指定範圍的設置,例如 RATELIMIT_CONTACT_ATTEMPTS
或 RATELIMIT_TRANSLATE_ATTEMPTS
。下面的表格是可用範圍的完整列表。
後面的操作受到頻次限制:
名稱 |
範圍 |
允許的嘗試 |
頻次限制窗口 |
鎖定時間 |
---|---|---|---|---|
註冊 |
|
5 |
300 |
600 |
將消息發送給管理員 |
|
2 |
300 |
600 |
Password authentication on sign in |
|
5 |
300 |
600 |
網站範圍的搜尋 |
|
6 |
60 |
60 |
Translating |
|
30 |
60 |
600 |
Adding to glossary |
|
30 |
60 |
600 |
Starting translation into a new language |
|
2 |
300 |
600 |
Creating new project |
|
5 |
600 |
600 |
If a user fails to sign in AUTH_LOCK_ATTEMPTS
times, password authentication will be turned off on the account until having gone through the process of having its password reset.
這個設定也可被使用在 Docker 容器中,透過添加 WEBLATE_
前綴字在設定名稱前。如: RATELIMIT_ATTEMPTS
可使用 WEBLATE_RATELIMIT_ATTEMPTS
。
API 具有另外的速率限制設置,請參見 API 頻次限制。
Fedora Messaging integration#
Fedora Messaging是基於AMQP的發佈者,用於Weberate中發生的所有變化。您可以在使用此操作中掛鉤正在發生的更改的其他服務。
Fedora Messaging Integration可作為單獨的Python模塊``weblate-fedora-messaging``。請參閱<https://github.com/weblateorg/fedora_messaging/>用於設置說明。