检查并修正

质量检查有助于发现常见的翻译错误,确保翻译质量良好。如果出现误报,则可以忽略这些检查。

提交未通过检查的翻译后,将立即向用户显示:

../_images/checks.png

自动修正

除了 质量检查 外,Weblate 还可以自动修复翻译字符串中的一些常见错误。谨慎使用它,不要使其增加翻译错误。

参见

AUTOFIX_LIST

质量检查

Weblate 对字符串进行了广泛的质量检查。以下部分将对它们进行更详细的描述。还有针对特定语言的检查。如果有错误报告,请将缺陷提交。

翻译检查

在每次翻译更改时执行,帮助翻译人员保持高质量的翻译。

BBcode 标记

翻译中的 BBcode 与来源不符

BBCode 表示简单的标记,例如以粗体或斜体突出显示消息的重要部分。

此检查确保在翻译中也找到它们。

注解

当前检测 BBcode 的方法非常简单,因此此检查可能会产生误报。

连续重复的单词

文本连续两次包含相同的单词:

4.1 新版功能.

检查翻译中是否没有连续重复的单词。这通常表示翻译错误。

提示

此检查包括特定于语言的规则,以避免误报。如果在您的情况下错误触发,请告诉我们。请参阅 在 Weblate 中汇报问题

不遵循语汇表

4.5 新版功能.

该翻译未遵循语汇表中定义的术语。

This check has to be turned on using check-glossary flag (see 使用标志定制行为). Please consider following prior to enabling it:

  • It does exact string matching, the glossary is expected to contain terms in all variants.

  • Checking each string against glossary is expensive, it will slow down any operation in Weblate which involves running checks like importing strings or translating.

双空格

翻译包含双空格

检查翻译中是否存在双空格,以避免其他与空格相关的检查出现误报。

当在源中找到双空格时,检查为假,这意味着故意使用双空格。

格式化字符串

检查字符串格式是否在源和翻译之间复制。在翻译中省略格式字符串通常会导致严重的问题,因此字符串中的格式通常应与源匹配。

Weblate 支持检查几种语言的格式字符串。仅当适当地标记了字符串时(例如,C 格式为 c-format),才会自动启用该检查。Gettext 会自动添加它,但是对于其他文件格式,或者如果您的 PO 文件不是由 xgettext 生成的,您可能必须手动添加它。

可以按每单位(请参阅 源字符串另外的信息)或在 组件配置 中完成此操作。为每个组件定义它比较简单,但是如果该字符串未解释为格式化字符串,而碰巧使用了格式化字符串语法,则可能导致误报。

提示

如果 Weblate 中不提供特定格式的检查,则可以使用通用 占位符

除了检查,这也将高亮格式化字符串,方便将它们插入到已翻译字符串:

../_images/format-highlight.png

AngularJS 插值字符串

AngularJS interpolation strings do not match source

Named format string

Your balance is {{amount}} {{ currency }}

Flag to enable

angularjs-format

C 格式

C format string does not match source

Simple format string

There are %d apples

Position format string

Your balance is %1$d %2$s

Flag to enable

c-format

C# 格式

C# format string does not match source

Position format string

There are {0} apples

Flag to enable

c-sharp-format

ECMAScript 模板文字

ECMAScript 模板文字与源不匹配

Interpolation

There are ${number} apples

Flag to enable

es-format

i18next 插补

The i18next interpolation does not match source

4.0 新版功能.

Interpolation

There are {{number}} apples

Nesting

There are $t(number) apples

Flag to enable

i18next-interpolation

Java 格式

Java format string does not match source

Simple format string

There are %d apples

Position format string

Your balance is %1$d %2$s

Flag to enable

java-format

Java MessageFormat

Java MessageFormat string does not match source

Position format string

There are {0} apples

Flag to enable

java-messageformat enables the check unconditionally

auto-java-messageformat enables check only if there is a format string in the source

JavaScript 格式

JavaScript format string does not match source

Simple format string

There are %d apples

Flag to enable

javascript-format

Lua 格式

Lua 格式的字符串与源文不匹配

Simple format string

There are %d apples

Flag to enable

lua-format

对象 Pascal 格式

对象 Pascal 格式字符串与源不匹配

Simple format string

There are %d apples

Flag to enable

object-pascal-format

百分比占位符

The percent placeholders do not match source

4.0 新版功能.

Simple format string

There are %number% apples

Flag to enable

percent-placeholders

Perl 格式

Perl format string does not match source

Simple format string

There are %d apples

Position format string

Your balance is %1$d %2$s

Flag to enable

perl-format

PHP 格式

PHP format string does not match source

Simple format string

There are %d apples

Position format string

Your balance is %1$d %2$s

Flag to enable

php-format

Python brace 格式

Python brace format string does not match source

Simple format string

There are {} apples

Named format string

Your balance is {amount} {currency}

