組態

所有的設定儲存在 settings.py 中,(如 Django 通常那樣)。

備註

After changing any of these settings, you need to restart Weblate — both WSGI and Celery processes.

在它作為 mod_wsgi 執行的情況下,需要重新啟動 Apache,來重新載入組態。

也參考

還要請檢視 Django’s documentation 中關於組態 Django 自身的參數。

ADMINS_CONTACT

Configures where contact form sends e-mails. If not configured, e-mail addresses from ADMINS are used.

Configure this as a list of e-mail addresses:

ADMINS_CONTACT = ["admin@example.com", "support@example.com"]

也參考

CONTACT_FORM, ADMINS

AKISMET_API_KEY

Weblate 可以使用 Akismet 檢查到來的對垃圾郵件的匿名建議。請存取 akismet.com 來購買 API 金鑰,並將它與網站關聯。

ANONYMOUS_USER_NAME

未登入使用者的使用者名。

也參考

存取控制

AUDITLOG_EXPIRY

How many days Weblate should keep audit logs (which contain info about account activity).

預設為 180 天。

AUTH_LOCK_ATTEMPTS

在rate限制應用前,授權嘗試失敗的最多次數。

目前,這應用在後面的位置:

  • 登入。刪除帳號密碼,防止使用者不請求新的密碼而登入。

  • Password reset. Prevents new e-mails from being sent, avoiding spamming users with too many password-reset attempts.

預設到 10。

也參考

頻次限制

AUTO_UPDATE

以每天的頻率更新所有儲存庫。

提示

在不使用 通知掛勾 來自動更新 Weblate 儲存庫的情況下有用。

備註

除了字串選項還存在開關選項,用於向後相容。

The options are:

"none"

無每日更新。

"remote" also False

只更新遠端儲存庫。

"full" 也為 True

更新遠端,並合併工作副本。

備註

這需要 使用 Celery 的後台任務 工作,並在重啟後生效。

AVATAR_URL_PREFIX

構成頭像 URL 的前綴為: ${AVATAR_URL_PREFIX}/avatar/${MAIL_HASH}?${PARAMS}。已知後面的服務工作:

Gravatar (預設),根據 https://gravatar.com/

AVATAR_URL_PREFIX = 'https://www.gravatar.com/'

Libravatar,如 https://www.libravatar.org/

AVATAR_URL_PREFIX = 'https://www.libravatar.org/'

AUTH_TOKEN_VALID

身份驗證令牌和密碼重置電子郵件中臨時密碼的有效時間。以秒為單位,預設為 172800( 2 天)。

AUTH_PASSWORD_DAYS

How many days Weblate rejects reusing a previously used password for a user.

The checking is based on the audit log, AUDITLOG_EXPIRY needs to be at least same as this.

備註

自動修復很強大,但可能導致損壞;寫腳本的時候要小心。

預設為 180 天。

AUTOFIX_LIST

當儲存字串時應用自動修復列表。

備註

Provide a fully-qualified path to the Python class that implements the autofixer interface.

可用的修復:

weblate.trans.autofixes.whitespace.SameBookendingWhitespace

將字串開始與結尾的空白字元與元字串匹配。

weblate.trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis

替換連續的點 (…),如果來源字串有一個對應的省略號 (…)。

weblate.trans.autofixes.chars.RemoveZeroSpace

去掉零寬度字元,如果源字串不包含的話。

weblate.trans.autofixes.chars.RemoveControlChars

去掉控製字元,如果源字串不包含的話。

weblate.trans.autofixes.chars.DevanagariDanda

Replaces sentence full stop in Bangla by the devanagari danda character.

weblate.trans.autofixes.html.BleachHTML

從標記為 safe-html 的字串中去掉不安全的 HTML 標記( 請參見 不安全的 HTML )。

可以選取使用哪一個:

AUTOFIX_LIST = (
    "weblate.trans.autofixes.whitespace.SameBookendingWhitespace",
    "weblate.trans.autofixes.chars.ReplaceTrailingDotsWithEllipsis",
)

BACKGROUND_TASKS

Added in version 4.5.2.

定義應為元件觸發冗長的維護任務的頻率。

此刻的控制項:

可能的選項:

  • ``每月``(這是預設值)

  • weekly

  • daily

  • never

備註

當WebLate包含數千個元件時,不建議不要增加頻率。

BASIC_LANGUAGES

Added in version 4.4.

List of languages to offer users for starting a new translation. When not specified, a built-in list is used (which includes all commonly used languages, but without country specific variants).

