配置

所有的設定儲存在 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"]

也參考

ALLOWED_ASSET_DOMAINS

在 5.14 版被加入.

Configures which domains are allowed for fetching assets in Weblate.

This enhances security by preventing loading assets from untrusted sources. Assets are downloaded once by the Weblate server and stored locally, rather than being served directly from external domains to users.

The allowlist is applied to the initial URL and to every HTTP redirect target before Weblate follows it. Redirects to hosts outside of this allowlist are rejected.

It expects a list of host/domain names. You can use fully qualified names (e.g www.example.com) or prepend with a period as a wildcard to match all subdomains (e.g .example.com will match cdn.example.com or static.example.com).

Defaults to ["*"], which allows all domains.

範例

ALLOWED_ASSET_DOMAINS = [
    # Allows only cdn.anotherdomain.org
    "cdn.anotherdomain.org",
    # Allows example.com and all its subdomains
    ".example.com",
]

This is currently used in the following places:

ALLOWED_MACHINERY_DOMAINS

Configures which custom machinery domains are explicitly allowed in project-level machine translation configuration.

This setting applies only to machinery services and does not affect ALLOWED_ASSET_DOMAINS.

It expects a list of host/domain names. You can use fully qualified names or prepend with a period as a wildcard to match all subdomains.

預設為 []

The allowlist affects project-managed machinery in two ways: it permits the configured endpoint during outbound validation, and it marks matching hosts as trusted when deciding whether remote provider error details or response bodies can be shown to the user. For direct connections, runtime checks still reject destinations that resolve to private or otherwise non-public addresses. When an HTTP(S) proxy is used, runtime validation falls back to hostname validation and does not perform the same local DNS or peer-IP checks.

ALLOWED_ASSET_SIZE

在 5.14 版被加入.

Configures size limit for fetching assets in Weblate. Defaults to 10 MB.

ASSET_PRIVATE_ALLOWLIST

在 2025.5 版被加入.

Defines hostnames or domains exempt from ASSET_RESTRICT_PRIVATE for remote asset downloads that enforce private-target checks. Entries follow Django host matching semantics, so values such as assets.internal.example or .internal.example can be used.

This does not replace ALLOWED_ASSET_DOMAINS; remote assets must still match the asset domain allowlist.

預設配置:

ASSET_PRIVATE_ALLOWLIST = []

ASSET_RESTRICT_PRIVATE

在 2025.5 版被加入.

Reject remote asset URLs pointing to internal or non-public addresses unless the target host is included in ASSET_PRIVATE_ALLOWLIST. On by default.

When enabled, hostnames that cannot be resolved during validation are rejected unless they are explicitly included in ASSET_PRIVATE_ALLOWLIST. This currently applies to screenshot URL uploads and remote HTML downloads for the JavaScript 在地化 CDN add-on.

ALTCHA_COST

在 5.18 版被加入.

Argon2id time cost for the ALTCHA proof-of-work challenge. Defaults to 3.

Replaces ALTCHA_MAX_NUMBER, which applied to the removed ALTCHA widget v2.

ALTCHA_MEMORY_COST

在 5.18 版被加入.

Argon2id memory cost in KiB. Defaults to 65536.

ALTCHA_PARALLELISM

在 5.18 版被加入.

Argon2id parallelism factor. Defaults to 1.

ANONYMOUS_USER_NAME

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

也參考

存取控制

AUDITLOG_EXPIRY

The maximum number of days Weblate will keep audit logs containing information about the 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 儲存庫的情況下有用。

備註

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

選項有:

"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.

Available fixes are described at 自動修正.

可以選取使用哪一個:

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

BACKGROUND_TASKS

在 4.5.2 版被加入.

定義應為組件觸發冗長的維護工作的頻率。

此刻的控制項:

可能的選項:

  • 每月 (這是預設值)

  • weekly

  • daily

  • never

備註

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

BASIC_LANGUAGES

在 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

在 4.9 版被加入.

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

範例:

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

CACHE_DIR

在 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.

Weblate stores generated helper files here and executes some of them, so CACHE_DIR has to be writable and mounted on a filesystem that allows execution. Avoid using noexec mount options for this directory.

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

後面的子目錄通常存在:

ssh

Generated helper files used for VCS access.

fonts

font-config cache for 管理字型.

