Components
This is a configuration section of Custom MT. Components are declared as objects within the configuration:
{
"components": {
"preTranslation": {},
"postTranslation": {},
"contextMemory": {},
"usageChecker": {},
"interceptorRequest": {}
}
}preTranslation
Processes the source text before sending it to the translation service.
allowLineBreaks:
booleanexcludeStrings:
stringregexpMatch:
stringregexpReplace:
string
{
"components": {
"preTranslation":{
"allowLineBreaks": true,
"regexpReplace": "[\"\\n\", \"g\", \"\\\\n \"]"
}
}
}postTranslation
Processes the translated text after receiving it from the translation service.
regexpMatch:
stringregexpReplace:
string
contextMemory
Maintains context history for AI/LLM translations, allowing the model to reference previous dialogue for improved coherence and accuracy.
Required Parameters
schema:
Array of objects<{type: string, name: string, default: string|number|bool}>formBuilder:
Array of objects<{type: string, form: string, name: string, default: string|number}>components:
object- Component reference to schema name <schema:string>
usageChecker
interval:
number- Interval in milliseconds between usage checksformat:
string- Display format for usage informationrequest:
object- Request configuration for checking usage:method:
string- HTTP method ("http_get","http_post")url:
string- API endpoint URL for usage informationbody:
object(optional) - Request body for POST requestsoptions:
object(optional) - Additional request options:headers:
object- Custom request headers
responseCountQuery:
string- JSON path to extract current usage countresponseLimitQuery:
string- JSON path to extract usage limit
interceptorRequest
Modifies the source text before sending it to the translation service.
prependSourceText:
object- Adds text before the source text:status:
boolean- Enable or disable prependingvalue:
string- Text to prepend
appendSourceText:
object- Adds text after the source text:status:
boolean- Enable or disable appendingvalue:
string- Text to append
replaceSourceText:
object- Replaces the entire source text