I'm trying to translate my android app from English to Hebrew by adding a strings.xml
file to values directory and translating all English strings.
My problem is that adding a line break (\n
) to the Hebrew string as i do with my English strings.xml
strings doesn't work. An example to an English string with a line break:
<string name="no_group_instructions">You don\'t have a group yet!\n\nPlease choose whether to create a new group, or to join an existing one...</string>
How can i add line breaks to my non-English strings?
EDIT
I eventually did manage to do the line break in the Hebrew string using \n. I guess that the right-to-left writing, which is not supported well enough in Android Studio, caused the problem in the first place. I solved it by copying the string with the \n's from notepad straight to the strings.xml file, and not wrote it directly in the Android Studio.
I had the same problem. To solve it, just copy-paste "\n" into your string as I did:
<string name="ta_tv_button_text">?היוםn\אכלתn\מה</string>
Make sure you support RTL in both your manifest and the TextView.
I could not copy-paste my string into here (it mixed up the string). I believe it will mix it up again if you try to copy-paste it to your project, so do not copy-paste my string to your project. This is how the string looks like in my project.
You have to use <br />
to break line in xml instead of \n
for example :
<string name="no_group_instructions">You don\'t have a group yet!
<br/><br/>Please choose whether to create a new group, or to join an existing one...
</string>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With