avatar

Cached user avatars, see 頭像.

static

靜態 Django 檔案的預設位置,由 STATIC_ROOT 指定。見 靜態檔案服務

tesseract

OCR trained data for Screenshots and visual context.

CSP_SCRIPT_SRC, CSP_IMG_SRC, CSP_CONNECT_SRC, CSP_STYLE_SRC, CSP_FONT_SRC, CSP_FORM_SRC

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

All these default to an empty list.

範例:

# 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.

COMMIT_PENDING_HOURS

通過背景工作方式提交待定的變更之間的小時數。

COMPONENT_ZIP_UPLOAD_MAX_SIZE

在 5.17.1 版被加入.

Configures the maximum size, in bytes, for uploaded component ZIP files. Defaults to 50 MB.

In Docker, configure this using the WEBLATE_COMPONENT_ZIP_UPLOAD_MAX_SIZE environment variable.

也參考

CONTACT_FORM

在 4.6 版被加入.

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

"reply-to"

The sender is used as Reply-To, this is the default behaviour.

"from"

The sender is used as From. Your mail server needs to allow sending such e-mails.

"disabled"

Disables the contact form entirely.

在 5.15 版被加入.

也參考

ADMINS_CONTACT

DATA_DIR

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

後面的子目錄通常存在:

home

Home 目錄用於呼叫指令碼。

ssh

SSH 金鑰和配置。

media

Django 媒體檔案的預設位置,由 MEDIA_ROOT 指定。包含已上傳的螢幕擷圖,見 Screenshots and visual context

vcs

用於翻譯的版本控制儲存庫。

backups

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

fonts

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

cache

Various caches. Can be placed elsewhere using CACHE_DIR.

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

備註

This directory has to be writable by Weblate. Running it as WSGI means the www-data user should have write access to it.

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

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

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

DATABASE_BACKUP

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

  • "plain"

  • "compressed"

  • "none"

DEFAULT_ACCESS_CONTROL

新專案的預設存取控制設定:

0

公開

1

保護

100

私人

200

自訂

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

DEFAULT_AUTO_WATCH

在 4.5 版被加入.

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

也參考

通知

DEFAULT_RESTRICTED_COMPONENT

在 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

提交者電子郵件位址,預設為 noreply@weblate.org

DEFAULT_COMMITER_NAME

Committer name, defaulting to Weblate.

DEFAULT_LANGUAGE

在 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_REVIEW

在 5.16 版被加入.

Configures the default value for 啟用檢閱, turned off by default.

DEFAULT_SOURCE_REVIEW

在 5.16 版被加入.

Configures the default value for 啟用來源檢閱, turned off by default.

DEFAULT_AUTOCLEAN_TM

在 5.13 版被加入.

Configures the default value of 自動清理翻譯記憶.

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

在 5.7 版的變更: Weblate now requires https for WebAuthn support.

將連結作為 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.

In case this is disabled, Weblate will fail to start with an otp_webauthn.E031 error. You can silence this error by adding it to SILENCED_SYSTEM_CHECKS, but still WebAuthn will not work for sites without HTTPS.

ENABLE_SHARING

Turn on/off the Community menu so users can share translation progress on social networks.

也參考

建立翻譯社群

EXTRA_HTML_HEAD

在 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

在 4.5.2 版被加入.

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

GITEA_CREDENTIALS

在 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 配置版本控制憑證.

GITLAB_CREDENTIALS

在 4.3 版被加入.

用於 GitLab 伺服器的證明清單。

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

備註

The personal access token needs the api scope to be able to use the API.

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 配置版本控制憑證.

GITHUB_CREDENTIALS

在 4.3 版被加入.

用於 GitHub 伺服器的證明清單。

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

備註

It is possible to use both fine-grained personal access tokens and classic personal access tokens. The fine-grained tokens are limited to a single organization, so it won't work if you want Weblate to fork a repository outside the organization (typically to the user namespace).

To clone, push and create pull requests, the read and write access to Contents and Pull requests is required.

Administration might also be necessary for forking a repository if you intend to use forking and the original repository is not public.

提示

Use api.github.com as an 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 配置版本控制憑證.

BITBUCKETSERVER_CREDENTIALS

在 4.16 版被加入.

Bitbucket 資料中心憑證清單。

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 配置版本控制憑證.

