HTML translation
Set format: "html" to translate HTML while preserving markup.
How it works​
- Langbly parses your HTML and translates text nodes only
- Structural attributes (
href,src,class,id,style,name,value,data-*) are preserved as-is - Content attributes that carry visible or accessible text (
alt,title,placeholder,aria-label) are translated script,style, andnoscriptcontents are skipped
Example​
curl -sS 'https://api.langbly.com/language/translate/v2' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: YOUR_API_KEY' \
-d '{
"q": "<p>Hello <strong>world</strong>.</p>",
"target": "nl",
"format": "html"
}'
Frequently asked questions​
Why are alt and title attributes being translated after I read that attributes stay unchanged?​
Only structural attributes like href, src, class, id, style, name, value, and data-* remain untouched. Content attributes that users or screen readers see, alt, title, placeholder, and aria-label, are translated to the target language since they carry visible text.
Does the API translate placeholders like {{name}} or %s inside otherwise translatable text?​
No. Protected zones such as {{name}}, %s, %d, full URLs, email addresses, and @handles are never translated, even when they appear inside a text node that is otherwise processed.
What happens if my input HTML is malformed? Will the API reject the request?​
The parser handles invalid or incomplete HTML as best it can. There is no strict validation check that rejects a request for bad markup. The translation runs on whatever structure can be parsed.
Can I send HTML that contains <script>, <style>, or <noscript> blocks?​
Those tags and everything inside them are automatically skipped and never translated. Only visible text nodes and content attributes in other elements are processed.