检查并修正

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

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

../_images/checks.png

自动修正

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

参见

AUTOFIX_LIST

质量检查

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

翻译检查

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

BBcode 标记

概览

译文中的 BBcode 和原文不一致

范围

已翻译字符串

检查 class

weblate.checks.markup.BBCodeCheck

Flag to ignore

ignore-bbcode

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

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

注解

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

连续重复的单词

4.1 新版功能.

概览

一行文本中包含同一单词两次:

范围

已翻译字符串

检查 class

weblate.checks.duplicate.DuplicateCheck

Flag to ignore

ignore-duplicate

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

提示

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

不遵循术语表

4.5 新版功能.

概览

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

范围

已翻译字符串

检查 class

weblate.checks.glossary.GlossaryCheck

Flag to enable

check-glossary

Flag to ignore

ignore-check-glossary

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.

双空格

概览

翻译包含双空格

范围

已翻译字符串

检查 class

weblate.checks.chars.DoubleSpaceCheck

Flag to ignore

ignore-double-space

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

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

格式化字符串

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

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

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

提示

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

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

../_images/format-highlight.png

AngularJS 插值字符串

概览

AngularJS 插值字符串与源文不匹配

范围

已翻译字符串

检查 class

weblate.checks.angularjs.AngularJSInterpolationCheck

Flag to enable

angularjs-format

Flag to ignore

ignore-angularjs-format

命名的格式字符串示例

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

C 格式

概览

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

范围

已翻译字符串

检查 class

weblate.checks.format.CFormatCheck

Flag to enable

c-format

Flag to ignore

ignore-c-format

简单的格式字符串样例

There are %d apples

Position 格式字符串样例

Your balance is %1$d %2$s

C# 格式

概览

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

范围

已翻译字符串

检查 class

weblate.checks.format.CSharpFormatCheck

Flag to enable

c-sharp-format

Flag to ignore

ignore-c-sharp-format

Position 格式字符串样例

There are {0} apples

ECMAScript 模板文字

概览

ECMAScript模板文字和源文件不匹配

范围

已翻译字符串

检查 class

weblate.checks.format.ESTemplateLiteralsCheck

Flag to enable

es-format

Flag to ignore

ignore-es-format

插值例子

There are ${number} apples

i18next 插补

4.0 新版功能.

概览

提供的 i18next 插补和原文不一致

范围

已翻译字符串

检查 class

weblate.checks.format.I18NextInterpolationCheck

Flag to enable

i18next-interpolation

Flag to ignore

ignore-i18next-interpolation

插值例子

There are {{number}} apples

嵌套例子

There are $t(number) apples

Java 格式

概览

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

范围

已翻译字符串

检查 class

weblate.checks.format.JavaFormatCheck

Flag to enable

java-format

Flag to ignore

ignore-java-format

简单的格式字符串样例

There are %d apples

Position 格式字符串样例

Your balance is %1$d %2$s

Java MessageFormat

概览

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

范围

已翻译字符串

检查 class

weblate.checks.format.JavaMessageFormatCheck

Flag to enable uncodintionally

java-messageformat

Flag to enable autodetection

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

Flag to ignore

ignore-java-messageformat

Position 格式字符串样例

There are {0} apples

JavaScript 格式

概览

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

范围

已翻译字符串

检查 class

weblate.checks.format.JavaScriptFormatCheck

Flag to enable

javascript-format

Flag to ignore

ignore-javascript-format

简单的格式字符串样例

There are %d apples

Lua 格式

概览

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

范围

已翻译字符串

检查 class

weblate.checks.format.LuaFormatCheck

Flag to enable

lua-format

Flag to ignore

ignore-lua-format

简单的格式字符串样例

There are %d apples

对象 Pascal 格式

概览

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

范围

已翻译字符串

检查 class

weblate.checks.format.ObjectPascalFormatCheck

Flag to enable

object-pascal-format

