Gwrthwneud y llwybr gyda'r mewnbwn configPath os oes angen lleoliad rhagosodedig arnoch.
Sgema
# .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.*"Cyfeirnod maes
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.
sourceLocaleDisgyn yn ôl i'r mewnbwn sourceLocale os na osodwyd. Hefyd yn cael ei anfon ymlaen at Cyfieithydd fel from=<locale> felly nid yw llinynnau byr yn cael eu canfod yn awtomatig.
toLocalesNaill ai arae neu linyn wedi'i wahanu gan goma.
include / excludePatrymau Glob wedi'u gwerthuso yn erbyn llwybrau absoliwt a gweithle-berthynol.
glossaryTymor ôl-gyfieithu yn diystyru. Ymwybodol o ffiniau geiriau (yn ymylu C++, .NET).
categoryIdCategori Azure Custom Translator - eich knob diwydiant / parth (cyfreithiol, meddygol, tôn marchnata, ac ati). Anfonwyd fel ?category=....
textTypeGosod plain yn y rhagosodiad. Defnyddiwch html dim ond os yw eich gwerthoedd adnoddau yn cynnwys darnau HTML go iawn.
profanityActionSut i drin termau profane mewn allbwn cyfieithu.
profanityMarkerDim ond ystyrlon pan fydd profanityAction yn "Marked".
allowFallbackGosod i false i fethu'r cyfieithiad pan nad oes gan eich categoryId ddefnydd ar gyfer locale targed yn hytrach na syrthio yn ôl i'r model cyffredinol.
apiVersionFersiwn API REST y cyfieithydd. Gosod 3.0 yn y rhagosodiad.
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.
maxRetriesUchafswm o ymdrechion ail-geisio ar ymatebion HTTP dros dro (408, 425, 429, 500, 502, 503, 504). Gosod y rhagosodiad 5. Cyfanswm y galwadau HTTP fesul cais yw 1 + maxRetries.
retryBackoffMsCap (ms) ar unrhyw gwsg cefn sengl. Gosod 30000 yn y rhagosodiad. Mae pennawd Retry-After Azure yn cael ei anrhydeddu'n union pan fo'n bresennol; fel arall defnyddir backoff esbonyddol jittered, wedi'i gapio ar y gwerth hwn.
protectPlaceholdersGosod true yn y rhagosodiad. Pan fyddant ymlaen, mae tocynnau fel {{name}}, ${var}, {0}, {0:N2}, %s, %1$s ac endidau HTML yn cael eu disodli gan docynnau sentinel cyn eu cyfieithu a'u hadfer ar ôl hynny. Analluogi dim ond pan fo'r ffynhonnell yn fwriadol yn cynnwys llythrennau siâp deiliad lle.
customPlaceholderPatternsPatrymau regex ychwanegol (heb amffinwyr) wedi'u hychwanegu at y set deiliad lle diofyn, e.e. <<.+?>> ar gyfer cystrawen tocyn arferol. Mae exexau rheolaidd annilys yn cael eu hanwybyddu.
noTranslatePatternsPatrymau Glob yn cyfateb yn erbyn allweddi lefel gramadegydd (llwybr dotiog JSON, RESX name, PO msgid, id uned XLIFF, allwedd INI/restext). Mae allweddi cyfatebol yn cael eu gollwng o'r cais ac yn pasio drwodd gyda'u gwerth ffynhonnell wedi'i gadw.
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.
Trefn llwytho
- Mae'r weithred yn darllen mewnbynnau penodol o'r llif gwaith.
- Mae'n llwytho'r ffurfweddiad YAML o
configPath. - Ar gyfer pob maes a rennir, mae'r mewnbwn yn ennill; fel arall, defnyddir y gwerth YAML.
- Mae'r gwerthoedd cyfunedig yn cael eu dilysu. Mae efesuriadau annilys (e.e.
profanityAction: Mask) yn achosi i'r weithred fethu'n gyflym gyda neges glir.
Tôn a diwydiant, mewn termau plaen
Nid oes gan API Azure AI Translator v3 knob un tôn. Mae dau osodiad yn cyfuno i roi'r rhan fwyaf o'r un rheolaeth i chi:
- Diwydiant / parth: defnyddiwch
categoryIdi bwyntio at gategori Azure Custom Translator wedi'i hyfforddi ar eich corpws eich hun - cyfreithiol, technegol, meddygol, marchnata, neu unrhyw beth arall. Dyma'r lifer cryfaf ar gyfer tôn, llais brand, a geirfa. - Testun arwyneb: Defnyddiwch y Geirfa i gloi enwau brand a thelerau cynnyrch ar lafar, a defnyddiwch
profanityActioni sgwrio termau profane wrth dargedu lleoleiddio ar gyfer cynulleidfaoedd iau.