管理翻譯

Adding new strings

New strings can be made available for translation when they appear in the base file, called 新翻譯的模板 (see 組件組態). If your file format doesn’t require such a file, as is the case with most monolingual translation flows, you can start with empty files.

新增新的翻譯

在 Weblate 中,當使用者要求時新的語言可以立刻加入,或者新的通知會發送給項目管理員來同一或手動新增。這可以使用 組件組態 中的:ref:component-new_lang 來實現。

Some formats expect to start with an empty file and only translated strings to be included (for example Android 字串資源), while others expect to have all keys present (for example GNU gettext PO (Portable Object)). The document-based formats (for example OpenDocument 格式) start with a copy of the source document and all strings marked as needing editing. In some situations this really doesn’t depend on the format, but rather on the framework you use to handle the translation (for example with JSON 檔案).

When you specify 新翻譯的模板 in 組件組態, Weblate uses this file to start new translations. Any existing translations is removed from the file when doing so.

When 新翻譯的模板 is empty and the file format supports it, an empty file is created where new strings are added once they are translated.

The 語言代碼類型 allows you to customize language code used in generated filenames. Additionally, any mappings defined in 語言別名 are applied in reverse.

備註

If you add a language file in connected remote repository, respective translation is added to the component when Weblate updates local repository.

可以在更新 VCS 上找到儲存庫更新設定的更多資訊。

Removing existing translations

語言、元件、或是他們所在的專案是可以從每一項目的選單上移除 管理 ↓ :guilabel:`移除`(也可透過 Weblate 或是遠端倉儲)。

啟動刪除操作顯示要刪除的元件列表。您必須輸入物件的 slug 以確認刪除。slug 是,語言或元件的路徑名,因為它可以在 URL 中看到它。

如果要刪除一些特定字串,則有以下方法:

  • 手動在來源檔中。他們將從翻譯專案中刪除,以及 Weblate 的儲存庫更新。

Added in version 4.5.

  • 在 Weblate 的 UI 通過按鈕工具刪除在編輯字串時。這在檔案格式之間存在差異,請參見:元件 - manage_units

備註

如果刪除已連線的遠端儲存庫中的語言檔案,則當 Weblate 更新本地儲存庫時將從元件中刪除相應的轉換。

可以在更新 VCS 上找到儲存庫更新設定的更多資訊。

字串變量

變體可以將幾個字串組合在一起,這樣翻譯人員就可以在一個地方看到字串的所有變體。

提示

縮寫(縮短表格,收縮)是變體的一個很好的例子。

Automated key based variants

可以定義正則表達式,基於 組件組態 的單語言翻譯的鍵將字串分組:

../_images/variants-settings.webp

如果 Key 匹配表達式,那麼匹配部分被刪除以產生變體的根鍵。然後,具有相同根鍵的所有字串將成為單個變體組的一部分,也包括具有與根鍵完全匹配的鍵的字串。

後面的表格列出了一些使用示例:

用例

正則表達式變量

匹配的翻譯鍵

後綴標識

(Short|Min)$

monthShortmonthMinmonth

單行標識

#[SML]

dial#S.keydial#M.keydial.key

手動變化

Added in version 4.5.

可以使用 variant:SOURCE 標記手動連接特定字串。對於沒有鍵將字串自動分組,或將鍵不匹配的字串分組的雙語言翻譯,這是有用的,但應在翻譯時一起考慮。

也可以使用以下授權標籤新增字串的附加變體:“工具”(當時:ref:“Component-Manage_Units`正在打開):

../_images/glossary-tools.webp

備註

The variant source string has to be at most 768 characters long. This is a technical limitation due to compatibility with MySQL database.

Variants while translating

當翻譯時變量在後面分組:

../_images/variants-translate.webp

字串標籤

在項目組態中通過文本和顏色將組件翻譯字串分類。

../_images/labels.webp

提示

Labels can be assigned to units in 源字串另外的資訊 by bulk editing, or using the 大量編輯 add-on.