翻譯專案數#

翻譯組織#

Weblate organizes translatable VCS content of project/components into a tree-like structure. You can additionally organize components within a project using categories.

  • 底層對像是 項目組態,該項目組態應將所有翻譯歸在一起(例如,多個版本的應用程序翻譯和/或隨附的文件)。

  • The middle level is optionally created by 類別. The categories can be nested to achieve more complex structure.

  • 在上面的級別上,:ref:`component`(實際上是要翻譯的組件),您定義要使用的版本控制系統(VCS )倉儲以及要翻譯的文件的掩碼。

  • 在:ref:component 上方,有單獨的翻譯,當版本控制系統(VCS )倉儲中出現翻譯文件(與:ref:component 中定義的:ref:`component-filemask`匹配)時,Weblate會自動處理這些翻譯。

Weblate 支援 Translate Toolkit 支援的多種翻譯格式(雙語和單語),請參閱 支援的文件格式

備註

您可以使用 Weblate internal URLs 共享克隆的版本控制系統(VCS )儲存庫。當您有許多共享同一版本控制系統(VCS )的組件時,強烈推薦使用此功能。它提高了效能並減少了所需的磁碟空間。

新增翻譯項目和組件#

根據您的權限,新的翻譯項目和元件可以被建立。具備 :guilabel:`Add new projects`權限的使用者總是可以這麼做。如果使用付費託管,您還可以從管理帳單的使用者帳戶基於套餐限額建立它們。

提示

To grant every user permission to create new projects create new 自動團隊分派 for the Project creators team.

您可以在單獨的頁面上查看目前的結算方案:

../_images/user-billing.webp

您可以從此處開始建立專案,也可以使用導航條中的選單來填寫翻譯專案的基本資訊以完成新增:

../_images/user-add-project.webp

建立項目後,您將直接進入專案頁面:

../_images/user-add-project-done.webp

只需單擊一次即可啟動建立新翻譯組件的操作。建立組件的過程是多階段的,並自動檢測大多數翻譯參數。有幾種建立組件的方法:

來自版本控制

從遠端版本控制儲存庫建立組件。

來自既有組件

通過選擇不同的文件為現有組件建立其他組件。

額外分支

僅針對不同分支,為現有組件建立其他組件。

上傳翻譯檔

如果您沒有版本控製或不想將其與 Weblate 整合,則將翻譯文件上傳到 Weblate。您以後可以使用網絡界面或 Weblate 的 REST API 更新內容。

翻譯文件

Upload single document or translation file and translate that.

從頭開始

建立空白翻譯項目並手動新增字串。

一旦有了現有的翻譯組件,就可以使用同一儲存庫輕鬆地為其他文件或分支新增新的組件。

首先,您需要填寫名稱和儲存庫位置:

../_images/user-add-component-init.webp

在下一頁上,將顯示已發現的可翻譯資源的列表:

../_images/user-add-component-discovery.webp

最後,您檢查翻譯組件資訊並填寫可選詳細資訊:

../_images/user-add-component.webp

項目組態#

建立一個翻譯項目,然後在其中新增一個新的翻譯組件。這個項目就像一個架子,裡面堆放著真正的翻譯。同一項目中的所有組件共享建議及其字典;翻譯也將自動傳播到單個項目中的所有組件(除非在組件組態中關閉),請參見 翻譯記憶

也參考

與 Weblate 整合

這些基本屬性被新建並通知翻譯人員項目:

專案名稱#

詳細的項目名稱,用於顯示項目名稱。

URL slug#

適用於 URL 的項目名稱。

專案網站#

譯者可以在其中找到有關該項目的更多資訊的 URL。

這是必需參數,除非關閉:設定:websents_required

翻譯指示#

Text describing localization process in the project, and any other information useful for translators. Markdown can be used for text formatting or inserting links.

設定「Language-Team」檔案標頭#

Weblate 是否應管理 Language-Team 頭(目前這是僅 GNU gettext PO (Portable Object) 功能)。

使用共享的翻譯記憶#

是否使用共享翻譯記憶庫,有關更多詳細資訊,請參見 共享的翻譯記憶

