語言定義

To present different translations properly, info about language name, text direction, plural definitions and language code are needed.

內建語言定義

Definitions for about 800 languages are included in Weblate and the list is extended in every release. Whenever Weblate is upgraded (more specifically whenever migrate is executed, see 通用升級指示) the database of languages is updated to include all language definitions shipped in Weblate.

This feature can be disabled using UPDATE_LANGUAGES. You can also enforce updating the database to match Weblate built-in data using setuplang.

解析語言代碼

While parsing translations, Weblate attempts to map language code (usually the ISO 639-1 one) from the 檔案遮罩 to any existing language object.

您可以通過 語言別名 在專案層次來進一步調整這種映射。

如果無法找到精確的匹配,將嘗試把其融入一種現有的語言。已嘗試以下措施:

  • 大小寫不敏感的查詢。

  • Normalizing underscores and dashes.

  • 查詢內建語言別名。

  • 按語言名稱查詢。

  • 忽略給定語言的預設國家代碼 — 選擇 cs 而非 cs_CZ

Should that also fail, a new language definition will be created using the defaults (left to right text direction, one plural). The automatically created language with code xx_XX will be named as xx_XX (generated). You might want to change this in the admin interface later, (see 變更語言定義) and report it to the issue tracker (see 為 Weblate 做貢獻), so that the proper definition can be added to the upcoming Weblate release.

提示

在您看到有些不想要的內容作為語言的情況下,您會想要調整 語言篩選,當分析翻譯時忽略這樣的文件。

變更語言定義

您可以在語言介面來變更語言定義( /languages/ URL )。

當編輯時,確認所有欄位都是正確的(特別是複數和本文方向),否則翻譯者將不能正常編輯這些翻譯。

提示

Please consider contributing your changes back, see 擴展內建語言定義.

模稜兩可的語言代碼和巨集語言

In many cases it is not a good idea to use macrolanguage code for a translation. The typical problematic case might be Kurdish language, which might be written in Arabic or Latin script, depending on actual variant. To get correct behavior in Weblate, it is recommended to use individual language codes only and avoid macrolanguages.

語言定義

每種語言都包括後面的欄位:

語言代碼

Code identifying the language. Weblate prefers two letter codes as defined by ISO 639-1, but uses ISO 639-2 or ISO 639-3 codes for languages that do not have two letter code. It can also support extended codes as defined by BCP 47.

語言名稱

語言的可見名稱。還要根據使用者介面語言將 Weblate 中包括的語言名稱進行在地化。

文字方向

確定語言的書寫方向是由左至右還是由右至左。此屬性對於大多數語言都能正確地自動偵測到。

語言使用者數量

此語言的全球使用人數。

複數定義

Weblate comes with a built-in set of plural definitions. These are based on file-format specifications, CLDR, and other sources.

警告

Doing changes to the built-in plural definitions will most likely won't have desired effect, as these rules need to match underlying implementation.

Changing plural number or formula will affect only displaying of the strings, but not parsing and storing strings to the files. Should you think Weblate behaves incorrectly, please file a issue in our issue tracker.

複數數量

語言中使用的複數的數量。

複數公式

Gettext compatible plural formula used to determine which plural form is used for given count.

The formula uses the same expression syntax as the plural= part of the Gettext Plural-Forms header. The nplurals value sets how many plural forms the language has, and the formula returns the zero-based index of the plural form to use for a count n.

Weblate validates the formula using the Gettext parser provided by Python. The accepted syntax is a C-like integer expression with n as the only variable. It can use decimal numbers, parentheses, arithmetic operators (+, -, *, /, %), comparison and equality operators, logical operators (&&, ||, !), and the ternary operator (condition ? value1 : value2). The result must be between 0 and nplurals - 1.

例如,英語使用:

nplurals=2; plural=n != 1;