C#本地化.同一句子中从左到右的单词与从右到左的单词混合的问题 [英] C# localization. Problems with mixing of Left-to-Right words with Right-to-left words in the same sentence

查看:81
本文介绍了C#本地化.同一句子中从左到右的单词与从右到左的单词混合的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究如何解决问题,同时混合需要从右到左(如阿拉伯语)阅读的单词和从左到右的单词(如英语).

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).

我们遇到的问题是,在要以RTL读取的句子中插入LTR单词时(例如,在阿拉伯语句子中插入英语单词):英文文本正确地从左到右书写,但是问题是是阿拉伯语部分出现在错误的一面之后. 这样做的上下文是我正在研究的程序需要插入一些ID或对象标识符,这些ID或对象标识符需要保留英语,但要插入本地化的句子(在这种情况下为阿拉伯语).

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).

为说明一个例子,假设RTL词为小写,LTR词为大写.

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

我想要的输出将是:

abc ABC efg

但是我们得到

abc ABC gfe

获得正确输出的唯一方法是在LTR文本之前和之后插入unicode标记(从左到右的LTR,将标记其结尾的Pop-Directional-Formatting的PDF): /p>

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

这是一个可以使用的解决方案,但是我想知道是否没有一种更简单的方法来自动处理此问题? RTL单词在资源文件中,而英语部分通常(通常)来自Db调用. 在处理该特定情况方面是否有过往经验? 谢谢!

This is a solution that can be used, but I was wondering 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!

推荐答案

只是暗中刺伤:您是否尝试过使用{RTL}而不是{PDF} ...?

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

这篇关于C#本地化.同一句子中从左到右的单词与从右到左的单词混合的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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