The default value can be changed by DEFAULT_SHARED_TM.

貢獻至共享翻譯記憶#

是否貢獻到共享翻譯記憶庫,請參閱 共享的翻譯記憶 以取得更多詳細資訊。

This also affects whether the project can be used as source for 自動翻譯.

The default value can be changed by DEFAULT_SHARED_TM.

備註

This option is unavailable on Hosted Weblate, it is toggled together with 使用共享的翻譯記憶.

存取控制#

組態每個項目的存取控制,請參閱 專案存取控制 以取得更多詳細資訊。

可以透過 DEFAULT_ACCESS_CONTROL 修改預設值。

啟用檢閱#

允許複核翻譯的工作流程,請參見 專門的審核者

也參考

自訂工作流程

啟用來源檢閱#

啟用審核來源字串的工作流程,參閱 來源字串審核

啟用掛勾#

是否將未經身份驗證的 通知掛勾 用於此儲存庫。

語言別名#

將翻譯導入到 Weblate 時定義語言代碼映射。當您的儲存庫中的語言代碼不一致,並且您希望在 Weblate 中獲得一致的檢視,或者如果您想使用翻譯檔的非標準命名時,可以使用此方法。

典型的使用情況會是將 美國英語映射到英語:en_US:en

由逗號分隔的多個映射:en_GB:en,en_US:en

使用非標準編碼:ia_FOO:ia

提示

當匹配翻譯文件時映射語言代碼,並且映射是大小寫敏感的,所以您確保使用與文件名中使用的形式相同的源語言代碼。

組件組態#

組件是用於翻譯的內容的分組。您輸入版本控制系統(VCS)儲存庫位置和想要翻譯那個檔案的掩碼,Weblate 會自動地從 這個版本控制系統(VCS)中取回,並找到所有匹配的可翻譯檔。

也參考

與 Weblate 整合

您可以在 支援的文件格式 中找到一些典型組態的例子。

備註

推薦將翻譯文件保持在合理的大小——在您的案例中使用任何合理的工具(獨立的 app 或附加元件、書籍的章節或網站)來分割翻譯文件。

Weblate 能夠輕鬆處理 10000 個字串,但大的翻譯組件的分割工作和翻譯者之間的協調更困難。

如果翻譯的語言定義遺失,會新建一個空的定義,並且命名為 「cs_CZ (generated)」。您應該調整定義,並將其反饋給 Weblate 的作者,從而遺失的語言可以包括在下一次的發佈版本中。

使用版本控制系統(VCS)工作的所有重要參數都包含在組件中,並且從中取出翻譯:

組件名稱#

冗長組件名稱,用於顯示組件的名稱。

組件標識串#

適用於 URLs 的組件名稱。

組件項目#

組件所屬的 項目組態

版本控制系統#

使用的版本控制系統(VCS),細節請參見: 版本控制整合

來源碼儲存庫#

版本控制系統(VCS)儲存庫,用於拉取變更。

也參考

指定 URLs 的更多細節請參見 存取儲存庫

提示

這可以或者是真實的版本控制系統(VCS)的 URL, 或者是 weblate://project/component,指示了儲存庫應該與其它組件分享。更多細節請參見 Weblate internal URLs

儲存庫推送 URL#

Repository URL used for pushing. The behavior of this depends on 版本控制系統, and this is in more detail covered in 推送 Weblate 的更改.

For linked repositories, this is not used and setting from linked component applies.

也參考

關於如何指定倉儲 URL 的更多細節請見 存取儲存庫,並且關於從 Weblate 推送更改的更多細節,請參見 推送 Weblate 的更改

儲存庫瀏覽器#

用於顯示來源檔(已使用訊息的位置)儲存庫瀏覽器的 URL。當它為空白時,將不產生這樣的連結。您可以使用 模板標記

例如在 GitHub 上,使用像:``https://github.com/WeblateOrg/hello/blob/{{branch}}/{{filename}}#L{{line}}``那樣的一些東西

In case your paths are relative to different folder (path contains ..), you might want to strip leading directory by parentdir filter (see 模板標記): https://github.com/WeblateOrg/hello/blob/{{branch}}/{{filename|parentdir}}#L{{line}}