Flag to ignore

ignore-object-pascal-format

简单的格式字符串样例

There are %d apples

百分比占位符

4.0 新版功能.

概览

提供的百分比占位符与原文不一致

范围

已翻译字符串

检查 class

weblate.checks.format.PercentPlaceholdersCheck

Flag to enable

percent-placeholders

Flag to ignore

ignore-percent-placeholders

简单的格式字符串样例

There are %number% apples

Perl 格式

概览

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

范围

已翻译字符串

检查 class

weblate.checks.format.PerlFormatCheck

Flag to enable

perl-format

Flag to ignore

ignore-perl-format

简单的格式字符串样例

There are %d apples

Position 格式字符串样例

Your balance is %1$d %2$s

PHP 格式

概览

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

范围

已翻译字符串

检查 class

weblate.checks.format.PHPFormatCheck

Flag to enable

php-format

Flag to ignore

ignore-php-format

简单的格式字符串样例

There are %d apples

Position 格式字符串样例

Your balance is %1$d %2$s

Python brace 格式

概览

Python 大括号格式的字符串与源文不匹配

范围

已翻译字符串

检查 class

weblate.checks.format.PythonBraceFormatCheck

Flag to enable

python-brace-format

Flag to ignore

ignore-python-brace-format

Simple format string

There are {} apples

命名的格式字符串示例

Your balance is {amount} {currency}

Python 格式

概览

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

范围

已翻译字符串

检查 class

weblate.checks.format.PythonFormatCheck

Flag to enable

python-format

Flag to ignore

ignore-python-format

Simple format string

There are %d apples

命名的格式字符串示例

Your balance is %(amount)d %(currency)s

Qt 格式

概览

Qt 格式字符串与源不匹配

范围

已翻译字符串

检查 class

weblate.checks.qt.QtFormatCheck

Flag to enable

qt-format

Flag to ignore

ignore-qt-format

Position 格式字符串样例

There are %1 apples

Qt 复数格式

概览

Qt 复数格式的字符串与原文不匹配

范围

已翻译字符串

检查 class

weblate.checks.qt.QtPluralCheck

Flag to enable

qt-plural-format

Flag to ignore

ignore-qt-plural-format

复数格式字符串样例

There are %Ln apple(s)

Ruby 格式

概览

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

范围

已翻译字符串

检查 class

weblate.checks.ruby.RubyFormatCheck

Flag to enable

ruby-format

Flag to ignore

ignore-ruby-format

简单的格式字符串样例

There are %d apples

Position 格式字符串样例

Your balance is %1$f %2$s

命名的格式字符串示例

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

Named template string

Your balance is %{amount} %{currency}

方案格式

概览

方案格式字符串与源文不匹配

范围

已翻译字符串

检查 class

weblate.checks.format.SchemeFormatCheck

Flag to enable

scheme-format

Flag to ignore

ignore-scheme-format

简单的格式字符串样例

There are ~d apples

Vue I18n 格式

概览

Vue I18n 格式和源不匹配

范围

已翻译字符串

检查 class

weblate.checks.format.VueFormattingCheck

Flag to enable

vue-format

Flag to ignore

ignore-vue-format

已命名格式

There are {count} apples

Rails i18n 格式

There are %{count} apples

连结的语言环境消息

@:message.dio @:message.the_world!

已被翻译

概览

字符串已在过去被翻译

范围

所有字符串

检查 class

weblate.checks.consistency.TranslatedCheck

Flag to ignore

ignore-translated

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

不一致的

概览

此字符串在项目中有不止一种翻译方式,或者在某些组件中不翻译。

范围

所有字符串

检查 class

weblate.checks.consistency.ConsistencyCheck

Flag to ignore

ignore-inconsistent

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.

提示

For performance reasons, the check might not find all inconsistencies, it limits number of matches.

注解

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 字符

3.5 新版功能.

概览

不应使用装饰性的kashida字母