Flag to enable

python-brace-format

Python 格式

Python format string does not match source

Simple format string

There are %d apples

Named format string

Your balance is %(amount) %(currency)

Flag to enable

python-format

Qt 格式

Qt format string does not match source

Position format string

There are %1 apples

Flag to enable

qt-format

Qt 复数格式

Qt plural format string does not match source

Plural format string

There are %Ln apple(s)

Flag to enable

qt-plural-format

Ruby 格式

Ruby format string does not match source

Simple format string

There are %d apples

Position format string

Your balance is %1$f %2$s

Named format string

Your balance is %+.2<amount>f %<currency>s

Named template string

Your balance is %{amount} %{currency}

Flag to enable

ruby-format

方案格式

方案格式字符串不匹配源

Simple format string

There are ~d apples

Flag to enable

scheme-format

Vue I18n 格式

The Vue I18n formatting does not match source

已命名格式

There are {count} apples

Rails i18n 格式

There are %{count} apples

连结的语言环境消息

@:message.dio @:message.the_world!

Flag to enable

vue-format

已被翻译

This string has been translated in the past

Means a string has been translated already. This can happen when the translations have been reverted in VCS or lost otherwise.

不一致的

This string has more than one translation in this project or is not translated in some components.

Weblate checks translations of the same string across all translation within a project to help you keep consistent translations.

The check fails on differing translations of one string within a project. This can also lead to inconsistencies in displayed checks. You can find other translations of this string on the Other occurrences tab.

注解

This check also fires in case the string is translated in one component and not in another. It can be used as a quick way to manually handle strings which are not translated in some components just by clicking on the Use this translation button displayed on each line in the Other occurrences tab.

You can use 自动化翻译 addon to automate translating of newly added strings which are already translated in another component.

已使用 Kashida 字符

The decorative kashida letters should not be used

3.5 新版功能.

The decorative Kashida letters should not be used in translation. These are also known as Tatweel.

Markdown 引用

Markdown link references do not match source

3.5 新版功能.

Markdown link references do not match source.

Markdown 语法

Markdown syntax does not match source

3.5 新版功能.

Markdown 语法与原文不匹配

译文最大长度

Translation should not exceed given length

检查翻译的长度是否可匹配可用的空间。这只检查翻译字符的长度。

Unlike the other checks, the flag should be set as a key:value pair like max-length:100.

提示

This check looks at number of chars, what might not be the best metric when using proportional fonts to render the text. The 最大翻译大小 check does check actual rendering of the text.

The replacements: flag might be also useful to expand placeables before checking the string.

最大翻译大小

Translation rendered text should not exceed given size

3.7 新版功能.

Translation rendered text should not exceed given size. It renders the text with line wrapping and checks if it fits into given boundaries.

This check needs one or two parameters - maximal width and maximal number of lines. In case the number of lines is not provided, one line text is considered.

You can also configure used font by font-* directives (see 使用标志定制行为), for example following translation flags say that the text rendered with ubuntu font size 22 should fit into two lines and 500 pixels:

max-size:500:2, font-family:ubuntu, font-size:22

提示

You might want to set font-* directives in 组件配置 to have the same font configured for all strings within a component. You can override those values per string in case you need to customize it per string.

The replacements: flag might be also useful to expand placeables before checking the string.

不匹配 \n

译文中的 n 数量和原文不一致

Usually escaped newlines are important for formatting program output. Check fails if the number of \n literals in translation do not match the source.

不匹配的冒号

Source and translation do not both end with a colon

Checks that colons are replicated between both source and translation. The presence of colons is also checked for various languages where they do not belong (Chinese or Japanese).

不匹配的省略号

Source and translation do not both end with an ellipsis

Checks that trailing ellipses are replicated between both source and translation. This only checks for real ellipsis () not for three dots (...).

An ellipsis is usually rendered nicer than three dots in print, and sounds better with text-to-speech.

不匹配的感叹号

Source and translation do not both end with an exclamation mark

Checks that exclamations are replicated between both source and translation. The presence of exclamation marks is also checked for various languages where they do not belong (Chinese, Japanese, Korean, Armenian, Limbu, Myanmar or Nko).

不匹配的句号

Source and translation do not both end with a full stop

Checks that full stops are replicated between both source and translation. The presence of full stops is checked for various languages where they do not belong (Chinese, Japanese, Devanagari or Urdu).

不匹配的问号

源文件和译文没有都以问号结尾

Checks that question marks are replicated between both source and translation. The presence of question marks is also checked for various languages where they do not belong (Armenian, Arabic, Chinese, Korean, Japanese, Ethiopic, Vai or Coptic).

不匹配的分号

Source and translation do not both end with a semicolon

Checks that semicolons at the end of sentences are replicated between both source and translation. This can be useful to keep formatting of entries such as desktop files.

换行符不符

Number of new lines in translation does not match source