This only limits non privileged users to add unwanted languages. Project admins are still presented with the full selection of languages defined in Weblate.

備註

This does not define new languages for Weblate — it only filters existing ones in the database.

示例:

BASIC_LANGUAGES = {"cs", "it", "ja", "en"}

也參考

語言定義

BORG_EXTRA_ARGS

Added in version 4.9.

您可以帶入額外的參數在 :command:`borg create`中使用,當觸發內建的備份機制時。

示例:

BORG_EXTRA_ARGS = ["--exclude", "vcs/"]

也參考

borg listborg extract

CACHE_DIR

Added in version 4.16.

Directory where Weblate stores cache files. Defaults to cache subfolder in DATA_DIR.

Change this to local or temporary filesystem if DATA_DIR is on a network filesystem.

Docker 容器為這個使用了一個單獨的捲,請參閱 Docker 容器 volumes

後面的子目錄通常存在:

fonts

font-config cache for 管理字型.

avatar

Cached user avatars, see 頭像.

static

靜態 Django 檔案的預設位置,由 django:STATIC_ROOT`指定。見 :ref:`static-files

tesseract

OCR trained data for 字串的可見語境.

csp_script_src,csp_img_src,csp_connect_src,csp_style_src,csp_font_src

Customize Content-Security-Policy header for Weblate. The header is automatically generated based on enabled integrations with third-party services (Matomo, Google Analytics, Sentry, …).

這些預設為空列表。

示例:

# Enable Cloudflare Javascript optimizations
CSP_SCRIPT_SRC = ["ajax.cloudflare.com"]

CHECK_LIST

翻譯時執行的品質檢查列表。

備註

為實施檢查界面的 Python 類提供完全合規的路徑。

調整檢查列表,來包括與您相關的那些檢查。

All built-in 品質檢查 are turned on by default, from where you can change these settings. By default they are commented out in 組態的例子 so that default values are used. New checks are then carried out for each new Weblate version.

可以關閉所有檢查:

CHECK_LIST = ()

可以只打開一部分檢查:

CHECK_LIST = (
    "weblate.checks.chars.BeginNewlineCheck",
    "weblate.checks.chars.EndNewlineCheck",
    "weblate.checks.chars.MaxLengthCheck",
)

備註

Changing this setting only affects newly changed translations. Existing checks will still be stored in the database. To also apply changes to the stored translations, run updatechecks.

COMMENT_CLEANUP_DAYS

在一定天數後刪除註釋。預設為 None,意味著不刪除。

COMMIT_PENDING_HOURS

通過後台任務方式送交待定的更改之間的小時數。

CONTACT_FORM

Added in version 4.6.

Configures how e-mail from the contact form is being sent. Choose a configuration that matches the configuration of your mail server.

"回覆到"

寄件人用於:MailHeader:“回覆”,這是預設行為。

"來自"

寄件人為:mailheader:From, 您的電子郵箱伺服器需要允許傳送此類郵件。

也參考

ADMINS_CONTACT

DATA_DIR

Weblate 資料夾將所有資料儲存其中。它包含到版本控制系統(VCS )儲存庫的連結,全文索引和外部工具的各種組態檔。

後面的子目錄通常存在:

home

Home 目錄用於呼叫腳本。

ssh

SSH 金鑰和組態。

media

Django 媒體檔案的預設位置,由 django:MEDIA_ROOT`指定。包含已上傳的截圖,見 :ref:`screenshots

vcs

Version-control repositories for translations.

backups

Daily backup data. Please check 下載的資料用於備份 for details.

fonts

使用者已上傳的字型,參閱: 管理字型

cache

Various caches. Can be placed elsewhere using CACHE_DIR.

Docker 容器為這個使用了一個單獨的捲,請參閱 Docker 容器 volumes

備註

這個目錄必須由 Weblate 寫入。執行作為 uWSGI 意味著 www-data 使用者應該對它具有寫入權限。

實現這個的最簡單方式是讓使用者作為目錄的所有者:

sudo chown www-data:www-data -R $DATA_DIR

預設為 /home/weblate/data,但預期需要被設定。

DATABASE_BACKUP

資料庫備份應該儲存為純文字,壓縮還是跳過。授權值為:

  • "plain"

  • "compressed"

  • "none"

DEFAULT_ACCESS_CONTROL

The default access-control setting for new projects:

0

Public

1

Protected

100

Private

200

Custom

