ປ່ຽນເສັ້ນທາງດ້ວຍຂໍ້ມູນ 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ກັບ ຄືນ ໄປ ຫາ input sourceLocale ຖ້າ ບໍ່ ໄດ້ ຕັ້ງ ໄວ້. ຍັງສົ່ງຕໍ່ໃຫ້ຜູ້ແປ from=<locale> ດັ່ງນັ້ນເຊືອກສັ້ນໆຈຶ່ງບໍ່ຖືກກວດພົບໂດຍອັດຕະໂນມັດ.
toLocalesບໍ່ວ່າຈະເປັນ array ຫຼື string ທີ່ແຍກດ້ວຍเครื่องหมาย comma.
include / excludeແບບ ແຜນ Glob ຖືກ ປະ ເມີນ ກັບ ເສັ້ນ ທາງ ທີ່ ສົມ ບູນ ແລະ ກ່ຽວ ພັນ ກັບ ບ່ອນ ທໍາ ງານ.
glossaryການປ່ຽນຄໍາສັບຫຼັງການແປ. Word-boundary aware (handles C++, .NET).
categoryIdAzure Custom Translator category — ອຸດສາຫະກໍາ / domain knob ຂອງເຈົ້າ (ກົດຫມາຍ, ການແພດ, ນ້ໍາສຽງການຕະຫຼາດ, ແລະ ອື່ນໆ). ຖືກ ສົ່ງ ໄປ ເປັນ ?category=....
textTypeມາດຕະຖານ plain. ໃຊ້ html ພຽງ ແຕ່ ຖ້າ ຫາກ ຄ່າ ຊັບ ພະ ຍາ ກອນ ຂອງ ທ່ານ ມີ ສ່ວນ HTML ແທ້ໆ.
profanityActionວິທີປະຕິບັດກັບຄໍາສັບທີ່ຫມິ່ນປະຫມາດໃນຜົນງານທີ່ແປ.
profanityMarkerມີ ຄວາມ ຫມາຍ ພຽງ ແຕ່ ເມື່ອ profanityAction ເປັນ "Marked".
allowFallbackຕັ້ງໄວ້ເປັນ false ເພື່ອບໍ່ສາມາດແປໄດ້ເມື່ອ categoryId ຂອງເຈົ້າບໍ່ມີການນໍາໃຊ້ສໍາລັບສະຖານທີ່ເປົ້າຫມາຍແທນທີ່ຈະກັບຄືນໄປຫາແບບຢ່າງທົ່ວໄປ.
apiVersionTranslator REST API version. ມາດຕະຖານ 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 ໄດ້ ຮັບ ກຽດ ຢ່າງ ແນ່ນອນ ເມື່ອ ມີ ຢູ່; ຖ້າບໍ່ດັ່ງນັ້ນຈະໃຊ້ການຖອຍຫລັງແບບ jittered exponential ຈໍາກັດໃນມູນຄ່ານີ້.
protectPlaceholdersມາດຕະຖານ true. ເມື່ອເປີດ, token ເຊັ່ນ {{name}}, ${var}, {0}, {0:N2}, %s, %1$s ແລະ HTML ຈະຖືກປ່ຽນແທນດ້ວຍ sentinel token ກ່ອນການແປ ແລະ ຟື້ນຟູຫຼັງຈາກນັ້ນ. ປິດສະເພາະເມື່ອແຫຼ່ງຂໍ້ມູນມີຕົວອັກສອນທີ່ເປັນຮູບຮ່າງຂອງບ່ອນເທົ່ານັ້ນ.
customPlaceholderPatternsແບບແຜນ regex ເພີ່ມເຕີມ (ບໍ່ມີຕົວຈໍາກັດ) ເພີ່ມເຕີມໃສ່ໃນຊຸດ placeholder ມາດຕະຖານ, ຍົກຕົວຢ່າງ <<.+?>> ສໍາລັບ custom token syntax. regex ທີ່ບໍ່ຖືກຕ້ອງຈະບໍ່ເອົາໃຈໃສ່.
noTranslatePatternsແບບແຜນ Glob ທີ່ສອດຄ່ອງກັບກະແຈລະດັບ parser (JSON dotted path, RESX name, PO msgid, XLIFF unit id, INI/restext key). ກະແຈທີ່ສອດຄ່ອງກັນຈະຖືກຖອນອອກຈາກຄໍາຮ້ອງຂໍແລະສົ່ງຜ່ານພ້ອມກັບຄ່າແຫຼ່ງຂອງມັນທີ່ເກັບຮັກສາໄວ້.
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 ບໍ່ມີ knob ສຽງດຽວ. ການຕັ້ງຄ່າສອງຢ່າງລວມກັນເພື່ອໃຫ້ເຈົ້າມີການຄວບຄຸມແບບດຽວກັນ:
- ອຸດສາຫະກໍາ / ຂອບເຂດ: ໃຊ້
categoryIdເພື່ອ ຊີ້ ໄປ ຫາ Azure Custom Translator ປະເພດ ທີ່ ໄດ້ ຮັບ ການ ຝຶກ ຝົນ ໃນ ກຸ່ມ ຂອງ ທ່ານ ເອງ - ກົດຫມາຍ, ເຕັກນິກ, ການ ແພດ, ການ ຄ້າ ຫລື ສິ່ງ ອື່ນໆ. ນີ້ ເປັນ ສິ່ງ ທີ່ ເຂັ້ມ ແຂງ ທີ່ ສຸດ ສໍາລັບ ນ້ໍາສຽງ, ສຽງ ຂອງ brand ແລະ ຄໍາ ສັບ. - ຂໍ້ຄວາມຜິວຫນ້າ: ໃຊ້ ຄໍາສັບ ເພື່ອ ລ໊ອກ ຊື່ brand ແລະ ຄໍາ ສັບ ຂອງ ຜະລິດຕະພັນ ຕາມ ຄໍາ ເວົ້າ, ແລະ ໃຊ້
profanityActionເພື່ອ ລຶບລ້າງ ຄໍາ ຫມິ່ນປະຫມາດ ເມື່ອ ເປົ້າ ຫມາຍ localization ສໍາລັບ ຜູ້ ຄົນ ທີ່ ຫນຸ່ມ ກວ່າ.