Fetongi ʻa e hala ʻaki ʻa e input configPath kapau ʻoku ke fie maʻu ha feituʻu ʻoku ʻikai seti ki ai.
Fokotuʻutuʻu
# .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.*"Maʻuʻanga fakamatala ki he malaʻe
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ʻOku foki ki he input sourceLocale kapau ʻoku ʻikai seti ia. ʻOku toe ʻave foki ki he Translator ko e from=<locale> koeʻuhi ke ʻoua naʻa ʻautodetect ʻa e ngaahi afo nounou.
toLocalesKo ha fokotuʻutuʻu pe ko ha afo ʻoku fakamavahevaheʻi ʻe he koma.
include / excludeNgaahi sipinga ʻo e Glob ʻoku fakafuofuaʻi ki he ngaahi hala ʻoku fekauʻaki mo e feituʻu ngaue.
glossaryFetongi ʻo e foʻi lea hili ʻa e liliu. ʻOku ʻiloʻi ʻa e fakangatangata ʻo e foʻi lea (tokangaʻi ʻa e C++, .NET).
categoryIdAzure Custom Translator kulupu — hoʻo ngaueʻanga/domain knob (fakalao, fakafaitoʻo, fakamaketi, etc.). ʻAve ko e ?category=....
textTypeʻOku default ki he plain. Fakaʻaongaʻi pe ʻhtml kapau ʻoku ʻi ai ha ngaahi kongokonga HTML moʻoni ʻi hoʻo ngaahi maʻuʻanga tokoni.
profanityActionHow to treat profane words in translated output.
profanityMarkerʻOku toki mahuʻingamalie pe ʻi he taimi ʻoku profanityAction ai ʻa e "Marked".
allowFallbackSeti ke false ke ʻikai lava ʻa e liliu ʻi he taimi ʻoku ʻikai ke ʻi ai ha deployment ʻi hoʻo categoryId ki ha feituʻu ʻoku fakataumuʻa ki ai kae ʻikai foki ki he sipinga fakalukufua.
apiVersionLiliu lea REST API version. ʻOku default ki he 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.
maxRetriesLahi taha ʻo e ngaahi feinga ke toe feinga ʻi he ngaahi tali HTTP fakataimi (408, 425, 429, 500, 502, 503, 504). Default ki he 5. Ko e fakakatoa ʻo e ngaahi telefoni HTTP ki he kole ʻoku 1 + maxRetries.
retryBackoffMsTataʻo (ms) ʻi ha faʻahinga mohe pe ʻe taha. ʻOku default ki he 30000. ʻOku fakaʻapaʻapaʻi ʻa e ʻuluʻi tohi ʻo e Retry-After ʻa Azure ʻi he taimi ʻoku ʻi ai ai; ka ʻikai, ʻoku fakaʻaongaʻi ʻa e jittered exponential backoff, fakangatangata ʻi he tuʻunga mahuʻinga ko ʻeni.
protectPlaceholdersʻOku default ki he true. ʻI he taimi ʻoku moʻui ai, ʻoku fetongi ʻa e ngaahi fakaʻilonga hange ko e {{name}}, ${var}, {0}, {0:N2}, %s, %1$s mo e HTML ʻaki ʻa e ngaahi fakaʻilonga sentinel kimuʻa pea toki liliu pea toe fakafoki mai ʻi he hili ia. Tamateʻi pe ʻi he taimi ʻoku ʻi ai ha ngaahi meʻa ʻoku ʻi ai ha placeholder.
customPlaceholderPatternsʻOku tanaki atu ʻa e ngaahi sipinga ʻo e regex (taʻe ʻi ai ha delimiters) ki he seti placeholder default, e.g. <<.+?>> ki he syntax ʻo e fakaʻilonga angamaheni. ʻOku tukunoaʻi ʻa e ngaahi regex ʻoku ʻikai hala.
noTranslatePatternsʻOku fakatauhoa ʻa e ngaahi sipinga ʻo e glob mo e ngaahi ki ʻi he tuʻunga ʻo e parser (JSON dotted path, RESX name, PO msgid, XLIFF unit id, INI/restext key). ʻOku toʻo ʻa e ngaahi ki ʻoku hoa mei he kole pea ʻave ia ʻo fakatolonga pe honau mahuʻinga ʻi he maʻuʻanga tokoni.
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.
Uta ʻo e ʻota
- ʻOku lau ʻe he ngaue ʻa e ngaahi fakamatala mahino mei he founga ngaue.
- ʻOku ne load ʻa e config ʻo e YAML mei he
configPath. - ʻOku ikuna ʻa e input ki he konga kotoa pe ʻoku nau fevahevaheʻaki; ka ʻikai, ʻoku fakaʻaongaʻi ʻa e tuʻunga ʻulungaanga mahuʻinga ʻo e YAML.
- ʻOku fakapapauʻi ʻa e ngaahi tuʻunga ʻulungaanga mahuʻinga kuo fakatahaʻi. ʻOku fakatupu ʻe he ngaahi ʻenum taʻeʻaonga (e.g.
profanityAction: Mask) ke ʻikai ola lelei ʻa e ngaue ʻaki ha popoaki mahino.
Ko e ongo mo e faʻa ngaue, ʻi he ngaahi lea mahinongofua
ʻOku ʻikai ke ʻi ai ha foʻi knob ʻe taha ʻo e Azure AI Translator v3 API. ʻOku fakatahaʻi ha ongo fokotuʻutuʻu ʻe ua ke mapuleʻi ʻa e konga lahi ʻo e puleʻi tatau:
- Ngaueʻanga / domain: fakaʻaongaʻi
categoryIdke tuhu ki ha faʻahinga Azure Custom Translator kuo akoʻi ʻi hoʻo corpus pe ʻaʻau — fakalao, fakatekinikale, fakafaitoʻo, fakamaketi, pe ha toe meʻa kehe. Ko e meʻa malohi taha ʻeni ki he ongo, leʻo ʻo e faʻahinga mo e foʻi lea. - Fakamatala ʻi ʻolunga: Fakaʻaongaʻi ʻa e Glossary ke lokaʻi ʻaki ʻa e ngaahi hingoa ʻo e kautaha mo e ngaahi foʻi lea ʻo e koloa, pea fakaʻaongaʻi ʻa e
profanityActionke fakamaʻa ʻaki ʻa e ngaahi foʻi lea taʻefeʻunga ʻi he taimi ʻoku fakataumuʻa ai ʻa e feituʻu ki he kakai kei siʻi ange.