如果手動管理 ACL 則使用 Custom,這意味著不相依於 Weblate 內部管理。

DEFAULT_AUTO_WATCH

Added in version 4.5.

組態是否自動觀看貢獻的專案,應該開放給新使用者。預設為 true

也參考

通知

DEFAULT_RESTRICTED_COMPONENT

Added in version 4.1.

組件限制的預設值。

default_add_message,default_addon_message,default_commit_message,default_delete_message,default_merge_message

不同操作的預設執行資訊,細節請查閱 組件組態

DEFAULT_ADDONS

Default add-ons to install for every created component.

備註

此設定只影響新建立的組件。

範例:

DEFAULT_ADDONS = {
    # Add-on with no parameters
    "weblate.flags.target_edit": {},
    # Add-on with parameters
    "weblate.autotranslate.autotranslate": {
        "mode": "suggest",
        "filter_type": "todo",
        "auto_source": "mt",
        "component": "",
        "engines": ["weblate-translation-memory"],
        "threshold": "80",
    },
}

DEFAULT_COMMITER_EMAIL

Committer e-mail address, defaulting to noreply@weblate.org.

DEFAULT_COMMITER_NAME

Committer name, defaulting to Weblate.

DEFAULT_LANGUAGE

Added in version 4.3.2.

來源語言 for any new components.

預設為 en。匹配的語言對象需要存在於資料庫中。

DEFAULT_MERGE_STYLE

合併類型 for any new components.

  • rebase - 預設

  • merge

DEFAULT_SHARED_TM

Configures the default value of 使用共享的翻譯記憶 and 貢獻至共享翻譯記憶.

DEFAULT_TRANSLATION_PROPAGATION

翻譯傳播的預設設定,預設為 True

DEFAULT_PULL_MESSAGE

為拉取請求組態預設的標題與訊息。

ENABLE_AVATARS

Whether to turn on Gravatar-based avatars for users. On by default.

頭像取出並快取在從伺服器中,降低了洩漏個人資訊的風險,加速了使用者體驗。

ENABLE_HOOKS

Whether to turn on anonymous remote hooks.

也參考

通知掛勾

ENABLE_HTTPS

將連結作為 HTTPS 還是 HTTP 傳送給 Weblate。這個設定影響傳送電子郵件,並產生絕對 URL。

In the default configuration this is also used for several Django settings related to HTTPS — it enables secure cookies, toggles HSTS or enables redirection to a HTTPS URL.

The HTTPS redirection might be problematic in some cases and you might hit an issue with infinite redirection in case you are using a reverse proxy doing an SSL termination which does not correctly pass protocol headers to Django. Please tweak your reverse proxy configuration to emit X-Forwarded-Proto or Forwarded headers or configure SECURE_PROXY_SSL_HEADER to let Django correctly detect the SSL status.

也參考

:設定:django:session_cookie_secure,:設定:django:csrf_cookie_secure,:設定:django:secure_sl_redirect

ENABLE_SHARING

開啟/關閉 Share 選單,讓使用者能夠將翻譯過程分享到社交網路上。

EXTRA_HTML_HEAD

Added in version 4.15.

Insert additional markup into the HTML header. Can be used for verification of site ownership, for example:

EXTRA_HTML_HEAD = '<link href="https://fosstodon.org/@weblate" rel="me">'

警告

No sanitization is performed on the string. It is inserted as-is into the HTML header.

GET_HELP_URL

Added in version 4.5.2.

可以找到您的 Weblate 實例支援的 URL。

GITEA_CREDENTIALS

Added in version 4.12.

用於 Gitea 伺服器的憑證列表。

GITEA_CREDENTIALS = {
    "try.gitea.io": {
        "username": "weblate",
        "token": "your-api-token",
    },
}

The configuration dictionary consists of credentials defined for each API host. The layout is same for almost all version control integrations and is described at Configuring version control credentials.

GITLAB_CREDENTIALS

Added in version 4.3.

用於 GitLab 伺服器的證明列表。

GITLAB_CREDENTIALS = {
    "gitlab.com": {
        "username": "weblate",
        "token": "your-api-token",
    },
}

The configuration dictionary consists of credentials defined for each API host. The layout is same for almost all version control integrations and is described at Configuring version control credentials.

GITHUB_CREDENTIALS

Added in version 4.3.

用於 GitHub 伺服器的證明列表。

GITHUB_CREDENTIALS = {
    "api.github.com": {
        "username": "weblate",
        "token": "your-api-token",
    },
}

提示

