Android Hebrew RTL String with Flipped numeric value

I would like to display String with my application name and current version. The application name is in Hebrew, for some, when I combine Hebrew text with a numerical value, the numerical value is flipped.

versionTextView.setText("אפליקציה גרסה "+this.getResources().getString(R.string.app_version)); 

for example: application version 1.0 displayed on the emulator as 0.1.

+7
source share
2 answers

Sounds like a bug in the bidi Android algorithm. Try adding labels from left to right around the numbers:

 versionTextView.setText("אפליקציה גרסה " + "\u200e" + this.getResources().getString(R.string.app_version) + "\u200e" ); 

(If this works, you can eliminate the second).

+10
source

I think tou needs to style the output string with CSS using the dir = "RTL" tag, which will capture the direction of your numbers and special characters inside Hebrew

0
source

All Articles