BITBUCKETCLOUD_CREDENTIALS

在 5.8 版被加入.

Bitbucket Cloud 伺服器憑證清單。

BITBUCKETCLOUD_CREDENTIALS = {
    "bitbucket.org": {
        "username": "your-email",
        "workspace": "your-workspace-slug",
        "token": "your-api-token",
    },
}

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 使用者。

workspace

The user workspace slug.

token

The API token with pullrequest:write permission.

Additional settings not described here can be found at 配置版本控制憑證.

AZURE_DEVOPS_CREDENTIALS

在 5.2 版被加入.

Azure DevOps 伺服器憑證清單。

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

專案的組織名稱。

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 配置版本控制憑證.

GOOGLE_ANALYTICS_ID

Google Analytics ID to turn on monitoring of Weblate using Google Universal Analytics.

備註

Google Analytics 4 integration is currently not available for Weblate, please see https://github.com/WeblateOrg/weblate/issues/14015.

HIDE_REPO_CREDENTIALS

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

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

備註

預設啟用。

VERSION_DISPLAY

在 5.17 版被加入.

Controls how prominently Weblate exposes its own version.

Supported values are:

show

Show the version in shared UI such as the footer and expose it in GET /api/metrics/.

soft

Hide the version from prominent shared UI, while keeping it discoverable on the About page and in GET /api/metrics/.

hide

Hide the version from shared UI and GET /api/metrics/. This also makes anonymous documentation links point to the latest documentation instead of the version matching the installed release.

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

備註

The default is show.

HIDE_VERSION

在 4.3.1 版被加入.

在 5.17 版之後被棄用.

Compatibility alias for VERSION_DISPLAY. Set this to True to get the same behavior as VERSION_DISPLAY = "hide".

IP_BEHIND_REVERSE_PROXY

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

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

警告

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

備註

預設這不是開啟的。

IP_PROXY_HEADER

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

預設為 HTTP_X_FORWARDED_FOR

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/Reference/Headers/X-Forwarded-For#security_and_privacy_concerns> for more details.

預設為 -1。

LICENSE_EXTRA

包括在授權選擇中的其他授權。

備註

Each license definition should be a tuple of its short name, a long name, a URL and a boolean, indicating whether it is a libre license.

例如:

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

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

These settings configure the CDN add-ons, including JavaScript 在地化 CDN and Translation files CDN. LOCALIZE_CDN_URL defines root URL where the localization CDN is available and LOCALIZE_CDN_PATH defines path where Weblate should store generated files which will be served at the LOCALIZE_CDN_URL. The files are served by your web server or CDN, not by Weblate; see 在地化 CDN for secure serving guidance.

提示

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

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

在完整編輯器中要在各方向顯示的相鄰字串數。

This is just a default value, users can adjust this in 使用者個人檔案.

DEFAULT_PAGE_LIMIT

在 4.7 版被加入.

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

PAGURE_CREDENTIALS

在 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 配置版本控制憑證.

PASSWORD_MINIMAL_STRENGTH

在 5.10.2 版被加入.

Minimal password score as evaluated by the zxcvbn password strength estimator.

Defaults to 0, which means strength checking is disabled.

PASSWORD_RESET_URL

在 5.17 版被加入.

URL for password reset when authentication is handled by an external identity provider, such as LDAP, SAML, or OAuth.

When set, Forgot your password? on the sign-in page links to this URL instead of Weblate's built-in password reset page.

PRIVACY_URL

在 4.8.1 版被加入.

您的 Weblate 實例顯示其法律文件的 URL。

提示

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

範例:

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

也參考

LEGAL_URL

PRIVATE_COMMIT_EMAIL_OPT_IN

在 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

在 4.15 版被加入.

Template to generate a private commit e-mail for a user. Defaults to "{username}@users.noreply.{site_domain}".

It can contain {user_id}, {username}, {site_title}, and {site_domain}.

設定不允許空白字串。

備註

Using a different commit e-mail is opt-in for users unless configured by PRIVATE_COMMIT_EMAIL_OPT_IN. Users can configure their commit e-mail in the 個人檔案.

PRIVATE_COMMIT_NAME_OPT_IN

在 5.16 版被加入.

Configures whether the private commit name 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 name.