Usually newlines are important for formatting program output. Check fails if the number of \n literals in translation do not match the source.

缺少复数形式

Some plural forms are not translated

Checks that all plural forms of a source string have been translated. Specifics on how each plural form is used can be found in the string definition.

Failing to fill in plural forms will in some cases lead to displaying nothing when the plural form is in use.

占位符

Translation is missing some placeholders:

3.9 新版功能.

在 4.3 版更改: 你可以使用正则表达式作为占位符。

Translation is missing some placeholders. These are either extracted from the translation file or defined manually using placeholders flag, more can be separated with colon, strings with space can be quoted:

placeholders:$URL$:$TARGET$:"some long text"

In case you have some syntax for placeholders, you can use a regular expression:

placeholders:r"%[^% ]%"

标点间距

Missing non breakable space before double punctuation sign

3.9 新版功能.

Checks that there is non breakable space before double punctuation sign (exclamation mark, question mark, semicolon and colon). This rule is used only in a few selected languages like French or Breton, where space before double punctuation sign is a typographic rule.

正则表达式

Translation does not match regular expression:

3.9 新版功能.

Translation does not match regular expression. The expression is either extracted from the translation file or defined manually using regex flag:

regex:^foo|bar$

相同复数

Some plural forms are translated in the same way

Check that fails if some plural forms are duplicated in the translation. In most languages they have to be different.

换行开头

Source and translation do not both start with a newline

Newlines usually appear in source strings for good reason, omissions or additions can lead to formatting problems when the translated text is put to use.

参见

换行结尾

空格开头

Source and translation do not both start with same number of spaces

A space in the beginning of a string is usually used for indentation in the interface and thus important to keep.

换行结尾

Source and translation do not both end with a newline

Newlines usually appear in source strings for good reason, omissions or additions can lead to formatting problems when the translated text is put to use.

参见

换行开头

空格结尾

Source and translation do not both end with a space

Checks that trailing spaces are replicated between both source and translation.

Trailing space is usually utilized to space out neighbouring elements, so removing it might break layout.

未更改的翻译

Source and translation are identical

Happens if the source and corresponding translation strings is identical, down to at least one of the plural forms. Some strings commonly found across all languages are ignored, and various markup is stripped. This reduces the number of false positives.

This check can help find strings mistakenly untranslated.

The default behavior of this check is to exclude words from the built-in blacklist from the checking. These are words which are frequently not being translated. This is useful to avoid false positives on short strings, which consist only of single word which is same in several languages. This blacklist can be disabled by adding strict-same flag to string or component.

不安全的 HTML 网站

The translation uses unsafe HTML markup

3.9 新版功能.

The translation uses unsafe HTML markup. This check has to be enabled using safe-html flag (see 使用标志定制行为). There is also accompanied autofixer which can automatically sanitize the markup.

参见

The HTML check is performed by the Bleach library developed by Mozilla.

URL

The translation does not contain an URL

3.5 新版功能.

The translation does not contain an URL. This is triggered only in case the unit is marked as containing URL. In that case the translation has to be a valid URL.

XML 标记

XML tags in translation do not match source

This usually means the resulting output will look different. In most cases this is not a desired result from changing the translation, but occasionally it is.

Checks that XML tags are replicated between both source and translation.

XML 语法

The translation is not valid XML

2.8 新版功能.

The XML markup is not valid.

零宽空格

Translation contains extra zero-width space character

Zero-width space (<U+200B>) characters are used to break messages within words (word wrapping).

As they are usually inserted by mistake, this check is triggered once they are present in translation. Some programs might have problems when this character is used.

Source checks

Source checks can help developers improve the quality of source strings.

省略号

The string uses three dots (…) instead of an ellipsis character (…)

This fails when the string uses three dots (...) when it should use an ellipsis character ().

Using the Unicode character is in most cases the better approach and looks better rendered, and may sound better with text-to-speech.

长期未翻译

The string has not been translated for a long time

4.1 新版功能.

When the string has not been translated for a long time, it is can indicate problem in a source string making it hard to translate.

多项检查失败

The translations in several languages have failing checks

Numerous translations of this string have failing quality checks. This is usually an indication that something could be done to improve the source string.

This check failing can quite often be caused by a missing full stop at the end of a sentence, or similar minor issues which translators tend to fix in translation, while it would be better to fix it in the source string.

多个未命名的变量

There are multiple unnamed variables in the string, making it impossible for translators to reorder them

4.1 新版功能.

There are multiple unnamed variables in the string, making it impossible for translators to reorder them.

Consider using named variables instead to allow translators to reorder them.

未复数化

The string is used as plural, but not using plural forms

The string is used as a plural, but does not use plural forms. In case your translation system supports this, you should use the plural aware variant of it.

For example with Gettext in Python it could be:

from gettext import ngettext

print ngettext("Selected %d file", "Selected %d files", files) % files