Use api.github.com as a API host for https://github.com/.

The configuration dictionary consists of credentials defined for each API host. The layout is same for almost all version control integrations and is described at Configuring version control credentials.

BITBUCKETSERVER_CREDENTIALS

Added in version 4.16.

List for credentials for Bitbucket servers.

BITBUCKETSERVER_CREDENTIALS = {
    "git.self-hosted.com": {
        "username": "weblate",
        "token": "http-access-token",
    },
}

The configuration dictionary consists of credentials defined for each API host. The layout is same for almost all version control integrations and is described at Configuring version control credentials.

AZURE_DEVOPS_CREDENTIALS

Added in version 5.2.

List for credentials for Azure DevOps servers.

AZURE_DEVOPS_CREDENTIALS = {
    "dev.azure.com": {
        "username": "project-name",
        "token": "your-api-token",
        "organization": "organization-name",
    },
}

The configuration dictionary consists of credentials defined for each API host. The API host might be different from what you use in the web browser, for example GitHub API is accessed as api.github.com.

The following configuration is available for each host:

username

The name of the Azure DevOps project. This is not the repository name.

organization

The name of the organization of the project.

workItemIds

An optional list of work items IDs from your organization. When provided new pull requests will have these attached.

token

API token for the API user, required.

Additional settings not described here can be found at Configuring version control credentials.

GOOGLE_ANALYTICS_ID

Google Analytics ID 開啟使用 Google Analytics 在 Weblate 的網頁追蹤分析。

HIDE_REPO_CREDENTIALS

隱藏儲存庫憑據避免出現在 web 介面中。在儲存庫網址帶有使用者名稱和密碼的情況下, Weblate 會在相關資訊顯示給使用者時將其隱藏起來。

例如除了 https://user:password@git.example.com/repo.git 會只顯示 https://git.example.com/repo.git。它也試圖以相似的方式清除版本控制系統(VCS )錯誤資訊。

備註

On by default.

HIDE_VERSION

Added in version 4.3.1.

Hides version info from unauthenticated users. This also makes all documentation links point to the latest version instead of the documentation matching the currently installed version.

Hiding the version is a recommended security practice in some corporations, does not prevent an attacker from figuring out version by probing behavior.

備註

此預設為關閉。

INTERLEDGER_PAYMENT_POINTERS

Added in version 4.12.1.

用於網頁貨幣化的 Interledger Payment Pointers (ILPs) 的列表。

若指定多組,probabilistic revenue sharing 將隨機挑選一組分配。

請參閱 <https://webmonetization.org/> 了解更多。

提示

此預設值讓使用者能為自己的 Weblate 募資。

IP_BEHIND_REVERSE_PROXY

指示 Weblate 是否在反向代理後面執行。

如果設定為 True, Weblate 會從 :setting:`IP_PROXY_HEADER`定義的標頭中得到 IP 地址。

警告

確保真正使用反向代理,並且設定了這個標頭,否則使用者將能夠假冒 IP 地址。

備註

預設這不是開啟的。

IP_PROXY_HEADER

指示當 IP_BEHIND_REVERSE_PROXY 開啟時,Weblate應該從那個標頭得到 IP 地址。

預設為 HTTP_X_FORWARDED_FOR

也參考