范围

已翻译字符串

检查 class

weblate.checks.chars.KashidaCheck

Flag to ignore

ignore-kashida

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

Markdown 引用

3.5 新版功能.

概览

Markdown 链接引用和原文不一致

范围

已翻译字符串

检查 class

weblate.checks.markup.MarkdownRefLinkCheck

Flag to enable

md-text

Flag to ignore

ignore-md-reflink

Markdown link references do not match source.

Markdown 语法

3.5 新版功能.

概览

Markdown 语法与原文不匹配

范围

已翻译字符串

检查 class

weblate.checks.markup.MarkdownSyntaxCheck

Flag to enable

md-text

Flag to ignore

ignore-md-syntax

Markdown 语法与原文不匹配

译文最大长度

概览

译文不应超过给定长度

范围

已翻译字符串

检查 class

weblate.checks.chars.MaxLengthCheck

Flag to enable

max-length

Flag to ignore

ignore-max-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.

When xml-text flag is also used, the length calculation ignores XML tags.

最大翻译大小

概览

译文不应超过给定长度

范围

已翻译字符串

检查 class

weblate.checks.render.MaxSizeCheck

Flag to enable

max-size

Flag to ignore

ignore-max-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.

When xml-text flag is also used, the length calculation ignores XML tags.

不匹配 \n

概览

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

范围

已翻译字符串

检查 class

weblate.checks.chars.EscapedNewlineCountingCheck

Flag to ignore

ignore-escaped-newline

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

不匹配的冒号

概览

源字符串与已翻译字符串没有都以分号结尾

范围

已翻译字符串

检查 class

weblate.checks.chars.EndColonCheck

Flag to ignore

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

不匹配的省略号

概览

源字符串与已翻译字符串没有都以省略号结尾

范围

已翻译字符串

检查 class

weblate.checks.chars.EndEllipsisCheck

Flag to ignore

ignore-end-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.

不匹配的感叹号

概览

源条目和已经翻译的条目不全都以感叹号结束

范围

已翻译字符串

检查 class

weblate.checks.chars.EndExclamationCheck

Flag to ignore

ignore-end-exclamation

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

不匹配的句号

概览

源字符串与已翻译字符串没有都以句号结尾

范围

已翻译字符串

检查 class

weblate.checks.chars.EndStopCheck

Flag to ignore

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

不匹配的问号

概览

源条目和已经翻译的条目不全都以问号结束

范围

已翻译字符串

检查 class

weblate.checks.chars.EndQuestionCheck

Flag to ignore

ignore-end-question

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

不匹配的分号

概览

源字符串与已翻译字符串没有都以分号结尾

范围

已翻译字符串

检查 class

weblate.checks.chars.EndSemicolonCheck

Flag to ignore

ignore-end-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.

换行符不符

概览

译文中的换行数量和原文不一致

范围

已翻译字符串

检查 class

weblate.checks.chars.NewLineCountCheck

Flag to ignore

ignore-newline-count

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

缺少复数形式

概览

一些复数形式没有翻译

范围

已翻译字符串

检查 class

weblate.checks.consistency.PluralsCheck

Flag to ignore

ignore-plurals

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.

占位符

3.9 新版功能.

概览

翻译缺少一些占位符

范围

已翻译字符串

检查 class

weblate.checks.placeholders.PlaceholderCheck

Flag to enable

placeholders

Flag to ignore

ignore-placeholders

在 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"%[^% ]%"

标点间距

3.9 新版功能.

概览

双引号前缺少不可换行的空格

范围

已翻译字符串

检查 class

weblate.checks.chars.PunctuationSpacingCheck

Flag to ignore

ignore-punctuation-spacing

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.

正则表达式

3.9 新版功能.

概览

翻译与正则表达式不匹配:

范围

已翻译字符串

检查 class

weblate.checks.placeholders.RegexCheck

Flag to enable

regex

Flag to ignore

