Ampidiro ny lalana amin'ny alàlan'ny fampidirana configPath raha mila toerana tsy misy default ianao.
Drafitra
# .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.*"Referansa an-tsaha
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.
sourceLocaleMiverina amin'ny fampidirana sourceLocale raha tsy apetraka. Nalefa tany amin'ny mpandika teny ihany koa from=<locale> ka tsy hita ho azy ny kofehy fohy.
toLocalesNa array na kofehy misaraka amin'ny koma.
include / excludeGlob lamina tombana amin'ny tanteraka sy ny toeram-piasana-havana lalana.
glossaryNy teny aorian'ny fandikan-teny. Teny sisin-tany (mitantana C++, .NET).
categoryIdSokajy Azure Custom Translator - ny bokotra indostria / sehatra (ara-dalàna, ara-pitsaboana, feo ara-barotra, sns.). Nalefa toy ny ?category=....
textTypeDefault ho an'ny plain. Ampiasao html raha toa ka misy sombintsombiny HTML tena izy ny soatoavinao loharanon-karena.
profanityActionAhoana ny fomba hitondrana ny teny ratsy amin'ny fandikan-teny.
profanityMarkerTsy misy dikany afa-tsy rehefa "Marked" profanityAction.
allowFallbackAtaovy false tsy hahomby amin'ny fandikan-teny rehefa tsy manana fametrahana ho an'ny toerana kendrena ny categoryId fa tsy miverina amin'ny modely ankapobeny.
apiVersionTranslator REST API version. Default ho an'ny 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.
maxRetriesNy fanandramana fanandramana ambony indrindra amin'ny valiny HTTP mandalo (408, 425, 429, 500, 502, 503, 504). Default ho an'ny 5. Ny fitambaran'ny antso HTTP isaky ny fangatahana dia 1 + maxRetries.
retryBackoffMsCap (ms) amin'ny torimaso tokana. Default ho an'ny 30000. Ny lohan'ny Retry-After Azure dia omem-boninahitra amin'ny fotoana tena misy; raha tsy izany dia ampiasaina ny backoff exponential jittered, voafetra amin'io sanda io.
protectPlaceholdersDefault ho an'ny true. Rehefa mandeha ny famantarana toy ny {{name}}, ${var}, {0}, {0:N2}, %s, %1$s ary HTML dia soloina amin'ny famantarana sentinel alohan'ny fandikana ary averina amin'ny laoniny aorian'izay. Esory raha tsy misy loharano minia ahitana ara-bakiteny miendrika placeholder.
customPlaceholderPatternsNy lamina regex fanampiny (tsy misy delimiters) dia nampidirina tao amin'ny seta placeholder default, ohatra <<.+?>> ho an'ny syntax custom token. Tsy noraharahiana ny regex tsy manan-kery.
noTranslatePatternsNy lamina glob dia mifanaraka amin'ny fanalahidy parser (JSON dotted path, RESX name, PO msgid, XLIFF unit id, INI / restext key). Ny fanalahidy mifanandrify dia alatsaka avy amin'ny fangatahana ary mandalo miaraka amin'ny sandan'ny loharano voatahiry.
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.
Fandefasana baiko
- Ny hetsika dia mamaky ny fampidirana mazava avy amin'ny workflow.
- Izy io dia mampiditra ny config YAML avy amin'ny
configPath. - Ho an'ny saha iraisana rehetra, mandresy ny fampidirana; raha tsy izany dia ampiasaina ny sandan'ny YAML.
- Voamarina ireo soatoavina natambatra. Ny enum tsy manan-kery (ohatra
profanityAction: Mask) dia mahatonga ny hetsika tsy hahomby haingana amin'ny hafatra mazava.
Ny feo sy ny indostria, amin'ny teny tsotra
Ny Azure AI Translator v3 API dia tsy manana bokotra feo tokana. Ny toe-javatra roa dia mitambatra mba hanomezana anao ny ankamaroan'ny fanaraha-maso mitovy:
- Indostria / sehatra: ampiasao
categoryIdmba hanondro sokajy Azure Custom Translator voaofana amin'ny corpus anao manokana - ara-dalàna, ara-teknika, ara-pitsaboana, marketing, na zavatra hafa. Io no lever matanjaka indrindra ho an'ny feo, ny feon'ny marika ary ny voambolana. - Lahatsoratra ambony: Ampiasao ny Rakibolana mba hanidy ny anaran'ny marika sy ny teny momba ny vokatra am-bava, ary ampiasao
profanityActionmba hanadiovana ireo teny ratsy rehefa mikendry ny toerana ho an'ny mpihaino tanora.