Verified Commit 9e2b3938 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

applets/kicker: store the first char in `firstChar`

parent 93f70563
......@@ -52,10 +52,13 @@ QString groupName(const QString &name)
if (name.isEmpty()) {
return QString();
}
const QChar firstChar = name[0];
// Here we will apply a locale based strategy for the first character.
// If first character is hangul, run decomposition and return the choseong (consonants).
if (name[0].script() == QChar::Script_Hangul) {
auto decomposed = name[0].decomposition();
if (firstChar.script() == QChar::Script_Hangul) {
auto decomposed = firstChar.decomposition();
if (decomposed.isEmpty()) {
return name.left(1);
}
......@@ -66,7 +69,7 @@ QString groupName(const QString &name)
// 1. it does not make much sense to have every different Kanji to have a different group.
// 2. ICU transliterator can't yet convert Kanji to Hiragana.
// https://unicode-org.atlassian.net/browse/ICU-5874
if (name[0].script() == QChar::Script_Han) {
if (firstChar.script() == QChar::Script_Han) {
// Unicode Han
return QString::fromUtf8("\xe6\xbc\xa2");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment