Align Arabic script - language style doesn't seem to work

URL of experiment:
Code on gitlab: Laura de Ruiter / ratingexparabic · GitLab

Description of the problem:
I’m trying to align text on the right for the above experiment, since it’s in Arabic. I have set the “Language style” under “Advanced” to Arabic. In addition, when that didn’t work, I have included a code chunk with “text.alignHoriz = ‘right’”.

However, it doesn’t work, the alignment in the “welcome” routine seems to be to the right but somewhat in the middle, and in the “trial” routine, the scales are somewhat to the right, but staggered, instead of being aligned fully to the right.

There are no superfluous spaces in the spreadsheets that contain the text (I checked). The text is also right-aligned in the spreadsheets (not sure this matters, but I checked). It doesn’t work when you change the language style to “RTL”, either.

Any pointers to what I may be doing wrong would be highly appreciated - thank you!!


Hi @LDR, thanks for flagging, sorry, this is a PsychoJS bug I’m in the process of patching and should be able to provide a temporary workaround for very soon I hope, thanks, s.

1 Like

Awesome, thank you!

Hi @sotiri, have you had a chance to find a temporary work-around I could use?

Hi @LDR, has it been a couple of weeks already? :fearful: OK at the moment your best bet would be to manually specify the alignHoriz property for any text components in the Begin Experiment tab, but making sure they also share the same horizontal position if they happen to be on the same page, like Question and scale_1 in trial for example. I have created a support fork to that end, but font sizes might need adjusting as well. Here to help and again apologies for the late reply :blush:

1 Like

Thank you so much!!

It’s embarrassing, but even though I’ve had an account for a while, I’m still very much of a beginning user of git… :grimacing: How do I test/access the support fork and/or merge it with the branch I have?

My apologies for my ignorance!

Hi @LDR, no problem, sorry, my fault, I forgot to give you access! Instead of git merging, I believe in this case you can just copy from the .psyexp (attached below) as all my edits are Builder based, but please let me know if you hit any hurdles, x

200411_Rating.psyexp (41.9 KB)

Hi @sotiri, thank you for attaching the experiment - that made it much easier for me!
I have copied your code, but for some reason, it doesn’t seem to affect the positioning. As you can see, the alignment of the answer choices is still kind of “staggered”. And in the ‘welcome’ routine, the text seems to be aligned still to the middle of the screen (but on the right hand side), if that makes sense.

Did it look differently when you ran your version? Is my experiment not updating properly? I have cleared my cache and checked on the code page that the last push went through, but I’m wondering if there is anything else I might be overlooking here.

Hi @LDR, no problem, OK, yes, I can tell there are bits missing by comparing support fork JS output with the original. I wonder if re-exporting to HTML from the updated .psyexp makes a difference in this case. There’s a Builder command for that available through the File menu (Cmd + E on the Mac), x

I’m trying to run an experiment using textbox with Arabic language which follows right to left language style. I still got the Arabic letters written from left to right even when I changed the style to Arabic and RTL style. Do you know any codes that can solve the problem?

Thank you