Lingo.dev + .xml (데이터)
Lingo.dev CLI는 문서 구조, 속성, 네임스페이스 및 스키마 준수를 유지하면서 XML 파일을 번역합니다. CLI는 XML 스키마 및 DTD 준수를 유지하고, 모든 네임스페이스 선언과 접두사를 보존하며, 정확한 XML 계층 구조와 형식을 유지하고, 다양한 문자 인코딩을 올바르게 처리하며, 출력이 XML 유효성 검사 도구를 통과하도록 보장합니다.
빠른 설정
로케일 기반 이름 지정이 있는 XML 파일에 대한 구성:
{
"locale": {
"source": "en",
"targets": ["es", "fr", "de"]
},
"buckets": {
"xml": {
"include": ["data/[locale].xml"]
}
}
}
주의사항: [locale]
은 CLI 실행 중에 실제 로케일로 대체되므로 구성에 문자 그대로 남겨두어야 하는 플레이스홀더입니다.
XML 콘텐츠 번역
npx lingo.dev@latest i18n
텍스트 콘텐츠를 번역하는 동시에 XML 구조, 속성, 네임스페이스 및 문서 스키마를 보존합니다.
XML 구조 처리
요소 콘텐츠
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<product id="123">
<name>Premium Widget</name>
<description>High-quality widget for professionals</description>
<category>Tools</category>
</product>
</catalog>
XML 구조는 그대로 유지하면서 요소 내의 텍스트 콘텐츠가 번역됩니다.
속성 번역
<item title="User Manual" description="Complete guide">
<help tooltip="Click for assistance">Getting Started</help>
</item>
기술적 속성은 변경되지 않은 상태로 유지되는 동안 번역 가능한 속성이 처리됩니다.
혼합 콘텐츠 처리
<documentation>
<section title="Introduction">
Welcome to our <emphasis>comprehensive</emphasis> guide.
Visit <link href="/help">our help center</link> for more information.
</section>
</documentation>
텍스트와 요소 콘텐츠가 혼합된 경우도 올바르게 처리됩니다.
고급 XML 기능
네임스페이스 지원
<root xmlns:ui="http://example.com/ui"
xmlns:data="http://example.com/data">
<ui:label>Welcome Message</ui:label>
<data:content ui:title="Page Title">
Content goes here
</data:content>
</root>
XML 네임스페이스와 접두사가 정확히 보존됩니다.
CDATA 섹션
<content>
<![CDATA[
This is raw content that won't be translated,
including <tags> and special characters.
]]>
</content>
<message>This text will be translated</message>
CDATA 섹션은 그대로 유지되는 반면 일반 텍스트 콘텐츠는 처리됩니다.
처리 지침
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<document>
<title>Document Title</title>
</document>
처리 지침 및 XML 선언은 보존됩니다.
고급 구성
다중 XML 파일
"xml": {
"include": [
"data/[locale].xml",
"config/[locale]/*.xml"
]
}
기술적 요소 잠금
"xml": {
"include": ["data/[locale].xml"],
"lockedKeys": ["id", "version", "timestamp", "schema"]
}