Input from user as Text in Hebrew

I’m trying to get input from the user in Hebrew language.
the routine I wrote works perfectly in English.
Is there any suggestions?

I tried all kind of manipulations but all of them failed.

thanks, Yarden!

Interesting, it seems the PsychoPy keyboard object always reads in the key as if it were an English keyboard. You may just need to manually create a dict that maps each key in english to its corresponding Hebrew letter and use it to translate on the fly.

so I created a dictionary and I succeed to able the subject to enter text in Hebrew during the experiment. the problem now is that in Hebrew we write from right to left and ‘psychopy’ is not synchronized right when it’s suppose to go down a line.
adding an image of the manually translation I made:

The TextBox2 and TextStim stimulus type both have a property, “languageStyle”, which is for swapping between left-to-right (LTR) and right-to-left (RTL) languages (and has a special category for languages that connect their letters like Arabic). In the builder you can find it in the TextStim’s properties under the “Formatting” tab.

Hi! thanks for replying.
I tried them both (“arabic style” and “RTL style”) but it still not slide to a new row in the right way.
the first word from right to left is sliding down (and then the seconed and so on) instead of the last word from right to left.
I wrote a code that helps to slide down in the right way for Hebrew language and it works fine, but is complicated and im not sure it’s the smoothest way to manage this problem. I will appreiaciate it if you have another suggestion. anyway, I’m adding a photos of the code that able to slide to a new row correctly:

Begin Experiment:

Begin Routine:

Each frame:
the “manually dictionary”:

Sliding down:

It sounds like the text-wrapping system is starting from the right even when the language direction is RTL.

@jon is this a known issue?

Could you share a minimal example of this problem? Without knowing any Hebrew myself it’s difficult to recreate - I can try to figure it out by just comparing with what Notepad does but it would help a lot to have a bit of text in a psyexp file which definitely wraps wrong alongside a screenshot of how it should look.

The Textbox layout code uses a package called bidi to reorder the letters such that they can be arranged as if LTR and will still be in the correct order - i.e. the first character appears last, so it is at the end of the line rather than the beginning. It may be the case that we need to supply the linebreaks at auto-wrap points BEFORE feeding into bidi so that it can arrange each line correctly rather than having it arrange as one long line and then figuring out linebreaks ourself.

Do you find the same problem when starting a new line using the ENTER key, or is this specific to wrapping to a new line when the line length exceeds the length of the textbox?

Also if you’d like to look at the code Textbox uses behind the scenes you can do so via GitHub:

If you can see an alternative way of doing this which would work for Hebrew please feel free to submit a pull request, we’re always open to contributions and getting insight from someone who can read Hebrew is super helpful for this sort of thing!