:ref:“反向代理”,:ref:“速率限制”,:設定:“Django:secure_proxy_sl_header`,:設定:ip_behind_reverse_proxy,:設定:Ip_proxy_offset

IP_PROXY_OFFSET

在 5.0.1 版的變更: The default changed from 1 to -1.

指示 IP_PROXY_HEADER 的哪部分用作客戶端 IP 地址。

Depending on your setup, this header might consist of several IP addresses, (for example X-Forwarded-For: client-ip, proxy-a, proxy-b) and you can configure which address from the header is used as client IP address here.

警告

Setting this affects the security of your installation. You should only configure it to use trusted proxies for determining the IP address. Please check <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For#security_and_privacy_concerns> for more details.

Defaults to -1.

也參考

:ref:“反向代理”,:ref:“速率限制”,:設定:“Django:secure_proxy_ssl_header`,:設定:ip_behind_reverse_proxy,:設定:``ip_proxy_header`

LICENSE_EXTRA

包括在許可選擇中的其他許可。

備註

每個許可的定義應該是其短名稱、長名稱和 URL 的元組。

例如:

LICENSE_EXTRA = [
    (
        "AGPL-3.0",
        "GNU Affero General Public License v3.0",
        "https://www.gnu.org/licenses/agpl-3.0-standalone.html",
    ),
]

LICENSE_FILTER

在 4.3 版的變更: 將其設定為空值現在關閉了許可提醒。

要顯示的被篩選的許可列表。在設定為空時還關閉了許可提醒。

備註

這個過濾器使用了短許可名稱。

例如:

LICENSE_FILTER = {"AGPL-3.0", "GPL-3.0-or-later"}

後面關閉了許可提醒:

LICENSE_FILTER = set()

也參考

翻譯組件警告

LICENSE_REQUIRED

定義了是否需要 組件組態 中的許可屬性。

備註

預設這是關閉的。

LIMIT_TRANSLATION_LENGTH_BY_SOURCE_LENGTH

Whether the length of a given translation should be limited. The restriction is the length of the source string × 10 characters.

提示

Set this to False to allow longer translations (up to 10,000 characters) irrespective of source string length.

備註

預設為 True.

LOCALIZE_CDN_URL 和 LOCALIZE_CDN_PATH

這些設定組態了 JavaScript 在地化 CDN 外掛。 LOCALIZE_CDN_URL 定義了可獲得在地化 CDN 的根 URL,而 LOCALIZE_CDN_PATH 定義了 Weblate 應該儲存產生檔案的路徑,產生的檔案在 LOCALIZE_CDN_URL 使用。

提示

在 Hosted Weblate 中,這使用 https://weblate-cdn.com/

LOGIN_REQUIRED_URLS

您希望需要登入的網址列表。 (除了 Weblate 內建立的標準規則)。

提示

這允許密碼保護整個安裝,透過使用:

LOGIN_REQUIRED_URLS = (r"/(.*)$",)
REST_FRAMEWORK["DEFAULT_PERMISSION_CLASSES"] = [
    "rest_framework.permissions.IsAuthenticated"
]

提示

同樣想要鎖住 API 存取,如上面的例子所示。

也參考

REQUIRE_LOGIN

LOGIN_REQUIRED_URLS_EXCEPTIONS

List of exceptions for LOGIN_REQUIRED_URLS. If not specified, users are allowed to access the sign-in page.

See the 組態的例子 for recommended configuration of this setting.

MATOMO_SITE_ID

ID of the site in Matomo (formerly Piwik) you want to use for tracking Weblate.

備註

這個整合不支援 Matomo Tag Manager。

也參考

MATOMO_URL

MATOMO_URL

您想要追蹤的 Matomo (以前的 Piwik )安裝的全 URL (包括反斜杠)。更多細節請查閱 <https://matomo.org/>。

提示

這個整合不支援 Matomo Tag Manager。

例如:

MATOMO_SITE_ID = 1
MATOMO_URL = "https://example.matomo.cloud/"

也參考

MATOMO_SITE_ID

NEARBY_MESSAGES

在檢視目前翻譯字串時顯示多少字串。這只是預設值,使用者可以在 :ref:`user-profile`中調整。

DEFAULT_PAGE_LIMIT

Added in version 4.7.

當啟用分頁功能時,預設顯示多少數量。

PAGURE_CREDENTIALS

Added in version 4.3.2.

Pagure伺服器憑據列表。

PAGURE_CREDENTIALS = {
    "pagure.io": {
        "username": "weblate",
        "token": "your-api-token",
    },
}

The configuration dictionary consists of credentials defined for each API host. The layout is same for almost all version control integrations and is described at Configuring version control credentials.

PRIVACY_URL

Added in version 4.8.1.

您的 Weblate 執行個體顯示其法律文件的 URL。

提示

在將您的法律文件保存在 Weblate 之外,而將其嵌入 Weblate 的情況下有用。細節請查看 法律

範例:

PRIVACY_URL = "https://weblate.org/terms/"

也參考

LEGAL_URL

PRIVATE_COMMIT_EMAIL_OPT_IN

Added in version 4.15.

Configures whether the private commit e-mail is opt-in or opt-out (by default it is opt-in).

提示

This setting only applies to users which have not explicitly chosen a commit e-mail.

PRIVATE_COMMIT_EMAIL_TEMPLATE

Added in version 4.15.

產生隱藏的送交者郵件信箱格式。預設為 "{username}@users.noreply.{site_domain}"

設定不允許空白字串。

備註

使用不同的送交用的郵件信箱是可選用的,除非已設定為 PRIVATE_COMMIT_EMAIL_OPT_IN 。使用者可以設定送交用的郵件信箱於 個人檔案

PROJECT_BACKUP_KEEP_COUNT

Added in version 4.14.

Defines how many backups per project are kept on the server. Defaults to 3.

PROJECT_BACKUP_KEEP_DAYS

Added in version 4.14.

定義每個專案的備份將存放多久在伺服器上。預設為 30 天。

PROJECT_NAME_RESTRICT_RE

Added in version 4.15.

使用正則表達式定義專案的命名方式。任何相符合規則的將會駁回。

也參考

專案名稱

PROJECT_WEB_RESTRICT_HOST

Added in version 4.16.2.

Reject using certain hosts in project website. Any subdomain is matched, so including example.com will block test.example.com as well. The list should contain lower case strings only, the parsed domain is lower cased before matching.

Default configuration:

PROJECT_WEB_RESTRICT_HOST = {"localhost"}

PROJECT_WEB_RESTRICT_NUMERIC

Added in version 4.16.2.

Reject using numeric IP address in project website. On by default.

PROJECT_WEB_RESTRICT_RE

Added in version 4.15.

使用正則表達式定義專案的網站網址。任何相符合規則的網址將會駁回。

RATELIMIT_ATTEMPTS

在應用次數限制前,身份認證嘗試的最多次數。

預設為 5。

RATELIMIT_WINDOW

應用次數限制後,可接受多少次身份認證。

An amount of seconds, defaulting to 300 (5 minutes).

RATELIMIT_LOCKOUT

在應用次數限制後,身份認證鎖定多久。

秒數預設為 600 ( 10 分鐘)。

REGISTRATION_ALLOW_BACKENDS

Added in version 4.1.

身份驗證後端的列表,允許從中註冊。這只限制新的註冊,使用者可以使用組態的身份驗證後端,來進行身份驗證和新增身份驗證。

It is recommended to keep REGISTRATION_OPEN on while limiting registration backends, otherwise users will be able to register, but Weblate will not show links to register in the user interface.

範例:

REGISTRATION_ALLOW_BACKENDS = ["azuread-oauth2", "azuread-tenant-oauth2"]

提示

The backend names match names used in the URL for authentication.

REGISTRATION_CAPTCHA

Whether registration of new accounts is protected by a CAPTCHA. Defaults to enabled.

如果開啟,CAPTCHA 會新增到使用者輸入其電子郵箱地址的所有頁面中:

  • 註冊新帳號。

  • 找回密碼。

  • 將電子郵箱地址新增到帳戶中。

  • 供未登入使用者使用的聯絡表單。

REGISTRATION_EMAIL_MATCH

允許您篩選哪個電子郵箱地址可以註冊。

預設為 .*,允許使用任何電子郵箱地址註冊。

可以用它限制註冊到單一的電子郵箱域名:

REGISTRATION_EMAIL_MATCH = r"^.*@weblate\.org$"

REGISTRATION_OPEN

Whether registration of new accounts is currently permitted. Defaults to enabled.

這個設定影響了內建的透過電子郵箱地址或透過 Python Social Auth 的身份驗證( 可以使用 REGISTRATION_ALLOW_BACKENDS 為適當的後端建立白名單)。

備註

如果使用第三方身份驗證方法,如 LDAP 身份驗證,只是隱藏註冊表單,而新使用者仍然能夠登入並建立帳戶。

REGISTRATION_REBIND

Added in version 4.16.

Allow rebinding authentication backends for existing users. Turn this on when migrating between authentication providers.

備註

Off by default to not allow adding other authentication backends to an existing account. Rebinding can lead to account compromise when using more third-party authentication backends.

REPOSITORY_ALERT_THRESHOLD

Added in version 4.0.2.

觸發儲存庫過期警告的門檻值,或者包含了太多更改的門檻值。預設為 25。

也參考

翻譯組件警告

REQUIRE_LOGIN

Added in version 4.1.

這會啟用 LOGIN_REQUIRED_URLS 並組態 REST 框架來對所有 API 端點都要求登入。

備註

這實現在 sample-configuration`中。對於 Docker,使用 :envvar:`WEBLATE_REQUIRE_LOGIN

SENTRY_DSN

Sentry DSN 用於 Collecting error reports and monitoring performance

SENTRY_ENVIRONMENT

Configures environment for Sentry. Defaults to devel.

SENTRY_PROFILES_SAMPLE_RATE

Configure sampling rate for performance monitoring. Set to 1 to trace all events, 0 (the default) disables tracing.

SENTRY_SEND_PII

Allow Sentry to collect certain personally identifiable information. Turned on by default.

SENTRY_TRACES_SAMPLE_RATE

Configure sampling rate for profiling monitoring. Set to 1 to trace all events, 0 (the default) disables tracing.

也參考

Sentry Profiling

SIMPLIFY_LANGUAGES

對於預設語言/國家組合使用簡單語言代碼。例如, fr_FR 翻譯將使用 fr 語言代碼。這通常是受歡迎的特性,因為它簡化了這些預設組合列出的語言。

如果對每種不同的變化想要不同的翻譯,那麼請將其關閉。

SITE_DOMAIN

Configures site domain. Necessary to produce correct absolute links in many scopes (for example activation e-mails, notifications or RSS feeds).

If Weblate is running on a non-standard port, include it here as well.

範例:

# Production site with domain name
SITE_DOMAIN = "weblate.example.com"

# Local development with IP address and port
SITE_DOMAIN = "127.0.0.1:8000"

備註

This setting should only contain the domain name. For configuring protocol, (turning on and enforcing HTTPS) use ENABLE_HTTPS and for changing the URL, use URL_PREFIX.

提示

關於 Docker 容器,網站域名透過 WEBLATE_ALLOWED_HOSTS 來組態。

也參考

:ref:“生產現場”,:ref:“生產 - 主機”,:ref:“生產-SSL`:envvar:”WebLate_Site_Domain“,:設定:”enable_https`

SITE_TITLE

用於網站和傳送電子郵件的網站名稱。

SPECIAL_CHARS

螢幕鍵盤中包括的另外的字元, 模擬鍵盤

預設值為:

SPECIAL_CHARS = ("\t", "\n", "\u00a0", "…")

SINGLE_PROJECT

Redirects users directly to a project or component instead of showing the dashboard. You can either set it to True so it only works if there is actually only single project in Weblate. Alternatively, set the project slug, and it will redirect unconditionally to this project.

範例:

SINGLE_PROJECT = "test"

SSH_EXTRA_ARGS

Added in version 4.9.

Allows adding custom parameters when Weblate is invoking SSH. Useful when connecting to servers using legacy encryption or other non-standard features.

For example when SSH connection in Weblate fails with Unable to negotiate with legacyhost: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1, you can turn that on using:

SSH_EXTRA_ARGS = "-oKexAlgorithms=+diffie-hellman-group1-sha1"

提示

The string is evaluated by the shell, so ensure any whitespace and special characters is quoted.

STATUS_URL

Weblate 事例報告其狀態的 URL。

SUGGESTION_CLEANUP_DAYS

指示當 IP_BEHIND_REVERSE_PROXY 開啟時,Weblate應該從那個標頭得到 IP 地址。

SUPPORT_STATUS_CHECK

Added in version 5.5.

Disables semiannual support status check and redirecting superusers upon login to the donation page in case there is no active support subscription.

提示

Improve your Weblate experience by purchasing a support subscription and boosting Weblate progress instead of turning this off.

UNUSED_ALERT_DAYS

Added in version 4.17.

Configures when the Component seems unused alert is triggered.

Defaults to 365 days, set to 0 to turn it off.

UPDATE_LANGUAGES

Added in version 4.3.2.

Controls whether languages database should be updated when running database migration and is on by default. This setting has no effect on invocation of setuplang.

警告

The languages display might become inconsistent with this. Weblate language definitions expand over time and it will not display language code for the defined languages.

URL_PREFIX

這個設定允許在一些路徑下執行 Weblate (否則它相依於從 web 伺服器根目錄運行)。

備註

為了使用這個設定,還需要組態伺服器來去掉這個字首。例如 WSGI,可以透過設定 WSGIScriptAlias 來實現。

提示

字首應該以 / 開始。

範例:

URL_PREFIX = "/translations"

備註

這個設定在 Django’s 內建伺服器中不起作用,必須調整 urls.py 來包含這個前綴。

VCS_API_DELAY

Added in version 4.15.1.

Configures minimal delay in seconds between third-party API calls in GitHub pull requests, GitLab 合併請求, Gitea pull requests, Pagure 合併請求, and Azure DevOps pull requests.

從 Weblate 到服務 API 呼叫速率限制可避免過載使用。

If you are being limited by secondary rate-limiter at GitHub, increasing this might help.

預設值為 10。

VCS_BACKENDS

可用的版本控制系統( VCS )後端的組態。

備註

Weblate 嘗試使用您所有工具支援的後端。

提示

可以使用這個來限制選擇或新增客製版本控制系統 ( VCS )後端。

VCS_BACKENDS = ("weblate.vcs.git.GitRepository",)

也參考

版本控制整合

VCS_CLONE_DEPTH

組態 Weblate 應該對儲存庫進行深度為多少的克隆。

備註

目前這只在 Git 中支援。預設 Weblate 進行儲存庫的淺克隆,使克隆更快並節省磁盤空間。根據應用(例如當使用客製的 附加元件 時),您可能想要增加深度,或通過設定為 0 來完全關閉淺克隆。

提示

在從 Weblate 推送而得到 fatal: protocol error: expected old/new/ref, got 'shallow <commit hash>' 錯誤的情況下,通過設定來完全關閉淺克隆:

VCS_CLONE_DEPTH = 0

WEBLATE_ADDONS

附加元件可供使用的附加元件列表。為了使用,必須對給定的翻譯元件允許它們。預設包括了所有內建附加元件,當擴展列表時您可能希望保持現有的附加元件處於啟用狀態,例如:

WEBLATE_ADDONS = (
    # Built-in add-ons
    "weblate.addons.gettext.GenerateMoAddon",
    "weblate.addons.gettext.UpdateLinguasAddon",
    "weblate.addons.gettext.UpdateConfigureAddon",
    "weblate.addons.gettext.MsgmergeAddon",
    "weblate.addons.gettext.GettextCustomizeAddon",
    "weblate.addons.gettext.GettextAuthorComments",
    "weblate.addons.cleanup.CleanupAddon",
    "weblate.addons.consistency.LangaugeConsistencyAddon",
    "weblate.addons.discovery.DiscoveryAddon",
    "weblate.addons.flags.SourceEditAddon",
    "weblate.addons.flags.TargetEditAddon",
    "weblate.addons.flags.SameEditAddon",
    "weblate.addons.flags.BulkEditAddon",
    "weblate.addons.generate.GenerateFileAddon",
    "weblate.addons.json.JSONCustomizeAddon",
    "weblate.addons.xml.XMLCustomizeAddon",
    "weblate.addons.properties.PropertiesSortAddon",
    "weblate.addons.git.GitSquashAddon",
    "weblate.addons.removal.RemoveComments",
    "weblate.addons.removal.RemoveSuggestions",
    "weblate.addons.resx.ResxUpdateAddon",
    "weblate.addons.autotranslate.AutoTranslateAddon",
    "weblate.addons.yaml.YAMLCustomizeAddon",
    "weblate.addons.cdn.CDNJSAddon",
    # Add-on you want to include
    "weblate.addons.example.ExampleAddon",
)

備註

Removing the add-on from the list does not uninstall it from the components. Weblate will crash in that case. Please uninstall the add-on from all components prior to removing it from this list.

WEBLATE_EXPORTERS

Added in version 4.2.

可用的導出程序列表,提供下載各種文件格式的翻譯或詞彙表。

WEBLATE_FORMATS

可供使用的文件格式列表。

備註

預設列表已經具有了常見格式。

WEBLATE_MACHINERY

Added in version 4.13.

List of machinery services available for use.

也參考

自動建議

WEBLATE_GPG_IDENTITY

Weblate 使用的身份,用於登入 Git Commits,例如:

WEBLATE_GPG_IDENTITY = "Weblate <weblate@example.com>"

搜尋 Weblate GPG 鑰匙鏈(home/.gnupg,在 DATA_DIR 之下)。如果沒有找到,則產生金鑰,更多細節請查詢 簽署 GnuPG 的 Git 承諾

WEBSITE_REQUIRED

Defines whether 專案網站 has to be specified when creating a project. On by default, as that suits public server setups.

Configuring version control credentials

提示

This section describes VCS credential variables as GITHUB_CREDENTIALS, GITLAB_CREDENTIALS, GITEA_CREDENTIALS, PAGURE_CREDENTIALS, BITBUCKETSERVER_CREDENTIALS.

The configuration dictionary consists of credentials defined for each API host. The API host might be different from what you use in the web browser, for example GitHub API is accessed as api.github.com.

The following configuration is available for each host:

username

API user, required.

token

API token for the API user, required.

scheme

Added in version 4.18.

Scheme override. Weblate attempts to parse scheme from the repository URL and falls backs to https. If you are running the API server internally, you might want to use http instead, but consider security.

提示

In the Docker container, the credentials can be configured using environment variables, see Code hosting sites credentials.