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

查看:19
本文介绍了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 单词时(在阿拉伯语句子中插入一个英文单词 for eg):英文文本从左到右书写正确,但问题是是后面的阿拉伯语部分以错误的方式结束.上下文是我正在处理的程序需要例如插入一些 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 将标记它的结尾):

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天全站免登陆