Skip to main content

Get Translation Suggestion

Used to get AI-powered translation suggestions for UI elements. This API analyzes the context of an element and provides appropriate translations based on its type, application context, and detailed usage information.

API Endpoint

PropertyValue
Request MethodPOST
Request URLhttps://api.seliseblocks.com/uilm/v1/Assistant/GetTranslationSuggestion

Request

Request Example

curl -X POST 'https://api.seliseblocks.com/uilm/v1/Assistant/GetTranslationSuggestion' \
-H 'accept: */*' \
-H 'Content-Type: application/json' \
-H 'x-blocks-key: YOUR_PROJECT_KEY' \
-d '{
"elementType": "button",
"elementApplicationContext": "login_form",
"elementDetailContext": "Primary action button for submitting login credentials",
"temperature": 0.7,
"maxCharacterLength": 50,
"sourceText": "Log In",
"destinationLanguage": "de-DE",
"currentLanguage": "en-US"
}'

Request Headers

FieldTypeRequiredDescription
acceptstringYesAccepted response format. Use */*
Content-TypestringYesRequest body format. Must be application/json
x-blocks-keystringYesYour project authentication key

Request Body

Request Body Schema

{
"elementType": "string",
"elementApplicationContext": "string",
"elementDetailContext": "string",
"temperature": 0,
"maxCharacterLength": 0,
"sourceText": "string",
"destinationLanguage": "string",
"currentLanguage": "string"
}

Request Body Parameters

FieldTypeRequiredDescription
elementTypestringYesType of UI element (e.g., button, label, heading, placeholder, tooltip, error_message)
elementApplicationContextstringYesApplication context (e.g., login_form, dashboard, user_profile)
elementDetailContextstringYesDetailed description of element purpose and usage
temperaturenumberNoCreativity control (0.0-1.0). Default: 0.7
maxCharacterLengthintegerNoMaximum character length for translation output
sourceTextstringYesText to be translated
destinationLanguagestringYesTarget language code (e.g., de-DE, fr-FR, es-ES)
currentLanguagestringYesSource language code (e.g., en-US, en-GB)

Response

Success Response (200 OK)

{
"suggestions": [
{
"translation": "Anmelden",
"confidence": 0.95,
"characterCount": 8,
"explanation": "Standard translation for login button in German.",
"alternativePhrasings": ["Einloggen", "Login"]
}
],
"contextAnalysis": {
"elementType": "button",
"applicationContext": "login_form",
"recommendedStyle": "concise_action_oriented",
"culturalNotes": "German translations tend to be more formal than English."
}
}

Error Codes

Status CodeDescriptionResponse Type
400Invalid request parameters or missing required fieldsBad Request
401Missing or invalid project keyUnauthorized