PRIVATE_COMMIT_NAME_TEMPLATE

在 5.16 版被加入.

Template to generate a private commit name for a user. Defaults to "{site_title} user {user_id}".

It can contain {user_id}, {username}, {site_title}, and {site_domain}.

設定不允許空白字串。

備註

Using a different commit name is opt-in for users unless configured by PRIVATE_COMMIT_NAME_OPT_IN. Users can configure their commit name in the 個人檔案.

PROJECT_BACKUP_KEEP_COUNT

在 4.14 版被加入.

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

也參考

專案層級備份

PROJECT_BACKUP_KEEP_DAYS

在 4.14 版被加入.

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

也參考

專案層級備份

PROJECT_BACKUP_UPLOAD_MAX_SIZE

在 5.17.1 版被加入.

Configures the maximum size, in bytes, for uploaded project backup ZIP files. Defaults to 536870912 bytes (512 MiB).

In Docker, configure this using the WEBLATE_PROJECT_BACKUP_UPLOAD_MAX_SIZE environment variable. Docker setups can also be constrained by CLIENT_MAX_BODY_SIZE; other deployments can be constrained by their reverse proxy request body-size limit.

也參考

專案層級備份

PROJECT_BACKUP_IMPORT_MAX_MEMBERS

在 5.17 版被加入.

Defines the maximum number of ZIP entries allowed when importing a project backup.

This is a safeguard against malformed or intentionally fragmented archives. Defaults to 100000 entries.

In Docker, configure this using the WEBLATE_PROJECT_BACKUP_IMPORT_MAX_MEMBERS environment variable.

也參考

專案層級備份

PROJECT_BACKUP_IMPORT_MAX_TOTAL_UNCOMPRESSED_SIZE

在 5.17.1 版被加入.

Defines the maximum total uncompressed size, in bytes, for ZIP entries in an imported project backup. Defaults to 536870912 bytes (512 MiB).

This limits archives that are small when uploaded but expand to much more data during validation or restore.

In Docker, configure this using the WEBLATE_PROJECT_BACKUP_IMPORT_MAX_TOTAL_UNCOMPRESSED_SIZE environment variable.

也參考

專案層級備份

PROJECT_BACKUP_IMPORT_MAX_COMPRESSED_ENTRY_SIZE

在 5.17 版被加入.

Defines the maximum uncompressed size, in bytes, for a single highly compressed ZIP entry in an imported project backup.

This limit is only applied to entries that are large enough and compress enough to look suspicious. Large low-compression files are intentionally allowed here and are expected to be constrained by the HTTP upload limit. Defaults to 262144000 bytes (250 MiB).

In Docker, configure this using the WEBLATE_PROJECT_BACKUP_IMPORT_MAX_COMPRESSED_ENTRY_SIZE environment variable.

也參考

專案層級備份

PROJECT_BACKUP_IMPORT_MIN_RATIO_SIZE

在 5.17 版被加入.

Defines the minimum uncompressed size, in bytes, at which Weblate starts considering the ZIP compression ratio during project backup import.

Smaller files are ignored for the compression-ratio-based validation to avoid rejecting reasonably sized files that compress well. Defaults to 1048576 bytes (1 MiB).

In Docker, configure this using the WEBLATE_PROJECT_BACKUP_IMPORT_MIN_RATIO_SIZE environment variable.

也參考

專案層級備份

PROJECT_BACKUP_IMPORT_MAX_COMPRESSED_ENTRY_RATIO

在 5.17 版被加入.

Defines the maximum allowed ratio between the uncompressed and compressed size for a large ZIP entry during project backup import.

This is used together with PROJECT_BACKUP_IMPORT_MAX_COMPRESSED_ENTRY_SIZE and PROJECT_BACKUP_IMPORT_MIN_RATIO_SIZE to detect suspiciously compressed entries while still allowing large repository pack files and other low-compression content. Defaults to 250.

In Docker, configure this using the WEBLATE_PROJECT_BACKUP_IMPORT_MAX_COMPRESSED_ENTRY_RATIO environment variable.

也參考

專案層級備份

PROJECT_NAME_RESTRICT_RE

在 4.15 版被加入.

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

也參考

專案名稱

PROJECT_WEB_RESTRICT_HOST

在 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.

預設配置:

