How can I translate Chinese text to pinyin on iPhone?

The localization saga continues ...

So, I am trying to support the sorting of Chinese text in an iPhone application, and having talked with my native Chinese speaker, I think I understand how the Chinese do it ...

Suppose you had a string 巴拉克 · 奥巴马, and you wanted to find out in which part of the Chinese phone book to put it (in this example, I ignore the first / last name and just use the first character of the string) ...

First you transliterate it into pinyin, which gives you "balake aobama" Then you sort by the first character of this line: "b"

So the question is, how can I go from 巴拉克 · 奥巴马 to hack aobama using the iPhone SDK? It looks like the ICU library that is sent over the phone can do this transliteration, but I'm not sure if I can easily use it from my code, and even if I can, I don't know if the transliteration material is included in the ICU assembly that comes by phone.

If ICU is non-go, does anyone have any better ideas?

+3
source share
3 answers

iPhone SDK (3.0 ) UILocalizedIndexedCollation iPhone.

+1

. , ( ) , , , , .

+1

Excuse my ignorance, but do not -localizedCompare:or -compare:options:range:locale:between the two NSStringsperform this sort ordering operation for you?

0
source

Source: https://habr.com/ru/post/1704852/


All Articles