Takahi i te ara ki te tāuru configPath mēnā e hiahia ana koe ki tētahi tauwāhi taunoa-kore.
Aronuinga
# .github/resource-translator.ymlsourceLocale: entoLocales: - fr - de - esinclude: - "src/**/*.en.json" - "apps/**/*.en.resx"exclude: - "**/__tests__/**"glossary: Acme: Contoso Octocat: Octocat # keep brand names verbatim
# Domain / industry — uses an Azure Custom Translator category trained on# your tone and vocabulary. Leave unset for the general model.categoryId: my-custom-translator-category
# Translator request shape — most users can ignore these.textType: plain # plain | htmlprofanityAction: NoAction # NoAction | Marked | DeletedprofanityMarker: Asterisk # Asterisk | Tag (only when profanityAction == Marked)allowFallback: true # false fails when the categoryId has no deployment
apiVersion: "3.0"
# 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.*"Tohutoro āpure
| Āpure | Momo | Ngā Tuhipoka |
|---|---|---|
sourceLocale | string | Ka hoki whakamuri ki te tāuru sourceLocale ki te kore e tautuhia. Ka whakamua hoki ki te Kaiwhakamāori hei from=<locale> kia kore ai ngā aho poto e kiteanoatia. |
toLocales | string[] | He huānga, he aho whakawehe-piko rānei. |
include / exclude | string[] | Ngā tauira glob i arotakea ki ngā ara pūmau me ngā ara pātahi mokowāmahi. |
glossary | map<string,string> | Ngā takahitanga kupu i muri i te whakamāoritanga. E mōhio ana ki te rohenga-kupu (ka raweke i te C++, .NET). |
categoryId | string | Kāwai Custom Translator Azure — tō pona umanga/rohe (ā-ture, rongoā, oro mākete, aha atu). I tukua hei ?category=.... |
textType | "plain" | "html" | Taunoa ai ki te plain. Whakamahia html anake mēnā he kongakonga HTML tūturu kei ō uara rauemi. |
profanityAction | "NoAction" | "Marked" | "Deleted" | Me pēhea te whakamahi i ngā kupu whakarihariha i roto i te huaputa kua whakamāoritia. |
profanityMarker | "Asterisk" | "Tag" | Whai tikanga anake ina "Marked" profanityAction. |
allowFallback | boolean | Tautuhia ki te false kia rahua te whakawhitinga ina kore tō categoryId e tuku mō tētahi wāhi ūnga, kaua e hoki whakamuri ki te tauira ahuwhānui. |
apiVersion | string | Putanga REST API kaiwhakamāori. Taunoa ai ki te 3.0. |
maxRetries | integer | Ko te mōrahi o ngā nganatanga ngana anō i runga i ngā urupare HTTP rangitahi (408, 425, 429, 500, 502, 503, 504). Taunoa ai ki te 5. He 1 + maxRetries te tapeke o ngā waea HTTP mō ia tono. |
retryBackoffMs | integer | Pū (ms) i runga i tētahi moe whakamuri kotahi. Taunoa ai ki te 30000. Ka whakahonoretia te pane Retry-After o Azure i te wā i konei; ki te kore ka whakamahia te whakahoki taupua āmaimai, ka whakawhāititia ki tēnei uara. |
protectPlaceholders | boolean | Taunoa ai ki te true. Ina kā ana, ka whakakapia ngā maimai pēnei i te {{name}}, ${var}, {0}, {0:N2}, %s, %1$s me ngā mea HTML ki ngā maimai sentinel i mua i te whakamāoritanga, ā, ka whakaoratia i muri iho. Monokia anake mēnā kei roto i te pūtake ngā āhuatanga puriwāhi. |
customPlaceholderPatterns | string[] | Kua tāpirihia ētahi atu tauira regex (me te kore kaiwehe) ki te huinga puriwāhi taunoa, hei tauira, <<.+?>> mō te wetereo maimai ritenga. Ka waihotia ngā kōrero kōrero muhu. |
noTranslatePatterns | string[] | Ko ngā tauira glob e ōrite ana ki ngā kī taumata-parser (ara iraira JSON, RESX name, PO msgid, XLIFF unit id, kī INI/restext). Ka whakatakahia ngā kī ōrite mai i te tono, ā, ka puta atu me te uara pūtake e pupuritia ana. |
Uta ana i te raupapa
- Ka pānui te hohenga i ngā tāurunga mārama mai i te rerengamahi.
- Ka utaina te whirihoranga YAML mai i
configPath. - Mō ia āpure tiritiri, ka toa te tāuru; ki te kore ka whakamahia te uara YAML.
- Kua whakamanatia ngā uara hanumi. Mā ngā tau muhu (hei tauira,
profanityAction: Mask) ka rahua tere te hohenga me tētahi karere ūkui.
Oro me te mahi, i roto i ngā kupu māmā
Kāore he pona oro kotahi o te Azure AI Translator v3 API. E rua ngā tautuhinga e paheko ana hei hoatu i te nuinga o te mana ōrite:
- Ahumahi / rohe: whakamahia
categoryIdhei tohu i tētahi kāwai Azure Custom Translator kua whakaakona ki tō ake huinga — ā-ture, hangarau, rongoā, mākete, tētahi atu mea rānei. Koinei te kōwhiti tino kaha mō te oro, te reo parani, me te kupu. - Kuputuhi mata: Whakamahia te pukapuka kupu hei maukati i ngā ingoa parani me ngā kupu hua kuputuhi, me te whakamahi i te
profanityActionhei horoi i ngā kupu whakarihariha ina whakarite i te whakawāteatanga mō ngā kaimātakitaki tamariki.