How to align Arabic text data from right to left for annotation?

Hey there,

I am trying to use Labelbox to annotate my Arabic sentence pairs based on a predefined criteria. I added the data rows, and I could read the data just fine, aligned from right to left, just how it is supposed to be. But when I added the data row to my annotation project, the alignment becomes from left to right, ana the text is no longer readable to annotators as it should be. Is there a way to solve this?

Thanks

something like this I assume (I took this as sample so not sure what the text means)

  • Also are you using txt file or conversational type?

Thank you for your reply!

I am using text data (โ€œmedia_typeโ€: โ€œTEXTโ€).
In your screenshot, the Arabic text looks aligned correctly from right to left. Did you do anything specific to make that happen, or was it like this by default?

In my case (see screenshot), Arabic is being aligned left to right, so itโ€™s not readable. To make it clearer, hereโ€™s a simple example with English:

Correct alignment: How are you?

Incorrect alignment: ?uoy era woH

This is whatโ€™s happening with Arabic on my side.

Iโ€™m still new to LabelBox, so Iโ€™d really appreciate it if you could walk me through how you got this working, or point me to what I might be missing.

Thanks again for your help!

1 Like

Hello, I am still stuck on the same issue. Iโ€™d appreciate any support on this!

I am still checking, one of the solution I had is not working all the time - for ref

# Add Right-to-Left Mark (U+200F)
rtl_text = "\u200F ุชูŽุชูŽุญูŽุฏูŽู‘ุซ ุงูŽู„ู’ุฃูŽุจู’ูŠูŽุงุช ุนูŽู†ู’ ู„ูŽุญู’ุธูŽุฉ ูˆูŽุฏูŽุงุน ูŠูŽุณู’ุชูŽุบู’ุฑูุจ ูููŠู‡ูŽุง ุงูŽู„ุดูŽู‘ุงุนูุฑ ุฃูŽู†ู’ ู„ูŽุง ูŠูŽุจู’ูƒููŠ ู…ูู†ู’ ุฃูŽู„ูŽู… ุงูŽู„ู’ููุฑูŽุงู‚ุŒ ูˆูŽูŠูŽุตูู ุญูŽุงู„ูŽุฉ ุงูŽู„ู’ู…ููˆุฏูุนููŠู†ูŽ ูˆูŽุจูŽุนู’ุถู‡ู…ู’ ูŠูŽุชูŽูƒูŽู„ูŽู‘ู… ูููŠ ุญููŠู† ูŠูŽูƒู’ุชูŽูููŠ ุงูŽู„ู’ู…ูุญูุจูู‘ูˆู†ูŽ ุจูุงู„ุตูŽู‘ู…ู’ุชูุŒ ู„ูุฃูŽู†ูŽู‘ ุญูŽุงู„ู‡ู…ู’ ุชูŽุธู’ู‡ูŽุฑ ุนูุดู’ู‚ู‡ู…ู’ ุฃูŽูƒู’ุซูŽุฑ ู…ูู…ูŽู‘ุง ูŠูŽุณู’ุชูŽุทููŠุนููˆู†ูŽ ุงูŽู„ุชูŽู‘ุนู’ุจููŠุฑ ุนูŽู†ู’ู‡ู ุจูุงู„ู’ูƒูŽู„ูŽุงู…ู. ูˆูŽูŠูู‚ูŽุณูู‘ู… ูููŠ ุขุฎูŽุฑ ุงูŽู„ู’ุฃูŽุจู’ูŠูŽุงุช ุนูŽู„ูŽู‰ ุฃูŽู†ูŽู‘ ุชูŽูˆูŽู‚ูู‘ู ุฏูŽู…ู’ุนู‡ ู„ูŽุง ูŠูŽุนู’ู†ููŠ ู†ูู‡ูŽุงูŠูŽุฉ ุญูŽูŠู‘ู‡.\u200F"

with open("sample.txt", "w", encoding="utf-8") as f:
    f.write(rtl_text)

Thatโ€™s right, I tried this but it is not working. I appreciate your time looking into this!

Took me longer, we donโ€™t have a build it solution but using Stylus could help - Using Stylus will allow you to overwrite the style within the HTML style element.

pre.sc-dfzyxB.fXSLCG.notranslate {
  direction: rtl !important;
}

It will most likely be another class name in your case, open the dev tools (F12) in your browser, select the text to search for the right class in your editor
We render this in an Iframe so this will also work for the data rows tab also.

Hope this helps!