แทนที่เส้นทางด้วยอินพุต configPath หากคุณต้องการตําแหน่งที่ไม่ใช่ค่าเริ่มต้น
สคีมา
# .github/resource-translator.ymlsourceLocale: en
# Provider config can be nested. Keep secrets in workflow inputs; use repo# config for non-secret defaults like region, model, formality, or category.provider: azure: categoryId: my-custom-translator-category apiVersion: "3.0" allowFallback: true
toLocales: - fr - de - esinclude: - "src/**/*.en.json" - "apps/**/*.en.resx"exclude: - "**/__tests__/**"glossary: Acme: Contoso Octocat: Octocat # keep brand names verbatim
# Translator request shape — most users can ignore these.textType: plain # plain | htmlprofanityAction: NoAction # NoAction | Marked | DeletedprofanityMarker: Asterisk # Asterisk | Tag (only when profanityAction == Marked)
# Resilience — Translator returns 429 under load. Defaults are usually# fine; tune only if your runs are large enough to hit them.maxRetries: 5retryBackoffMs: 30000 # cap on any single backoff sleep (ms)
# Placeholder protection. ON by default — wraps tokens like {{name}},# {0}, %s, ${var} into sentinels before translation and restores them# on the way back. Set false only when source intentionally contains# placeholder-shaped literals.protectPlaceholders: truecustomPlaceholderPatterns: - "<<.+?>>" # any extra token syntax you use
# Per-key opt-out. Keys matching any glob are dropped from the request# and pass through with the source value preserved.noTranslatePatterns: - "errors.code.*" - "brands.*"การอ้างอิงฟิลด์
providerEither a provider string or a nested provider block (provider.azure, provider.aws, or provider.google). Prefer nested blocks for provider-specific settings; keep secrets in workflow inputs rather than committed config.
sourceLocaleถอยกลับไปที่อินพุต sourceLocale หากไม่ได้ตั้งค่า ส่งต่อไปยัง Translator เป็น from=<locale> เพื่อไม่ให้ตรวจพบสตริงสั้น ๆ โดยอัตโนมัติ
toLocalesอาร์เรย์หรือสตริงที่คั่นด้วยจุลภาค
include / excludeรูปแบบ Glob ประเมินเทียบกับเส้นทางสัมบูรณ์และเส้นทางสัมพัทธ์พื้นที่ทํางาน
glossaryการแทนที่คําศัพท์หลังการแปล การรับรู้ขอบเขตคํา (แฮนเดิล C++, .NET)
categoryIdหมวดหมู่ Azure Custom Translator — ปุ่มอุตสาหกรรม/โดเมนของคุณ (กฎหมาย การแพทย์ โทนการตลาด ฯลฯ) ส่งเป็น ?category=...
textTypeค่าเริ่มต้นเป็น plain ใช้ html เฉพาะเมื่อค่าทรัพยากรของคุณมีส่วนย่อย HTML จริง
profanityActionวิธีปฏิบัติต่อคําหยาบคายในผลลัพธ์ที่แปล
profanityMarkerมีความหมายก็ต่อเมื่อ profanityAction "Marked"
allowFallbackตั้งค่าเป็น false เพื่อล้มเหลวในการแปลเมื่อ categoryId ของคุณไม่มีการปรับใช้สําหรับตําแหน่งที่ตั้งเป้าหมายแทนที่จะถอยกลับไปยังแบบจําลองทั่วไป
apiVersionเวอร์ชัน Translator REST API ค่าเริ่มต้นเป็น 3.0
awsFormalityAWS Translate formality setting for supported target languages.
awsBrevitySet to true to enable AWS Translate brevity mode for supported language pairs.
awsTerminologyNames / awsParallelDataNamesAWS Translate custom terminology and parallel data resource names. Either an array or comma-separated string.
googleModelGoogle Cloud Translation model, e.g. nmt or base.
googleApiEndpointOptional Google Cloud Translation API endpoint override.
googleAutoRetryOptional Google Cloud Translation automatic retry toggle. Leave unset to use the Google client default.
maxRetriesความพยายามในการลองใหม่สูงสุดในการตอบกลับ HTTP ชั่วคราว (408, 425, 429, 500, 502, 503, 504) ค่าเริ่มต้นเป็น 5 การเรียก HTTP ทั้งหมดต่อคําขอคือ 1 + maxRetries
retryBackoffMsCap (ms) ในการนอนหลับแบบแบ็คออฟเดียว ค่าเริ่มต้นเป็น 30000 ส่วนหัวของ Retry-After ของ Azure ได้รับเกียรติอย่างแน่นอนเมื่อมีอยู่ มิฉะนั้นจะใช้การแบ็คออฟแบบเอ็กซ์โพเนนเชียลที่กระวนกระวายใจ โดยจํากัดไว้ที่ค่านี้
protectPlaceholdersค่าเริ่มต้นเป็น true เมื่อเปิด โทเค็น เช่น เอนทิตี {{name}}, ${var}, {0}, {0:N2}, %s, %1$s และ HTML จะถูกแทนที่ด้วยโทเค็น sentinel ก่อนการแปลและกู้คืนในภายหลัง ปิดใช้งานเฉพาะเมื่อแหล่งที่มามีตัวอักษรรูปตัวยึดตําแหน่งโดยเจตนา
customPlaceholderPatternsรูปแบบนิพจน์ทั่วไปพิเศษ (ไม่มีตัวคั่น) ที่เพิ่มลงในชุดตัวยึดตําแหน่งเริ่มต้น เช่น <<.+?>> สําหรับไวยากรณ์โทเค็นที่กําหนดเอง นิพจน์ทั่วไปที่ไม่ถูกต้องจะถูกละเว้น
noTranslatePatternsรูปแบบ Glob ที่ตรงกับคีย์ระดับตัวแยกวิเคราะห์ (เส้นทางจุด JSON, RESX name, PO msgid, หน่วย XLIFF id, คีย์ INI/restext) คีย์ที่ตรงกันจะถูกทิ้งออกจากคําขอและส่งผ่านโดยเก็บค่าต้นทางไว้
changeDetectionDefaults to smart. Uses the committed state manifest to translate only changed or missing parser keys. Set to disabled or false to preserve the legacy always-translate behavior.
statePathPath to the deterministic smart change-detection state manifest. Defaults to .github/resource-translator-state.json.
กําลังโหลดคําสั่ง
- การดําเนินการจะอ่านอินพุตที่ชัดเจนจากเวิร์กโฟลว์
- มันโหลดการกําหนดค่า YAML จาก
configPath - สําหรับทุกฟิลด์ที่ใช้ร่วมกัน อินพุตจะชนะ มิฉะนั้นจะใช้ค่า YAML
- ค่าที่ผสานจะได้รับการตรวจสอบความถูกต้อง enums ที่ไม่ถูกต้อง (เช่น
profanityAction: Mask) ทําให้การดําเนินการล้มเหลวอย่างรวดเร็วพร้อมข้อความที่ชัดเจน
น้ําเสียงและอุตสาหกรรมในแง่ธรรมดา
Azure AI Translator v3 API ไม่มีปุ่มโทนเสียงเดียว การตั้งค่าสองแบบรวมกันเพื่อให้คุณควบคุมได้เหมือนกันมากที่สุด:
- อุตสาหกรรม / โดเมน: ใช้
categoryIdเพื่อชี้ไปที่ประเภท Azure Custom Translator ที่ได้รับการฝึกอบรมเกี่ยวกับคลังข้อมูลของคุณเอง — กฎหมาย เทคนิค การแพทย์ การตลาด หรือสิ่งอื่นใด นี่คือคันโยกที่แข็งแกร่งที่สุดสําหรับน้ําเสียง เสียงของแบรนด์ และคําศัพท์ - ข้อความพื้นผิว: ใช้ อภิธานศัพท์ เพื่อล็อกชื่อแบรนด์และคําศัพท์ผลิตภัณฑ์แบบคําต่อคํา และใช้
profanityActionเพื่อลบคําหยาบคายเมื่อกําหนดเป้าหมายการแปลเป็นภาษาท้องถิ่นสําหรับกลุ่มเป้าหมายที่อายุน้อยกว่า