开发者

C# localization. Problems with mixing of Left-to-Right words with Right-to-left words in the same sentence

I'm looking on how to solve problems while mixing words that require right-to-left(like arabic) reading and left-to-right words (like English).

The problem we encounter is that when inserting a LTR word inside a sentence meant to be read in RTL (inserting an English word inside an Arabic sentence for eg): the English text is correctly written from left to right,but the problem is that the Arabic part that comes after ends-up on the wrong side. The context of this is that the program I'm working on needs for example to insert some IDs or object identifiers that need to be remained in English but inserted in a localized sentence (Arabic in this case).

To illustrate an example, let's say the RTL words are in lowercase and LTR words are in uppercase.

My desired output would be:

abc ABC efg

but we instead get

abc ABC gfe

The only way to get the correct output is to insert the unicode markers (LTR for left-to-right, the PDF for Pop-Directional-Formatting that will mark the end of it) before and after the LTR text :

abc {LTR} ABC {PDF} efg

This is a solution that can be used, but I was wonder开发者_StackOverflow社区ing if there was not an easier way to handle this, automatically? The RTL words are in the resource files, while the English parts are -usually- coming from Db calls. Any past experience on how to handle this particular scenario? Thanks!


Just a stab in the dark: have you tried using {RTL} instead of {PDF}...?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