本地化:如何将文化信息映射到脚本名称或 Unicode 字符范围? [英] Localization: How to map culture info to a script name or Unicode character range?

查看:17
本文介绍了本地化:如何将文化信息映射到脚本名称或 Unicode 字符范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些关于本地化的信息.我正在使用带有 C# 2.0 的 .net 2.0,它处理了大部分与本地化相关的问题.但是,我需要在一个特定的屏幕上手动绘制与当前文化相对应的字母表.

I need some information about localization. I am using .net 2.0 with C# 2.0 which takes care of most of the localization related issues. However, I need to manually draw the alphabets corresponding to the current culture on the screen in one particular screen.

这类似于 Microsoft Outlook 中的联系人屏幕(联系人下的地址卡视图或详细地址卡视图),因此它需要在右端有一列按钮,每个字母对应一个.

This would be similar to the Contacts screen in Microsoft Outlook (Address Cards view or Detailed Address Cards View under Contacts), and so it needs a the column of buttons at the right end, one for each alphabet.

我试图模仿它,但我不想让用户选择脚本.如果说现在的文化是中文,我想画中文字母.当用户将文化信息更改为英语时(以及当他重新启动应用程序时),我想改为绘制英文字母.希望您了解我将使用此查询的去向.

I am trying to emulate that, but I don't want to ask the user to choose the script. If the current culture is say, Chinese, I want to draw Chinese alphabets. When the user changes the culture info to English (and when he restarts the application) I want to draw English alphabets instead. Hope you understand where I am going with this query.

我可以确定当前用户的文化(Application.CurrentCulture 或 System.Globalization.CultureInfo.CurrentCulture 会给出文化相关的信息).我也有所有的脚本来呈现字母.但是,问题是我不知道如何将文化信息映射到脚本的名称.

I can determine the culture of the current user (Application.CurrentCulture or System.Globalization.CultureInfo.CurrentCulture will give the culture related information). I also have all the scripts to render the alphabets. However, the problem is that I don't know how to map the culture info to the name of a script.

换句话说,有没有办法确定与文化对应的脚本名称?或者是否可以确定与文化对应的 Unicode 字符值的范围?它们中的任何一个都可以让我正确呈现按钮上的字母.

In other words, is there a way to determine the script name corresponding to a culture? Or is it possible to determine the range of Unicode character values corresponding to a culture? Either of them would allow me to render the alphabets on the button properly.

非常感谢您对此提出任何建议或指导.如果我的方法(或我试图实现的目标)存在根本性错误,请同时指出.谢谢你的时间.

Any suggestions or guidance regarding this is truly appreciated. If there is something fundamentally wrong with my approach (or with what I am trying to achieve), please point out that as well. Thanks for your time.

PS:我知道最简单的解决方案是将脚本名称配置为用户首选项的一部分,或者显示一个语言列表供用户选择(如 Outlook 2007 中的联系人).但我只是想看看我是否可以在用户不必做任何事情的情况下呈现与文化相对应的字母表.

PS: I know the easiest solution is to either configure the script name as part of user preferences or display a list of languages for the user to choose from (a la Contact in Outlook 2007). But I am just trying to see whether I can render the alphabets corresponding to the culture without the user having to do anything.

推荐答案

在本机代码中,GetLocaleInfoEx()(Vista 及以上)的 LOCALE_SSCRIPTS 向您显示语言环境需要哪些脚本..Net 目前还没有类似的概念.

In native code there's LOCALE_SSCRIPTS for GetLocaleInfoEx() (Vista & above) that shows you what scripts are expected for a locale. There isn't a similar concept for .Net at this time.

这篇关于本地化:如何将文化信息映射到脚本名称或 Unicode 字符范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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