組態#

所有的設置存儲在 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 自身的參數。

AKISMET_API_KEY#

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

ANONYMOUS_USER_NAME#

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

也參考

存取控制

AUDITLOG_EXPIRY#

在 3.6 版新加入.

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#

在 3.2 版新加入.

在 3.11 版的變更: 更改原來的開關選項,來區別接受哪個字串。

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

提示

在不使用 通知掛勾 來自動更新 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#

在 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 版新加入.

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

示例:

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

也參考

borg listborg extract

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.

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

csp_script_src,csp_img_src,csp_connect_src,csp_style_src,csp_font_src#

為 Weblate 定制 Content-Security-Policy 標頭。根據允許集成的第三方服務( 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 weblate updatechecks.

COMMENT_CLEANUP_DAYS#

在 3.6 版新加入.

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

COMMIT_PENDING_HOURS#

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

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.

"回覆到"

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

"來自"

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

DATA_DIR#

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

後面的子目錄通常存在:

home

Home 目錄用於調用腳本。

ssh

SSH 密鑰和配置。

static

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

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

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#

在 3.1 版新加入.

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

  • "plain"

  • "compressed"

  • "none"

DEFAULT_ACCESS_CONTROL#

在 3.3 版新加入.

The default access-control setting for new projects:

0

Public

1

Protected

100

Private

200

Custom

如果手動管理 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#

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

DEFAULT_COMMITER_NAME#

Committer name, defaulting to Weblate.

DEFAULT_LANGUAGE#

在 4.3.2 版新加入.

來源語言 for any new components.

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

DEFAULT_MERGE_STYLE#

在 3.4 版新加入.

合併類型 for any new components.

  • rebase - 預設

  • merge

DEFAULT_SHARED_TM#

在 3.2 版新加入.

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#

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

在 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 are configured in three variables and the credentials are built out of that. An example configuration for GitHub might look like:

WEBLATE_GITHUB_USERNAME=api-user
WEBLATE_GITHUB_TOKEN=api-token
WEBLATE_GITHUB_HOST=api.github.com

Will be used as:

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

GITLAB_CREDENTIALS#

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

在 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 are configured in three variables and the credentials are built out of that. An example configuration for GitHub might look like:

WEBLATE_GITHUB_USERNAME=api-user
WEBLATE_GITHUB_TOKEN=api-token
WEBLATE_GITHUB_HOST=api.github.com

Will be used as:

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

GITHUB_CREDENTIALS#

在 4.3 版新加入.

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

GITHUB_CREDENTIALS = {
    "api.github.com": {
        "username": "weblate",
        "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 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 are configured in three variables and the credentials are built out of that. An example configuration for GitHub might look like:

WEBLATE_GITHUB_USERNAME=api-user
WEBLATE_GITHUB_TOKEN=api-token
WEBLATE_GITHUB_HOST=api.github.com

Will be used as:

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

BITBUCKETSERVER_CREDENTIALS#

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

在 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 are configured in three variables and the credentials are built out of that. An example configuration for GitHub might look like:

WEBLATE_GITHUB_USERNAME=api-user
WEBLATE_GITHUB_TOKEN=api-token
WEBLATE_GITHUB_HOST=api.github.com

Will be used as:

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

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#

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

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

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

依賴於您的設置,這個標頭會包括幾個IP 地址,(例如``X-Forwarded-For: a, b, client-ip`` ),並且可以配置標頭的哪個地址在這裡用作客戶端IP 地址。

警告

Setting this affects the security of your installation. You should only configure it to use trusted proxies for determining the IP address.

預設為 0。

也參考

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

您可能想要包括的一些例外:

LOGIN_REQUIRED_URLS_EXCEPTIONS = (
    r"/accounts/(.*)$",  # Required for sign-in
    r"/static/(.*)$",  # Required for development mode
    r"/widgets/(.*)$",  # Allowing public access to widgets
    r"/data/(.*)$",  # Allowing public access to data exports
    r"/hooks/(.*)$",  # Allowing public access to notification hooks
    r"/api/(.*)$",  # Allowing access to API
    r"/js/i18n/$",  # JavaScript localization
)

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#

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

在 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 are configured in three variables and the credentials are built out of that. An example configuration for GitHub might look like:

WEBLATE_GITHUB_USERNAME=api-user
WEBLATE_GITHUB_TOKEN=api-token
WEBLATE_GITHUB_HOST=api.github.com

Will be used as:

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

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

PRIVATE_COMMIT_EMAIL_TEMPLATE#

在 4.15 版新加入.

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

設定不允許空白字串。

備註

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

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

Default configuration:

PROJECT_WEB_RESTRICT_HOST = {"localhost"}

PROJECT_WEB_RESTRICT_NUMERIC#

在 4.16.2 版新加入.

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

PROJECT_WEB_RESTRICT_RE#

在 4.15 版新加入.

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

RATELIMIT_ATTEMPTS#

在 3.2 版新加入.

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

預設為 5。

RATELIMIT_WINDOW#

在 3.2 版新加入.

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

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

RATELIMIT_LOCKOUT#

在 3.2 版新加入.

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

秒數預設為 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.

如果打開,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#

在 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 版新加入.

這會啟用 LOGIN_REQUIRED_URLS 並配置 REST 框架來對所有 API 端點都要求登錄。

備註

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

SENTRY_DSN#

在 3.9 版新加入.

Sentry DSN 用於 蒐集錯誤訊息報告

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#

在 3.8 版新加入.

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.

在 3.11 版的變更: 設置只接受項目標識串,來強制顯示那個單一項目。

範例:

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。

SUGGESTION_CLEANUP_DAYS#

在 3.2.1 版新加入.

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

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

在 4.15.1 版新加入.

設定最少延遲秒數於第三方 API 中,請參閱 GitHub pull requestsGitLab 合併請求Gitea pull requestsPagure 合併請求

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

在 3.10.2 版新加入.

組態 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#

在 4.2 版新加入.

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

WEBLATE_FORMATS#

在 3.0 版新加入.

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

備註

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

WEBLATE_MACHINERY#

在 4.13 版新加入.

List of machinery services available for use.

也參考

配置自動建議

WEBLATE_GPG_IDENTITY#

在 3.1 版新加入.

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.