开发者

C#: get letters of alphabet for scandinavian language?

Is there a way to get the letters of the alphabet in a language?

I want to do paging, and I want to show for example the last 7 letters of the alphabet. For the dutch alphabet t-z are the last 7 letters, but for Sweden it's w-ö (开发者_JAVA百科which is w x y z å ä ö).

And when I get that as input, for the "normal" a-z alphabet I can generate the letters in between by using the ASCII table, but for Sweden that won't work.


To the best of my knowledge, neither .NET nor Windows provide this information. However, you can find it in the Unicode Consortium's CLDR database. This DB is actually a set of XML files (one for each language. named after the language abbreviation) containing all sorts of localisation info. A gold mine!

the element /ldml/characters/examplarCharacters contains a list of characters used in the language. e.g., for Swedish (sv.xml):

[a-v x-z å ä ö]

Note that when you say 'ASCII letters', you do realize you're limiting yourself to the Latin script, don't you? As far as ar the CLDR is concerned, lists such as a-z are Unicode characters sequences, not just ASCII letters. eg, in Russian (from ru.xml):

[а-е ё ж-я]


I don't think it's accessible programmatically by default but here's a good set of reference documents at the Evertype website


You're going to send a list of strings to your translators anyway. For each language of your site, you'll have one, and they'll each know the answer for their languages. So just submit the string "a b c d e f g h i j k l m n o p q r s t u v w x y z" to them, and document this as the alplabet used for paging. They should be able to translate it for you. Mind you, you could get back entries like ..."x ij z" for dutch - "ij" being a common spelling of the single letter IJ


So to clean this one up, i think the answer is that even if i limit myself to western languages i can't ask the .Net framework for the alphabet letters. So i've made a list myself with the letters, luckily there were only four languages to do.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