Hebrew in Anvil

I’m trying to create a website in hebrew on Anvil.
I can write in hebrew but the text isn’t aligned correctly (in hebrew the writing is from right to left).
If I press “Align Right” the writing is aligned in the correct direction but question marks will be placed on the right of the text and not in the correct location in the sentence

Any way there is an option to do this?

Jeff

Maybe try doing it with the localizations module?

I’m having trouble understanding how this could be happening, since you should have control over where a question mark appears in any given string. Can you be more specific about where this is showing up?

Well whenever I insert hebrew I am “Aligned left”.
Even if I press “align right”, the question marks / exclamation marks won’t align correctly

In the attached print screen the question mark should be at the end of the sentence. i,e on the left hand size.

This is a known issue, the work around I have thought of is to put the question mark at the beginning of the sentence, this way it will be mistakenly pushed to the end of the sentence, solving the problem

Ok, maybe I see now. Are you talking about where you input the text in the right sidebar under “Properties”? The lower right highlight in your screen shot?

Would it solve your issue if the text in that text box were aligned right when you change the align setting of self.feedbackbox to right?

Or is the issue less about alignment and more about the direction in which characters are displayed?

If you are intending this question to be put to the user, you also might want to put it elsewhere in your UI, but I guess that’s a separate issue.

The issue is both the alignment (which is solved once I align right) and the direction.
Since hebrew is right-to-left but the question mark is identified as left-to-right it is located on the wrong side of the sentence,

This is a known issue for hebrew writers on nearly every platform

And yes, these questions are intended for the user. I would love to hear where you propose I locate them

2 Likes

I was thinking you could put the question in a Label component above the TextArea component. That would let you align/format it separately from the input area for the user. If you have multiple feedback questions, you could add another Label below that TextArea and then add another TextArea below it, and so on. (You could also use a RepeatingPanel to generalize this for an arbitrary number of questions, but that may be overkill if you only have a few set questions.)

This question made my brain melt last month, I could not figure out what the OP was asking for.*

I still am not sure, do you want to type and for it to show up what would be “reversed” if it was being written left-to-right?
I made an app with this logic in a text box change event, please let me know if this is anywhere close to what you mean?

Here’s a gif:
impliment_reversed_textbox

Here is the code:

def __init__(self, **properties):
  # Set Form properties and Data Bindings.
  self.init_components(**properties)
  self.text_box_1_oldtext = ""
def text_box_1_change(self, **event_args):
  if self.text_box_1_oldtext != self.text_box_1.text:
    if self.text_box_1_oldtext[:-1] != self.text_box_1.text:
      self.text_box_1.text = self.text_box_1.text[-1:] + self.text_box_1.text[:-1]
      self.text_box_1_oldtext = self.text_box_1.text
    else:
      #  Handle 'Backspace' key
      self.text_box_1.text = self.text_box_1_oldtext[1:]
      self.text_box_1_oldtext = self.text_box_1.text

*(To clarify, that is my problem not yours that I could not understand :crazy_face: :hammer:)

2 Likes

Thanks for your responses guys

If I place a question mark at the beginning of my hebrew sentence instead of at the end my problem is solved. It is a crocked way to fix the problem but it still works.

@ianb I don’t think that code will help me (I pasted it into a new form and pressed run but the textbox didn’t appear - what am I missing?)

I’ll try to clarify the issue: When writing in hebrew the words come out fine, the sentence is naturally aligned left but the letter order is ok.
When I align them right the entire sentence snaps to the right and all is good.
The problem appears when I add a question mark at the end of my sentence. Since the question mark is not a hebrew letter it is naturally aligned left and will appear on the left hand side of the sentence instead of the right (this also happens with exclamation marks, commas and full stops).

In most applications the align button fixes this
align buttons from microsoft word:
image

Since I only have a few questions I will just place the Q marks at the beginning of the sentence
Sorry I melted your brain @ianb

1 Like