翻译数值的Android希伯来语RTL字符串

时间:2022-08-24 08:58:16

I would like to display a String with my app name and it's current version. The app name is in hebrew, for some when I combine hebrew text with numeric value, the numeric value is flipped.

我想显示一个带有我的应用名称的字符串,它是当前版本。应用程序名称是希伯来语,对于某些人,当我将希伯来语文本与数值组合时,数值会被翻转。

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

for example: app version is 1.0, being display as 0.1 on emulator.

例如:app版本为1.0,在模拟器上显示为0.1。

2 个解决方案

#1


10  

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

听起来像Android bidi算法中的错误。尝试在数字周围添加从左到右的标记:

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

(If this works, you may be able to eliminate the second one.)

(如果这样做,你可以消除第二个。)

#2


0  

I think that tou need to style the output string with a CSS using the dir="RTL" tag - that will fix the directionality of your numbers and special characters inside Hebrew

我认为tou需要使用dir =“RTL”标签用CSS设置输出字符串的样式 - 这将修复希伯来语中数字和特殊字符的方向性

#1


10  

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

听起来像Android bidi算法中的错误。尝试在数字周围添加从左到右的标记:

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

(If this works, you may be able to eliminate the second one.)

(如果这样做,你可以消除第二个。)

#2


0  

I think that tou need to style the output string with a CSS using the dir="RTL" tag - that will fix the directionality of your numbers and special characters inside Hebrew

我认为tou需要使用dir =“RTL”标签用CSS设置输出字符串的样式 - 这将修复希伯来语中数字和特殊字符的方向性