baba

Hebrew RTL API: bidi display for mixed Hebrew and English

A price, a range, a model number or a date inside a Hebrew sentence is where right-to-left rendering breaks. baba HebrewCore returns lines that render correctly on the web, iOS, Android and embedded displays.

The short answer

baba HebrewCore, the Hebrew API from baba, is an RTL API for mixed Hebrew and English: POST /v1/wrap returns a render-ready display line (HTML, Unicode isolates or direction marks) in which every left-to-right unit such as 10–20%, Galaxy S25 or 31/12 stays whole and in order, and POST /v1/analyze returns the direction structure of a string or a whole record. Both run with no model and are not counted against the quota.

  • Deterministic: no language model, same input gives the same output.
  • Not counted against the monthly character quota on any plan.

Wrap a Mixed Line

A Hebrew sale line with a range, a product name and a date

curl https://hc.itsbaba.com/v1/wrap \
  -H "Authorization: Bearer hc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "text": "הנחה: 10–20% על Galaxy S25 עד 31/12", "format": "html", "base": "rtl" }'

Response

{
  "dir": "rtl",
  "format": "html",
  "output": "<span dir=\"rtl\">הנחה: <span dir=\"ltr\" lang=\"und\">10–20%</span> על <span dir=\"ltr\" lang=\"en\">Galaxy S25</span> עד <span dir=\"ltr\" lang=\"und\">31/12</span></span>",
  "runs": [ … ]
}

Analyze a whole record at once

curl https://hc.itsbaba.com/v1/analyze \
  -H "Authorization: Bearer hc_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "fields": { "title": "מסמך Q3 ready", "subtitle": "Read the summary" } }'

What Breaks in Mixed-Direction Text

A Hebrew line is laid out right to left, but prices, percentages, ranges, dates, product names and comparisons inside it are left to right. Left to the Unicode Bidirectional Algorithm alone, a range such as 10–20% can split around its dash and a sign such as <5 can mirror, so the reader sees a different number from the one you sent.

HebrewCore returns two run lists for every analysis. runs are exactly what the algorithm resolves, defects included. display_runs keep every left-to-right unit whole. Render display_runs yourself, or let /v1/wrap produce the markup.

Output Formats

  • html (default): a <span dir> for the line and one per unit, for the web, React and webviews.
  • isolate: Unicode isolates, for modern text engines (iOS, Android 7+, current browsers).
  • marks: LRM and RLM direction marks, which render on every engine, including older Android and embedded displays.

What /v1/analyze Returns

For each string or field: dir (the paragraph base direction), mixed (true when both strong RTL and strong LTR characters appear), lang, script, and runs with text, dir, script, lang, start and end as UTF-16 offsets. Pass fields to annotate up to 100 fields of a record in one call. Translations from /v1/translate carry the same metadata on both the source and the result.

About baba HebrewCore

baba HebrewCore is the Hebrew API from baba, the engine the baba Hebrew translator app runs on. The display endpoints pair with language detection for input and localization for string files. To check a stylesheet by hand, try the free RTL CSS checker.

Frequently Asked Questions

Is there an API for displaying mixed Hebrew and English text?

Yes. baba HebrewCore has POST /v1/wrap, which returns render-ready output for one display line as HTML spans, Unicode isolates or direction marks, and POST /v1/analyze, which returns the RTL and LTR structure of a string or a whole record. Both are deterministic, run with no language model, and are not counted against the character quota.

Why do numbers and ranges break inside Hebrew text?

The Unicode Bidirectional Algorithm resolves a Hebrew line with known defects: a range such as 10–20% can split around the dash, and a comparison such as <5 can mirror. HebrewCore returns display_runs that keep every left-to-right unit whole (a Latin term, a price, a number with its unit, a range, a date, a percentage, a comparison), and /v1/wrap renders them.

Which output format should I use?

html (the default) for the web, React and webviews; isolate (Unicode isolates) for modern text engines such as iOS, Android 7+ and current browsers; marks (LRM and RLM) for engines that need them, including older Android and embedded displays.

Does the RTL API cost anything?

Direction analysis, detection, wrap and strip nikud are not counted against the HebrewCore character quota on any plan. You need an account with an API key; the Free plan requires a card on file and is never charged.

What does base do?

base sets the paragraph direction of the surface: auto (the default, first strong letter, like CSS dir=auto), rtl or ltr. Pass rtl for a Hebrew line even when it starts with a Latin term; isolate and marks output then starts with a mark so a text view takes the right direction by itself.

Does Google Cloud Translation handle RTL display?

When HTML is translated between RTL and LTR languages, Google adds a style attribute with text-align and direction to the response, per its troubleshooting documentation as of September 2026. It does not document a separate display endpoint for mixed-direction lines.

Try baba HebrewCore free

Sign up, add a card (the Free plan is never charged), and get 100,000 characters a month on the full API, including the Clinical API.

Sign up free

Related Developer Guides