PROJECT_WEB_RESTRICT_HOST = {"localhost"}

PROJECT_WEB_RESTRICT_ALLOWLIST

在 5.17 版被加入.

Defines a set of project slugs exempt from PROJECT_WEB_RESTRICT_HOST, PROJECT_WEB_RESTRICT_NUMERIC, PROJECT_WEB_RESTRICT_PRIVATE, and PROJECT_WEB_RESTRICT_RE when validating the project website. Project slugs are matched case-insensitively.

警示

This exemption weakens outbound URL protections for matching projects, including the private-target restriction enforced by PROJECT_WEB_RESTRICT_PRIVATE. Use it only for trusted, administrator-managed projects where bypassing these checks is intentional.

預設配置:

PROJECT_WEB_RESTRICT_ALLOWLIST = set()

PROJECT_WEB_RESTRICT_NUMERIC

在 4.16.2 版被加入.

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

PROJECT_WEB_RESTRICT_PRIVATE

在 5.17 版被加入.

Reject using project website and repository browser URLs pointing to internal or non-public addresses. On by default.

PROJECT_WEB_RESTRICT_RE

在 4.15 版被加入.

Defines a regular expression to limit what can be entered as 專案網站. Any matching URLs will be rejected.

WEBHOOK_PRIVATE_ALLOWLIST

在 5.17 版被加入.

Defines hostnames or domains exempt from WEBHOOK_RESTRICT_PRIVATE for outbound webhook delivery. Entries follow Django host matching semantics, so values such as hooks.internal.example or .internal.example can be used.

預設配置:

WEBHOOK_PRIVATE_ALLOWLIST = []

WEBHOOK_RESTRICT_PRIVATE

在 5.17 版被加入.

Reject webhook URLs pointing to internal or non-public addresses unless the target host is included in WEBHOOK_PRIVATE_ALLOWLIST. On by default.

When enabled, hostnames that cannot be resolved during validation are rejected unless they are explicitly included in WEBHOOK_PRIVATE_ALLOWLIST.

PUBLIC_ENGAGE

在 5.16.2 版被加入.

Allows public engage page even with REQUIRE_LOGIN.

也參考

RATELIMIT_NOTIFICATION_LIMITS

在 5.14 版被加入.

Limits how many notifications for a single user will be sent out.

預設設定為:

# Multi-level rate limiting for email notifications
# Each tuple contains (max_emails, time_window_seconds)
RATELIMIT_NOTIFICATION_LIMITS = [
    # Prevent burst sends - 3 emails per 2 minutes
    (3, 120),
    # Equalize to avoid getting blocked for too long - 10 emails per hour
    (10, 3600),
    # Daily limit: 50 emails per day
    (50, 86400),
]

RATELIMIT_ATTEMPTS

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

預設為 5。

RATELIMIT_WINDOW

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

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

RATELIMIT_LOCKOUT

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

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

REGISTRATION_ALLOW_BACKENDS

在 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.

If turned on, a CAPTCHA is added to all pages where a user enters their e-mail address:

  • 註冊新帳號。

  • 找回密碼。

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

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

The protection currently consists of following steps:

REGISTRATION_EMAIL_MATCH

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

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

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

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

REGISTRATION_ALLOW_DISPOSABLE_EMAILS

在 5.16.1 版被加入.

Allow registration with disposable e-mail domains. When enabled, the disposable domain blocklist is bypassed. Default is False.

REGISTRATION_OPEN

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

This setting affects built-in authentication by e-mail address or through the Python Social Auth (you can allow certain back-ends using REGISTRATION_ALLOW_BACKENDS).

備註

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

REGISTRATION_REBIND

在 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

在 4.0.2 版被加入.

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

也參考

翻譯組件警告

REQUIRE_LOGIN

在 4.1 版被加入.

This enables django.contrib.auth.middleware.LoginRequiredMiddleware and configures REST framework to require authentication for all API endpoints.

在 5.15 版的變更: Weblate now relies on Django built-in middleware.

備註

這實作在 配置的範例 中。對於 Docker,使用 WEBLATE_REQUIRE_LOGIN

SENTRY_DSN

Sentry DSN 用於 Collecting error reports and monitoring performance

SENTRY_ENVIRONMENT

Configures environment for Sentry. Defaults to devel.