已匯出儲存庫 URL#

由 Weblate 進行的變更被匯出的 URL。當不使用 持續在地化 時,或者當需要手動合併變更時,這是重要的。您可以為 Git 儲存庫使用 Git 導出器 來將其自動化。

儲存庫分支#

從版本控制系統(VCS)核實哪個分支,以及從哪裡尋找翻譯。

For linked repositories, this is not used and setting from linked component applies.

推送分支#

用於推送更改的分支,留為空白來使用 儲存庫分支

For linked repositories, this is not used and setting from linked component applies.

備註

此功能目前只支援Git、GitLab和GitHub,無法在其他VCS整合中工作。

檔案遮罩#

要翻譯的文件的掩碼,包括路徑。它應包含一個 「*」 替換語言代碼(有關處理方式的資訊,請參見 語言定義)。如果您的儲存庫包含多個翻譯檔(例如,多個 gettext 定義域),則您需要為每個檔案建立一個組件。

例如``po/.po`` 或 ``locale//LC_MESSAGES/django.po``。

如果文件名包含特殊字元(例如``[]``),則需要將這些特殊字元轉義為 [[][]]

螢幕擷圖檔案遮罩#

This feature allows the discovery and updating of screenshots through screenshot file masks, using paths from the VCS repository. This operates at the component level and necessitates the use of an asterisk 「*」 to replace the screenshot file name.

Allowed formats are WebP, JPEG, PNG, APNG and GIF.

Note:

  1. The file mask and screenshot file mask are not related. Configure them separately.

  2. It is a manual job to link a discovered screenshot in a component to a specific translation key.

例如:

Let’s assume your VCS repository has a structure like this:

component_A
└── docs
    ├── image1.png
    └── image2.jpg