ignore-regex

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

regex:^foo|bar$

相同复数

概览

一些复数形式采用了相同的翻译

范围

已翻译字符串

检查 class

weblate.checks.consistency.SamePluralsCheck

Flag to ignore

ignore-same-plurals

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

换行开头

概览

源字符串与已翻译字符串没有都以换行开头

范围

已翻译字符串

检查 class

weblate.checks.chars.BeginNewlineCheck

Flag to ignore

ignore-begin-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.

参见

换行结尾

空格开头

概览

源字符串与已翻译字符串开头空格数量不同

范围

已翻译字符串

检查 class

weblate.checks.chars.BeginSpaceCheck

Flag to ignore

ignore-begin-space

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

换行结尾

概览

源字符串与已翻译字符串没有都以换行结尾

范围

已翻译字符串

检查 class

weblate.checks.chars.EndNewlineCheck

Flag to ignore

ignore-end-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.

参见

换行开头

空格结尾

概览

源字符串与已翻译字符串没有都以空格结尾

范围

已翻译字符串

检查 class

weblate.checks.chars.EndSpaceCheck

Flag to ignore

ignore-end-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.

未更改的翻译

概览

源字符串与翻译字符串完全相同

范围

已翻译字符串

检查 class

weblate.checks.same.SameCheck

Flag to ignore

ignore-same

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 网站

3.9 新版功能.

概览

这条翻译使用了不安全的 HTML 标记

范围

已翻译字符串

检查 class

weblate.checks.markup.SafeHTMLCheck

Flag to enable

safe-html

Flag to ignore

ignore-safe-html

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.

提示

When md-text flag is also used, the Markdown style links are also allowed.

参见

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

URL

3.5 新版功能.

概览

翻译未包含 URL

范围

已翻译字符串

检查 class

weblate.checks.markup.URLCheck

Flag to enable

url

Flag to ignore

ignore-url

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 标签和原文不一致

范围

已翻译字符串

检查 class

weblate.checks.markup.XMLTagsCheck

Flag to ignore

ignore-xml-tags

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.

注解

This check is disabled by the safe-html flag as the HTML cleanup done by it can produce HTML markup which is not valid XML.

XML 语法

2.8 新版功能.

概览

该翻译不是有效的 XML

范围

已翻译字符串

检查 class

weblate.checks.markup.XMLValidityCheck

Flag to ignore

ignore-xml-invalid

The XML markup is not valid.

注解

This check is disabled by the safe-html flag as the HTML cleanup done by it can produce HTML markup which is not valid XML.

零宽空格

概览

译文中含有额外的零宽空格字符

范围

已翻译字符串

检查 class

weblate.checks.chars.ZeroWidthSpaceCheck

Flag to ignore

ignore-zero-width-space

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.

省略号

概览

内容中使用三个句点 (…) 代替了省略号 (…)

范围

源字符串

检查 class

weblate.checks.source.EllipsisCheck

Flag to ignore

ignore-ellipsis

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.

长期未翻译

4.1 新版功能.

概览

这个字符串已经很长时间未被翻译了

范围

源字符串

检查 class

weblate.checks.source.LongUntranslatedCheck

Flag to ignore

ignore-long-untranslated

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.

多项检查失败

概览

在几门语言中发生翻译检查失败

范围

源字符串

检查 class

weblate.checks.source.MultipleFailingCheck

Flag to ignore

ignore-multiple-failures

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.

多个未命名的变量

4.1 新版功能.

概览

字符串中有多个未命名的变量,因此译者无法重新排序它们

范围

源字符串

检查 class

weblate.checks.format.MultipleUnnamedFormatsCheck

Flag to ignore

ignore-unnamed-format

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.

未复数化

概览

字符串应该作为复数使用,但未使用其复数形式

范围

源字符串

检查 class

weblate.checks.source.OptionalPluralCheck

Flag to ignore

ignore-optional-plural

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