SENTRY_MONITOR_BEAT_TASKS

在 5.13 版被加入.

Configure whether to monitor Celery Beat tasks with Sentry. Defaults to True.

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 off by default.

在 5.7 版的變更: This is turned off by default now, used to be 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 語言代碼。這通常是受歡迎的特性,因為它簡化了這些預設組合列出的語言。

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

HIDE_SHARED_GLOSSARY_COMPONENTS

在 5.16 版被加入.

Glossary components are typically shared into other projects to make them available for translation work. When these are visible in the component list of projects that are using them, it can cause confusion or distract translators from the actual components that are meant to be translated.

This is turned off by default, making shared glossary components visible.

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 來配置。

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

在 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。

SUPPORT_STATUS_CHECK

在 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.

TRANSLATION_UPLOAD_MAX_SIZE

在 5.17.1 版被加入.

Configures the maximum size, in bytes, for uploaded translation files. Defaults to 50 MB.

In Docker, configure this using the WEBLATE_TRANSLATION_UPLOAD_MAX_SIZE environment variable.

UNUSED_ALERT_DAYS

在 4.17 版被加入.

Configures when the Component seems unused alert is triggered.

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

UPDATE_LANGUAGES

在 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_ALLOW_HOSTS

在 5.15 版被加入.

A set of hosts to allow when configuring VCS URL. Defaults to an empty set, which does no filtering at all.

When VCS_RESTRICT_PRIVATE is enabled, matching hosts are also exempt from the private-target restriction.

VCS_ALLOW_SCHEMES

在 5.15 版被加入.

A set of URL schemes to allow when configuring VCS URL. Only https and ssh are allowed by default.

VCS_RESTRICT_PRIVATE

在 5.17 版被加入.

Reject VCS repository URLs pointing to internal or non-public addresses unless the target host is included in VCS_ALLOW_HOSTS. On by default.

When enabled, hostnames that cannot be resolved during validation are rejected unless they are explicitly included in VCS_ALLOW_HOSTS.

VCS_API_DELAY

在 4.15.1 版被加入.

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

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

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

預設值為 10。

VCS_API_TIMEOUT

在 5.15 版被加入.

Configures timeout in seconds for third-party API calls such as forking or creating merge requests in GitHub 拉取請求, GitLab 合併請求, Gitea 拉取請求, Pagure 合併請求, and Azure DevOps 拉取請求.

預設值為 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.GettextAuthorComments",
    "weblate.addons.cleanup.CleanupAddon",
    "weblate.addons.consistency.LanguageConsistencyAddon",
    "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.properties.PropertiesSortAddon",
    "weblate.addons.git.GitSquashAddon",
    "weblate.addons.removal.RemoveComments",
    "weblate.addons.removal.RemoveSuggestions",
    "weblate.addons.resx.ResxUpdateAddon",
    "weblate.addons.autotranslate.AutoTranslateAddon",
    "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.

ADDON_ACTIVITY_LOG_EXPIRY

在 5.6 版被加入.

Configures how long activity logs for add-ons are kept. Defaults to 180 days.

WEBLATE_EXPORTERS

在 4.2 版被加入.

可用的匯出程式清單,提供下載各種檔案格式的翻譯或詞彙表。

WEBLATE_FORMATS

可供使用的檔案格式清單。

備註

預設清單已經具有了常見格式。

WEBLATE_MACHINERY

在 4.13 版被加入.

可供使用的檔案格式清單。

WEBLATE_GPG_IDENTITY

Identity used by Weblate to sign Git commits, for example:

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.

WEBSITE_ALERTS_ENABLED

在 5.17 版被加入.

預設:True

Defines whether Weblate should check project website availability and show alerts for unreachable project websites.

When set to False, Weblate will skip website availability checks and will not generate project website alerts. This is useful when:

  • Your websites are behind firewalls that block Weblate's requests

  • You want to avoid 403/503-type errors from bot protection

  • Project website availability is not a concern for your installation

也參考

WEBSITE_REQUIRED

配置版本控制憑證

提示

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 credentials can also be overridden in 儲存庫推送 URL or 原始碼儲存庫 (if push URL is not configured), these take precedence over the ones specified in the configuration file.

The following configuration is available for each host:

username

API user, required.

token

API token for the API user, required.

scheme

在 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.