Android的希伯来语(RTL)集成 [英] Android Hebrew (RTL) Integration

查看:774
本文介绍了Android的希伯来语(RTL)集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作相对简单的Andr​​oid应用程序。我希望它有英文版本以及一个希伯来语版本。 (RTL从右到左对齐)

I'm working on a relatively simple Android app. I want it to have an English version as well as a Hebrew version. (RTL Right to Left Alignment)

我已经手动更改为右对齐布局的XML文件。当一个句子中包含数字(在它的中间),数字出现在镜子的看法: 29显示为92 21:45显示为54:12 2000显示为000,2

I have manually change the alignment to right in layout xml file. When a sentence contains digits (in the middle of it), the digits appear in a mirror view: 29 appears as 92, 21:45 appears as 54:12 and 2,000 appears as 000,2.

此外,当一个句子开始,数字或英文字母,他们抛出的句末搞乱了这一切。

Also, when a sentence starts with digits or English characters, they get thrown to the end of the sentence messing it all up.

我觉得对于Android版本4.0.3,它支持希伯来文。我有检查,在模拟器。

I think for android version 4.0.3 it supports Hebrew. I have check that in emulator.

因此​​,对于旧版本有没有实现希伯来语正确的方法是什么? 请大家帮帮忙。

So for older versions is there correct way to implement Hebrew? Please help.

推荐答案

我觉得Android的比迪烟的分析算法有一定的缺陷。统一code有两个无形的,强烈的方向性特征,这可能有助于这些问题:

I think that Android's bidi analysis algorithm has some flaws. Unicode has two invisible, strongly directional characters that might help with these problems:

  • U + 200E - 左到右标记
  • U + 200F - 从右到左标记

有关数字顺序的问题,可以尝试在左到右标记(U + 200E)的数字序列的两侧。

For the digit order problem, try putting left-to-right marks (U+200E) on both sides of the digit sequence.

统一code还具有以下的比迪烟格式codeS:

Unicode also has the following bidi formatting codes:

  • U + 202A - 左到右嵌入
  • U + 202B - 从右到左嵌入
  • U + 202C - 弹出方向格式(取消previous嵌套或优先)
  • U + 202D - 左到右覆盖
  • U + 202E - 从右到左的优先

有关在希伯来文英文碎片的问题,它可能是简单,只要把一个从右到左标记的英语了。 (Android的算法可以根据该段是左到右以来的第一个字符是英文的IM pression)。如果不工作,也许尝试使用格式codeS的组合周围选定的文本。 (我想尝试左到右包埋随后弹出方向格式。我也想尝试从右到左周围的事物结合选择性明确从右至左嵌入嵌入。)

For the problem with English fragments in Hebrew text, it might be as simple as putting a right-to-left mark before the English. (Android's algorithm may be under the impression that the paragraph is left-to-right since the first characters are English.) If that doesn't work, perhaps try surrounding selected text with some combination of formatting codes. (I'd try left-to-right embedding followed by pop directional formatting. I'd also try right-to-left embedding around everything combined with selective explicit right-to-left embeddings.)

的方式,这些都应该影响文本排版用C双向算法的统一code标准附件#9 。但是,如果Android的实施被打破(我怀疑它),最好你能做的就是尝试和错误,直到你把事情看的权利。祝你好运。

The way these are supposed to affect text layout are defined by the Unicode Bidirectional Algorithm Unicode Standard Annex #9. However, if Android's implementation is broken (and I suspect it is), the best you can do is trial-and-error until you get things looking right. Good luck.

修改

据code而言,这里有怎么可能用Java做一个例子:

As far as code is concerned, here's an example of how it might be done in Java:

String text = "גרסה \u200e2.100\u200e זמינה";

在XML中,它可能是:

In XML, it might be:

<string name="update_available">גרסה &#x200e;2.100&#x200e; זמינה</string>

这篇关于Android的希伯来语(RTL)集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