For component_A, you want to allow discovery and updates of PNG screenshots. You’d set the screenshot file mask for component_A as component_A/docs/*.png. This means any PNG images under docs in component_A can be discovered and updated. So, if you want to update image1.png, the new screenshot you provide should be named image1.png, matching the existing filename, and stored under component_A/docs/.

單語的基底語言檔#

包含字串定義的譯文模板文件,用於 單語言組件

編輯基底檔#

Whether to allow editing strings in the 單語的基底語言檔.

中間語言檔案#

對於 單語言組件 的單一語言文件。在多數情況下,這是開發者提供的翻譯文件,並且在新建真正的源字串時使用。

When set, the source strings are based on this file, but all other languages are based on 單語的基底語言檔. In case the string is not translated into the source language, translating to other languages is prohibited. This provides 來源字串的品質閘道.

新翻譯的模板#

Base file used to generate new translations.

  • Keep this field empty for most of the monoligual formats. Those are typically able to start from an empty file.

  • Choose .pot file with GNU gettext PO files.

  • Choose blank file without translations, if you have one.

  • Choose 單語的基底語言檔 for monolingual formats that need a full set of keys present.

  • Choose 單語的基底語言檔 for document translations.

  • Choose any translation file for others.

  • Template file can be the same as the base file in most cases.

提示

In many monolingual formats Weblate starts with empty file by default. Use this in case you want to have all strings present with empty value when creating new translation.

檔案格式#

翻譯文件格式,還請參見 支援的文件格式

來源字串臭蟲回報位址#

用於匯報上游缺陷的電子郵箱地址。 Weblate 中做出的任何字串註釋的通知,也由這個地址接收。

With the GNU gettext PO (Portable Object) format, this address is also saved by Weblate in the Report-Msgid-Bugs-To header of the file.

允許翻譯再用#

您可以關閉項目內從其它組件到這個組件的翻譯的傳播。這真正相依於您在翻譯的是什麼,有時最好多次使用同一個翻譯。

對於單語言翻譯,除非您跨越整個項目中使用相同的 ID,通常關閉它是個好主意。

預設值可以通過 DEFAULT_TRANSLATION_PROPAGATION 來更改。

啟用建議#

對於這個組件,建議的翻譯是否被接受。

也參考

自訂工作流程

建議投票#

為建議打開投票,請參見 建議投票

也參考

自訂工作流程

自動接受建議#

自動接收被投票的建議,請參見 建議投票

也參考

自訂工作流程

翻譯旗標#

品質檢查和其他 Weblate 行為的客製,請參見 使用標誌自定義行為

強制查核#

檢查哪個不能被忽視的列表,請參見 強制檢查

備註

執行檢查不會自動啟用它,您仍然應該使用:ref:“自定義檢查”:ref:“Component-Check_Flags`或:Ref:”其他“。

翻譯授權條款#

翻譯的許可(不需要與來源碼的許可相同)。

貢獻者協議書#

使用者必須先同意使用者協議才能翻譯此組件。

加入新翻譯#

如何處理建立新語言的請求。可用選項:

聯絡維護者

使用者可以選取所需的語言,專案維護者將收到有關該語言的通知。由他們決定是否向儲存庫新增(或不新增)語言。

指向翻譯指示 URL

向使用者顯示的頁面連結描述了開始新翻譯的過程。如果需要更正式的流程(例如,在開始實際翻譯之前組成人員團隊),請使用此選項。

建立新語言檔

使用者可以選擇語言,然後 Weblate 會自動為其新建文件並開始翻譯。

停用新增翻譯

使用者將無法選擇開始新的翻譯。

提示

項目管理員可以新增新的翻譯,即使它是可能的(:ref:Ref:`Component-New_base`或從空文件開始的文件格式支援)。

管理字串#

在 4.5 版新加入.

組態 WebLate 中的使用者是否將被允許新增新字串並刪除現有字串。調整此項以匹配您的在地化工作流程 - 如何介紹新字串。

對於雙語格式,通常會從來源碼中提取字串(例如,通過使用 xgettext)並停用在 Weblate 中新增字串(在下次更新翻譯檔時將被丟棄)。在 Weblate 中,您可以為每個翻譯管理字串,並且它不會在所有翻譯中強制執行字串。

對於單晶格式,字串僅在源語言上管理,並在翻譯中自動新增或刪除。一旦翻譯,字串會在翻譯文件中出現。

提示

You might want to turn on 編輯基底檔 together with Manage strings for monolingual formats.

語言代碼類型#

用來產生使用 Weblate 建立之翻譯檔名的自訂語言代碼。

備註

Weblate recognizes any of the language codes when parsing translation files, following settings only influences how new files are created.

預設基於檔案格式

相依於文件格式,對於其中的多數使用 POSIX。

POSIX 樣式,使用底線當作分隔符號

典型地由 gettext 和相關工具使用,產生像 pt_BR 那樣的語言代碼。

POSIX 樣式,使用底線當作分隔符,包含地區碼

POSIX 風格的語言代碼即使不必要時也包括國家代碼;例如 cs_CZ)。

POSIX 樣式,使用底線當作分隔符,包含地區碼(小寫)

POSIX style language code including the country code even when not necessary (lowercase) (for example cs_cz).

BCP 樣式,使用連字號當作分隔符號

典型地在 web 平台上使用,產生像 pt-BR 那樣的語言編碼。

BCP 樣式,使用連字號當作分隔符號,包含地區碼

BCP 風格的語言代碼即使不必要時也包括國家代碼;例如 cs-CZ)。

BCP 樣式,使用連字號作為分隔符號、舊式語言代碼

Uses legacy codes for Chinese and BCP style notation.

BCP 樣式,使用連字號作為分隔符號,小寫

BCP style notation, all in lower case (for example cs-cz).

Apple App Store 中介資料樣式

Style suitable for uploading metadata to Apple App Store.

Google Play 中介資料樣式

Style suitable for uploading metadata to Google Play Store.

Android 樣式

只在Android apps 中使用,產生像 pt-rBR 那樣的語言代碼。

Linux 樣式

Locales as used by Linux, uses legacy codes for Chinese and POSIX style notation.

合併類型#

您可以組態如何處理上游儲存庫的升級。實際實現取決於版本控制系統(VCS),請參見 版本控制整合

衍合

Rebases Weblate commits on top of upstream repository on update. This provides clean history without extra merge commits.

在復雜融合的情況下,變基可能使您產生麻煩,因此請仔細考慮是否允許它們。

You might need to enable force pushing by choosing Git 使用強制推送 as 版本控制系統, especially when pushing to a different branch.

合併

Upstream repository changes are merged into Weblate one. This setting utilizes fast-forward when possible. This is the safest way, but might produce a lot of merge commits.

不快轉合併

Upstream repository changes are merged into Weblate one with doing a merge commit every time (even when fast-forward would be possible). Every Weblate change will appear as a merge commit in Weblate repository.

預設值可以由 :setting:`DEFAULT_MERGE_STYLE`更改。

Commit, add, delete, merge, add-on, and merge request messages#

當送交翻譯時使用的消息,請參見 模板標記

Default value can be changed by DEFAULT_ADD_MESSAGE, DEFAULT_ADDON_MESSAGE, DEFAULT_COMMIT_MESSAGE, DEFAULT_DELETE_MESSAGE, DEFAULT_MERGE_MESSAGE, DEFAULT_PULL_MESSAGE.

送交時一併推送#

是否自動推送已送交的專案到上游儲存庫。啟用時,當 Weblate 將變更送交到其基礎儲存庫中,就會啟動推送。(請參見 簡易送交)。為了能真正啟用推送功能,需組態 Repository push URL

更動後送交的經過時間#

Sets how old (in hours) changes have to be before they are committed by background task or the commit_pending management command. All changes in a component are committed once there is at least one change older than this period.

預設值可以由 COMMIT_PENDING_HOURS 更改。

提示

有其他情況可能會送交掛起的更改,請參閱:ref:“懶惰送交”。

有錯誤時鎖定#

鎖定元件 (及關聯的元件,請參見 Weblate internal URLs ),觸發條件是第一個失敗的推送,合併到其上游儲存庫,或從中拉出。這樣可以避免新增其他衝突,這些衝突必須手動解決。

一旦儲存庫沒有錯誤留下來了,組件將會自動解鎖。

來源語言#

用於源字串的語言。如果您要翻譯的不是英語,請更改此選項。

提示

如果您正在從英語翻譯雙語文件,但又希望能夠在英語翻譯中進行修復,選擇 English (Developer) 作為一種源語言以避免源語言和現有翻譯之間名稱上的衝突。

對於單語言翻譯,您可以使用這種情況下的中間翻譯,請參見 中間語言檔案

語言篩選#

Regular expression used to filter the translation when scanning for file mask. It can be used to limit the list of languages managed by Weblate.

備註

單出現在文件名中時,您需要列出語言代碼。

過濾的一些例子:

過濾器的描述

正則表達式

Selected languages only

^(cs|de|es)$

排除的語言

^(?!(it|fr)$).+$

只篩選兩個字母的代碼

^..$

排除非語言文件

^(?!(blank)$).+$

包括所有文件(預設)

^[^.]+$

變體的正則表達式#

用於確定字串變體的正則表達式,請見 字串變量

備註

Most of the fields can be edited by project owners or administrators, in the Weblate interface.

優先度#

較高優先度的組件會優先提供給翻譯者。

在 4.15 版的變更: This now also affects ordering of matched glossary terms.

受限制的存取#

備註

This feature is unavailable on Hosted Weblate.

組件預設對存取項目的任何人都可見,即使不能在組件中進行任何更改。這會容易地使翻譯在項目內保持一致。

無論項目級別權限如何,限制元件的存取或元件列表級別將接管到元件的訪問權限。您必須明確授予對其的存取權限。這可以通過授予對新使用者組的訪問並將使用者放入其中,或使用預設的“自定義”或“私有”存取控制組。

預設設定可在 DEFAULT_RESTRICTED_COMPONENT 中更改。

提示

這也應用於項目管理員—請確認切換狀態後,您不會遺失對元件的存取。

分享專案#

可以選擇元件可見的附加項目。這在分享不同項目間使用的庫時是有用的。

備註

分享元件不更改其存取控制。這樣做只是讓它在瀏覽其它項目時可見。使用者仍然需要存取實際元件的權限來瀏覽或翻譯它。

當作詞彙表#

在 4.5 版新加入.

允許使用該元件作為術語表。您可以組態其列出方式,借助 詞彙表色彩

詞彙表將在以下所有項目中存取:ref:“元件連結”。

建議啟用:ref:“元件 - Manage_Units”,以便為它們新增新單詞。

也參考

詞彙表

詞彙表色彩#

顯示顏色,用於顯示單詞匹配時使用的詞彙表。

類別#

Categories are there to give structure to components within a project. You can nest them to achieve a more complex structure.

模板標記#

Weblate 在需要提供文本的幾個地方使用簡單的標記語言。它基於 The Django template language,因此能夠非常強大。

目前它用在:

可以在組件模板中得到後面的變量:

{{ language_code }}

語言碼

{{ language_name }}

語言名稱

{{ component_name }}

組件名稱

{{ component_slug }}

組件標識串

{{ project_name }}

專案名稱

{{ project_slug }}

項目標識串

{{ url }}

翻譯 URL

{{ filename }}

翻譯檔名

{{ stats }}

翻譯統計資料,這具有進一步的屬性,示例如下。

{{ stats.all }}

Total strings count

{{ stats.fuzzy }}

需要審核的字串數量

{{ stats.fuzzy_percent }}

需要審核的字串數量百分比

{{ stats.translated }}

Translated strings count

{{ stats.translated_percent }}

Translated strings percent

{{ stats.allchecks }}

檢查失敗的字串數量

{{ stats.allchecks_percent }}

檢查失敗的字串百分比

{{ author }}

目前送交的作者,只在送交範圍可用。

{{ addon_name }}

Name of currently executed add-on, available only in the add-on commit message.

下面的變數在儲存庫瀏覽器或編輯器模板中可用:

{{branch}}

目前的分支

{{line}}

line in file

{{filename}}

文件名,您也可以使用 parentdir 過濾器,例如 {{filename|parentdir}},來剝除前導部分

提示

In some places additional variables can be available, see 組件探索.

您可以將它們與過濾器結合:

{{ component|title }}

您可以使用條件:

{% if stats.translated_percent > 80 %}Well translated!{% endif %}

有另外的標籤用於替換字元:

{% replace component "-" " " %}

您可以將它與過濾器結合:

{% replace component|capfirst "-" " " %}

還有另外的過濾器來操作文件名:

Directory of a file: {{ filename|dirname }}
File without extension: {{ filename|stripext }}
File in parent dir: {{ filename|parentdir }}
It can be used multiple times:  {{ filename|parentdir|parentdir }}

……以及其他 Django 模板特性。

導入速度#

擷取版本控制系統(VCS)儲存庫,並將翻譯匯入到 Weblate,取決於您的翻譯的大小,這會是漫長的過程。這裡是一些提示:

優化組態#

對於測試並調試 Weblate,預設的組態是有用的,當用於生產設定時,您應該進行一些調整。它們中的很多都對形成具有巨大的衝擊。特別是,更多細節請查看 生產設定

Check resource limits#

如果匯入巨大的翻譯或儲存庫,您會遭到伺服器資源限制的打擊。

  • 檢查空閒內存的量,通過操作系統來快取翻譯,將極大地提高性能。

  • 如果有很多字串需要處理的話,磁盤操作會是瓶頸——磁盤被 Weblate 和資料庫施加壓力。

  • 另外的 CPU 核心會幫助提高後台任務的性能(請參見 使用 Celery 的後台任務)。

Disable unneeded checks#

一些品質檢查可以使非常昂貴的,而如果不需要,在導入時省略可以節省一些時間。組態的資訊請參見 CHECK_LIST

自動新建組件#

In case your project has dozen of translation files (e.g. for different gettext domains, or parts of Android apps), you might want to import them automatically. This can either be achieved from the command-line by using import_project or import_json, or by installing the 組件探索 add-on.

To use the add-on, you first need to create a component for one translation file (choose the one that is the least likely to be renamed or removed in future), and install the add-on on this component.

For the management commands, you need to create a project which will contain all components and then run import_project or import_json.