검사 및 수정¶
사용자 정의 자동 수정¶
표준 수정 외에 자체 자동 수정을 구현하여 AUTOFIX_LIST 에 포함할 수 있습니다.
자동 수정은 강력하지만 손상을 일으킬 수도 있으므로 작성 시 주의하세요.
예를 들어, 다음 자동 수정은 번역에서 foo 문자열의 모든 항목을 bar 로 변경함:
from __future__ import annotations
from typing import TYPE_CHECKING
from weblate.trans.autofixes.base import AutoFix
if TYPE_CHECKING:
from weblate.trans.models import Unit
class ReplaceFooWithBar(AutoFix):
"""Replace foo with bar."""
# Might be localized using gettext_lazy
name = "Foobar"
def fix_single_target(
self, target: str, source: str, unit: Unit
) -> tuple[str, bool]:
if "foo" in target:
return target.replace("foo", "bar"), True
return target, False
사용자 정의 검사를 설치하려면 AUTOFIX_LIST 에 Python 클래스의 전체 경로를 제공하세요 ( Custom quality checks, add-ons, translation services and auto-fixes 참조).
플래그를 사용한 동작 사용자 지정¶
플래그를 사용하여 Weblate의 동작을 미세 조정할 수 있습니다. 플래그는 번역자에게 시각적 피드백을 제공하고 번역을 개선하는 데 도움을 줍니다. 플래그는 다음 소스에서 병합됨:
원문 문자열 추가 플래그:
원문 문자열에 대한 추가 정보 은 수동 편집을 설명합니다.
일괄 편집 를 사용하여 플래그를 일괄 적용할 수 있습니다.
일괄 편집 애드온이 플래그를 자동으로 적용할 수 있습니다.
파일 형식에서 추출된 문자열별 플래그 ( 현지화 파일 형식 참조).
번역 플래그 (현재 이중 언어 원문 문자열 또는 단일 언어 템플릿 편집이 꺼진 경우
read-only플래그만 해당).파일 형식별 플래그.
플래그는 쉼표로 구분되며, 매개변수가 있는 경우 콜론으로 구분됩니다. 따옴표를 사용하여 문자열에 공백이나 특수 문자를 포함할 수 있습니다. 예:
placeholders:"special:value":"other value", regex:.*
작은따옴표와 큰따옴표 모두 허용되며, 특수 문자는 백슬래시로 이스케이프됨:
placeholders:"quoted \"string\"":'single \'quoted\''
placeholders:r"^#*"
번역자가 Markdown 문서의 제목을 변경하지 않도록 확인합니다. ### Index 문자열이 # Indice 로 번역되면 검사가 실패합니다.
placeholders:r"\]\([^h].*?\)"
내부 링크가 번역되지 않도록 확인합니다 (예: [test](../checks) 가 [test](../chequeos) 가 되지 않도록).
The flags defined on a higher level can be discarded using the
discard:NAME syntax. For example, if a component is configured to
safe-html, you can add discard:safe-html to the string flags to skip it
for this particular string. Translation flags cannot discard an explicit
read-only flag set on the source string.
현재 허용되는 플래그 목록:
read-only문자열은 읽기 전용이며 Weblate에서 편집해서는 안 됩니다. 읽기 전용 문자열 를 참조하세요.
terminology용어집 에서 사용됩니다. 문자열을 모든 용어집 언어로 복사하여 모든 번역에서 일관되게 사용할 수 있습니다.
read-only와 함께 사용하면 제품 이름 등에 유용합니다.priority:N문자열의 우선순위입니다. 우선순위가 높은 문자열이 먼저 번역을 위해 제시됩니다. 기본 우선순위는 100이며, 우선순위가 높을수록 먼저 번역이 제공됩니다.
xml-textfont-family:NAME렌더링 검사를 위한 글꼴 패밀리를 정의합니다. 글꼴 관리 를 참조하세요.
font-weight:WEIGHT렌더링 검사를 위한 글꼴 두께를 정의합니다. 글꼴 관리 를 참조하세요.
font-size:SIZE렌더링 검사를 위한 글꼴 크기를 정의합니다. 글꼴 관리 를 참조하세요.
font-spacing:SPACING렌더링 검사를 위한 자간을 정의합니다. 글꼴 관리 를 참조하세요.
font-monospaceDisplay the string in the translation editor using a monospace font. Unlike the
font-family/font-size/font-weight/font-spacingflags, this does not affect rendering checks and never loads an uploaded font; it only switches the editor to the browser’s built-in monospace font stack.icu-flags:FLAGSICU MessageFormat 품질 검사의 동작을 사용자 정의하기 위한 플래그를 정의합니다.
icu-tag-prefix:PREFIXICU MessageFormat 품질 검사에 필요한 XML 태그 접두사를 설정합니다.
placeholders:NAME:NAME2:...번역에서 예상되는 자리 표시자 문자열입니다. 자리 표시자 를 참조하세요.
replacements:FROM:TO:FROM2:TO2...결과 텍스트 매개변수를 확인할 때 수행할 치환입니다(예: 번역 최대 크기 또는 번역 최대 길이). 일반적인 사용 사례는 배치 가능 항목을 확장하여 긴 값에서도 텍스트가 맞도록 하는 것입니다. 예:
replacements:%s:"John Doe".variants:SOURCE이 문자열을 원문이 일치하는 문자열의 변형으로 표시합니다. 문자열 변형 를 참조하세요.
regex:REGEX번역과 일치하는 정규 표현식입니다. 정규 표현식 를 참조하세요.
discard:NAME상위 수준에서 정의된 플래그를 무시합니다.
forbidden용어집에서 금지된 번역을 나타냅니다. 금지된 번역 를 참조하세요.
strict-same변경되지 않은 번역 이 내장 단어 예외를 사용하지 않도록 합니다.
strict-format형식 검사가 단일 값의 복수형에서도 형식 사용을 강제하도록 합니다. 형식 문자열 를 참조하세요.
case-insensitive검사 동작을 대소문자 구분 없이 조정합니다. 현재 자리 표시자 품질 검사에만 영향을 줍니다.
acceleratorSpecify the single punctuation accelerator marker, for example
accelerator:&,accelerator:_, oraccelerator:~. Enables the Accelerator key quality check.asciidoc-textTreat a text as an AsciiDoc document, affects 변경되지 않은 번역. Enables the AsciiDoc markup quality check.
bbcode-text텍스트를 BBCode(게시판 코드) 문서로 처리합니다. 변경되지 않은 번역 에 영향을 줍니다. BBCode 마크업 품질 검사를 활성화합니다.
check-glossary용어집 미준수 품질 검사를 활성화합니다.
fluent-partsFluent 파츠 품질 검사를 활성화합니다.
fluent-referencesFluent 참조 품질 검사를 활성화합니다.
fluent-target-inner-htmlFluent 번역 내부 HTML 품질 검사를 활성화합니다.
fluent-target-syntaxFluent 번역 구문 품질 검사를 활성화합니다.
angularjs-formatAngularJS 보간 문자열 품질 검사를 활성화합니다.
automattic-components-formatAutomattic 구성요소 형식 품질 검사를 활성화합니다.
c-formatC 형식 품질 검사를 활성화합니다.
c-sharp-formatC# 형식 품질 검사를 활성화합니다.
csharp-formatC# 형식 품질 검사를 활성화합니다.
es-formatECMAScript 템플릿 리터럴 품질 검사를 활성화합니다.
i18next-interpolationi18next 인터폴레이션 품질 검사를 활성화합니다.
icu-message-formatICU MessageFormat 및 ICU MessageFormat 구문 품질 검사를 활성화합니다.
java-printf-formatJava 형식 품질 검사를 활성화합니다.
java-formatJava MessageFormat 품질 검사를 활성화합니다.
auto-java-messageformat텍스트를 조건부 Java MessageFormat으로 처리하며, 원문에 Java MessageFormat 자리표시자가 포함된 경우에만 Java MessageFormat 을 활성화합니다. Java MessageFormat 품질 검사를 활성화합니다.
javascript-formatJavaScript 형식 품질 검사를 활성화합니다.
laravel-formatLaravel 형식 품질 검사를 활성화합니다.
lua-formatLua 형식 품질 검사를 활성화합니다.
object-pascal-formatObject Pascal 형식 품질 검사를 활성화합니다.
objc-formatObjective-C 형식 품질 검사를 활성화합니다.
percent-placeholders퍼센트 자리 표시자 품질 검사를 활성화합니다.
perl-brace-formatPerl 중괄호 형식 품질 검사를 활성화합니다.
perl-formatPerl 형식 품질 검사를 활성화합니다.
php-formatPHP 형식 품질 검사를 활성화합니다.
python-brace-formatPython 중괄호 형식 품질 검사를 활성화합니다.
python-formatPython 형식 품질 검사를 활성화합니다.
qt-formatQt 형식 품질 검사를 활성화합니다.
qt-plural-formatQt 복수형 품질 검사를 활성화합니다.
ruby-formatRuby 형식 품질 검사를 활성화합니다.
scheme-formatScheme 형식 품질 검사를 활성화합니다.
vue-formatVue I18n 형식 품질 검사를 활성화합니다.
rst-text텍스트를 reStructuredText 문서로 처리합니다. 변경되지 않은 번역 에 영향을 줍니다. 일관성 없는 reStructuredText 및 reStructuredText 구문 오류 품질 검사를 활성화합니다.
md-text텍스트를 Markdown 문서로 처리하고 번역 텍스트 영역에서 Markdown 구문 강조를 제공합니다. 마크다운 링크, 마크다운 참조 및 마크다운 구문 품질 검사를 활성화합니다.
max-length번역 최대 길이 품질 검사를 활성화합니다.
max-linesEnables the Maximum number of lines quality check.
max-size번역 최대 크기 품질 검사를 활성화합니다.
placeholders자리 표시자 품질 검사를 활성화합니다.
regex정규 표현식 품질 검사를 활성화합니다.
safe-mdxEnables the Safe MDX quality check.
safe-html안전하지 않은 HTML 품질 검사를 활성화합니다.
auto-safe-html텍스트를 조건부 HTML로 처리하며, 일반 텍스트 또는 표준 HTML 마크업이나 유효한 사용자 정의 요소가 포함된 원문 문자열에 대해서만 안전하지 않은 HTML 을 활성화합니다. 이는 꺾쇠괄호 구문이 HTML이 아닐 수 있는 MDX와 같은 확장 Markdown 변형에 유용합니다. 안전하지 않은 HTML 품질 검사를 활성화합니다.
url문자열은 URL만으로 구성되어야 합니다. URL 품질 검사를 활성화합니다.
fluent-source-inner-htmlFluent 원문 내부 HTML 품질 검사를 활성화합니다.
fluent-source-syntaxFluent 원문 구문 품질 검사를 활성화합니다.
ignore-all-checks모든 품질 검사를 무시합니다.
ignore-acceleratorSkip the Accelerator key quality check.
ignore-ai-accuracySkip the AI: Accuracy quality check.
ignore-ai-fluencySkip the AI: Fluency quality check.
ignore-ai-formattingSkip the AI: Formatting quality check.
ignore-ai-styleSkip the AI: Style quality check.
ignore-ai-terminologySkip the AI: Terminology quality check.
ignore-asciidoc-markupSkip the AsciiDoc markup quality check.
ignore-bbcodeBBCode 마크업 품질 검사를 건너뜁니다.
ignore-xml-chars-around-tagsXML 태그 주변 문자 품질 검사를 건너뜁니다.
ignore-duplicate연속 중복 단어 품질 검사를 건너뜁니다.
ignore-check-glossary용어집 미준수 품질 검사를 건너뜁니다.
ignore-double-space이중 공백 품질 검사를 건너뜁니다.
ignore-fluent-partsFluent 파츠 품질 검사를 건너뜁니다.
ignore-fluent-referencesFluent 참조 품질 검사를 건너뜁니다.
ignore-fluent-target-inner-htmlFluent 번역 내부 HTML 품질 검사를 건너뜁니다.
ignore-fluent-target-syntaxFluent 번역 구문 품질 검사를 건너뜁니다.
ignore-angularjs-formatAngularJS 보간 문자열 품질 검사를 건너뜁니다.
ignore-automattic-components-formatAutomattic 구성요소 형식 품질 검사를 건너뜁니다.
ignore-c-formatC 형식 품질 검사를 건너뜁니다.
ignore-c-sharp-formatC# 형식 품질 검사를 건너뜁니다.
ignore-es-formatECMAScript 템플릿 리터럴 품질 검사를 건너뜁니다.
ignore-i18next-interpolationi18next 인터폴레이션 품질 검사를 건너뜁니다.
ignore-icu-message-formatICU MessageFormat 품질 검사를 건너뜁니다.
ignore-java-printf-formatJava 형식 품질 검사를 건너뜁니다.
ignore-java-formatJava MessageFormat 품질 검사를 건너뜁니다.
ignore-javascript-formatJavaScript 형식 품질 검사를 건너뜁니다.
ignore-laravel-formatLaravel 형식 품질 검사를 건너뜁니다.
ignore-lua-formatLua 형식 품질 검사를 건너뜁니다.
ignore-object-pascal-formatObject Pascal 형식 품질 검사를 건너뜁니다.
ignore-objc-formatObjective-C 형식 품질 검사를 건너뜁니다.
ignore-percent-placeholders퍼센트 자리 표시자 품질 검사를 건너뜁니다.
ignore-perl-brace-formatPerl 중괄호 형식 품질 검사를 건너뜁니다.
ignore-perl-formatPerl 형식 품질 검사를 건너뜁니다.
ignore-php-formatPHP 형식 품질 검사를 건너뜁니다.
ignore-python-brace-formatPython 중괄호 형식 품질 검사를 건너뜁니다.
ignore-python-formatPython 형식 품질 검사를 건너뜁니다.
ignore-qt-formatQt 형식 품질 검사를 건너뜁니다.
ignore-qt-plural-formatQt 복수형 품질 검사를 건너뜁니다.
ignore-ruby-formatRuby 형식 품질 검사를 건너뜁니다.
ignore-scheme-formatScheme 형식 품질 검사를 건너뜁니다.
ignore-vue-formatVue I18n 형식 품질 검사를 건너뜁니다.
ignore-translated번역 완료됨 품질 검사를 건너뜁니다.
ignore-inconsistent일관성 없음 품질 검사를 건너뜁니다.
ignore-rst-references일관성 없는 reStructuredText 품질 검사를 건너뜁니다.
ignore-kashida카시다 문자 사용됨 품질 검사를 건너뜁니다.
ignore-md-link마크다운 링크 품질 검사를 건너뜁니다.
ignore-md-reflink마크다운 참조 품질 검사를 건너뜁니다.
ignore-md-syntax마크다운 구문 품질 검사를 건너뜁니다.
ignore-max-length번역 최대 길이 품질 검사를 건너뜁니다.
ignore-max-linesSkip the Maximum number of lines quality check.
ignore-max-size번역 최대 크기 품질 검사를 건너뜁니다.
ignore-escaped-newline\n 불일치 품질 검사를 건너뜁니다.
ignore-end-colon콜론 불일치 품질 검사를 건너뜁니다.
ignore-end-ellipsis줄임표 불일치 품질 검사를 건너뜁니다.
ignore-end-exclamation느낌표 불일치 품질 검사를 건너뜁니다.
ignore-end-stop마침표 불일치 품질 검사를 건너뜁니다.
ignore-end-interrobang인터로뱅 불일치 품질 검사를 건너뜁니다.
ignore-end-question물음표 불일치 품질 검사를 건너뜁니다.
ignore-end-semicolon세미콜론 불일치 품질 검사를 건너뜁니다.
ignore-newline-count줄바꿈 불일치 품질 검사를 건너뜁니다.
ignore-plurals복수형 누락 품질 검사를 건너뜁니다.
ignore-multiple-capital연속 대문자 품질 검사를 건너뜁니다.
ignore-kabyle-characters카빌어 비표준 문자 품질 검사를 건너뜁니다.
ignore-placeholders자리 표시자 품질 검사를 건너뜁니다.
ignore-prohibited-initial-character금지된 첫 문자 품질 검사를 건너뜁니다.
ignore-punctuation-spacing구두점 간격 품질 검사를 건너뜁니다.
ignore-regex정규 표현식 품질 검사를 건너뜁니다.
ignore-rst-syntaxreStructuredText 구문 오류 품질 검사를 건너뜁니다.
ignore-reused재사용된 번역 품질 검사를 건너뜁니다.
ignore-safe-mdxSkip the Safe MDX quality check.
ignore-same-plurals동일 복수형 품질 검사를 건너뜁니다.
ignore-begin-newline시작 줄바꿈 품질 검사를 건너뜁니다.
ignore-begin-space시작 공백 품질 검사를 건너뜁니다.
ignore-end-newline末尾 줄바꿈 품질 검사를 건너뜁니다.
ignore-end-space후행 공백 품질 검사를 건너뜁니다.
ignore-same변경되지 않은 번역 품질 검사를 건너뜁니다.
ignore-safe-html안전하지 않은 HTML 품질 검사를 건너뜁니다.
ignore-urlURL 품질 검사를 건너뜁니다.
ignore-xml-tagsXML 마크업 품질 검사를 건너뜁니다.
ignore-xml-invalidXML 구문 품질 검사를 건너뜁니다.
ignore-zero-width-space폭 없는 공백 품질 검사를 건너뜁니다.
ignore-ellipsis줄임표 품질 검사를 건너뜁니다.
ignore-fluent-source-inner-htmlFluent 원문 내부 HTML 품질 검사를 건너뜁니다.
ignore-fluent-source-syntaxFluent 원문 구문 품질 검사를 건너뜁니다.
ignore-icu-message-formatICU MessageFormat 구문 품질 검사를 건너뜁니다.
ignore-long-untranslated장기 미번역 품질 검사를 건너뜁니다.
ignore-multiple-failures복수 검사 실패 품질 검사를 건너뜁니다.
ignore-unnamed-format명명되지 않은 복수 변수 품질 검사를 건너뜁니다.
ignore-source-max-lengthSkip the 원문 문자열 길이 quality check.
ignore-optional-plural복수형 미사용 품질 검사를 건너뜁니다.
참고
일반적으로 규칙은 식별자를 사용하여 ignore-* 로 명명되므로 사용자 정의 검사에도 사용할 수 있습니다.
이 플래그는 구성요소 설정 설정, 원문 문자열별 설정, 번역 파일 자체 (예: GNU gettext)에서 모두 인식됩니다.
위치 기반 플래그¶
일부 플래그는 위치에 따라 기본적으로 문자열에 추가됩니다. 이는 문자열이 사용되는 위치에 따라 특정 검사가 자동으로 활성화됨을 의미합니다.
rst-text: 위치 확장자가.rst인 경우, reStructuredText 파일의 문자열에 자동으로 추가되는 플래그입니다.md-text: 파일 확장자가.md,.markdown또는.mdx인 경우, 이 플래그가 마크다운 및 MDX 파일 내의 문자열에 자동으로 추가됩니다.
검사 강제¶
강제 검사는 해제할 수 없으며 문자열을 편집 필요 로 표시합니다 ( 번역 상태 참조). 이를 통해 번역자가 해당 검사를 숨기는 것을 방지합니다.
힌트
검사 강제를 켜도 자동으로 활성화되지 않습니다. 일부 검사는 문자열 또는 구성요소 플래그에 해당 플래그를 추가하여 활성화해야 합니다.
이는 형식 문자열 와 같이 사용 시 심각한 문제를 일으킬 수 있는 검사에 가장 적합합니다. 변경되지 않은 번역 과 같은 스타일 검사에는 권장되지 않습니다. 해제가 때떄로 합리적인 접근 방식이기 때문입니다.
그런 다음 번역 품질 필터 를 사용하여 편집이 필요한 문자열이 버전 관리에 커밋되지 않도록 제외할 수 있습니다.
글꼴 관리¶
힌트
Weblate에 업로드된 글꼴은 번역 최대 크기 검사 목적으로만 사용되며 Weblate 사용자 인터페이스에는 영향을 미치지 않습니다.
렌더링된 텍스트의 치수를 계산하는 데 사용되는 번역 최대 크기 검사는 글꼴이 Weblate에 로드되어 번역 플래그로 선택되어야 합니다 ( 플래그를 사용한 동작 사용자 지정 참조).
번역 프로젝트의 작업 메뉴 아래 글꼴 에 있는 Weblate 글꼴 관리 도구는 글꼴을 업로드하고 관리하는 인터페이스를 제공합니다. TrueType 또는 OpenType 글꼴을 업로드하고, 글꼴 그룹을 설정하여 검사에서 사용할 수 있습니다.
Uploads must contain a single TrueType or OpenType font with a .ttf or
.otf extension. WOFF, WOFF2, font collections, and legacy font formats are
not supported, even when renamed to use one of these extensions.
글꼴 그룹을 사용하면 비라틴 언어에 일반적으로 필요한, 언어별로 다른 글꼴을 정의할 수 있음:
글꼴 그룹은 이름으로 식별되며, 공백이나 특수 문자를 포함할 수 없어 검사 정의에서 쉽게 사용할 수 있음:
글꼴 계열과 스타일은 업로드 후 자동으로 인식됩니다:
Weblate에 여러 글꼴을 로드할 수 있음:
글꼴을 문자열 길이 검사에 사용하려면 적절한 플래그를 전달하세요 ( 플래그를 사용한 동작 사용자 지정 참조). 다음 플래그가 필요할 수 있음:
max-size:500/max-size:300:5Defines maximal width in pixels and, optionally, the maximum number of lines. Word wrapping is applied when more than one line is configured.
font-family:ubuntu식별자를 지정하여 사용할 글꼴 그룹을 정의합니다.
font-size:22글꼴 크기(픽셀)를 정의합니다.
자체 검사 작성¶
다양한 품질 검사가 내장되어 있습니다 ( 품질 검사 참조). 하지만 확인하려는 모든 항목을 다루지는 않을 수 있습니다. 수행되는 검사 목록은 CHECK_LIST 를 사용하여 조정할 수 있으며, 사용자 정의 검사를 추가할 수도 있습니다.
weblate.checks.Check 의 하위 클래스를 만듭니다
몇 가지 속성을 설정합니다.
check(코드에서 복수형을 처리하려는 경우) 또는check_single메서드 (복수형을 자동으로 처리)를 구현합니다.
일부 예시:
사용자 정의 검사를 설치하려면 CHECK_LIST 에 Python 클래스의 전체 경로를 제공하세요 ( Custom quality checks, add-ons, translation services and auto-fixes 참조).
Checks declaring propagates = "source" or propagates = "target" update
related strings in the background after a save. They can override
evaluate_propagated(units) to evaluate a matching group in bulk. Yield a
(unit, failed) pair for every string, including passing strings so stale
warnings can be removed. Without this override, Weblate evaluates the check
on each matching string in chunks.
번역 텍스트에 “foo”가 포함되지 않았는지 확인¶
이것은 번역에 “foo” 문자열이 누락되었는지 확인하는 매우 간단한 검사입니다.
"""Simple quality check example."""
from __future__ import annotations
from typing import TYPE_CHECKING
from django.utils.translation import gettext_lazy
from weblate.checks.base import TargetCheck
if TYPE_CHECKING:
from weblate.trans.models import Unit
class FooCheck(TargetCheck):
# Used as identifier for check, should be unique
# Has to be shorter than 50 characters
check_id = "foo"
# Short name used to display failing check
# Might be localized using gettext_lazy
name = "Foo check"
# Description for failing check
description = gettext_lazy("Your translation is foo")
# Real check code
def check_single(self, source: str, target: str, unit: Unit) -> bool:
return "foo" in target
체코어 번역 텍스트의 복수형이 서로 다른지 확인¶
언어 정보를 사용하여 체코어의 두 복수형이 동일하지 않은지 확인합니다.
"""Quality check example for Czech plurals."""
from __future__ import annotations
from django.utils.translation import gettext_lazy
from weblate.checks.base import TargetCheck
class PluralCzechCheck(TargetCheck):
# Used as identifier for check, should be unique
# Has to be shorter than 50 characters
check_id = "foo"
# Short name used to display failing check
# Might be localized using gettext_lazy
name = "Foo check"
# Description for failing check
description = gettext_lazy("Your translation is foo")
# Real check code
def check_target_unit(self, sources, targets, unit) -> bool:
if unit.translation.language.is_base({"cs"}):
return targets[1] == targets[2]
return False
def check_single(self, source, target, unit) -> bool:
"""We don't check target strings here."""
return False