QMap<QString, QString> Sonnet::Speller::availableDictionaries() const { Loader *l = Loader::openLoader(); const QStringList lst = l->languages(); QMap<QString, QString> langs; foreach(QString tag, lst) { // krazy:exclude=foreach (no const& because tag is modified below) tag = tag.mid(0, tag.indexOf(QLatin1Char('-'))); int underscorePos = tag.indexOf(QLatin1Char('_')); QString cIsoName, lIsoName; if (underscorePos != -1 && underscorePos <= 3) { cIsoName = tag.mid(underscorePos + 1, 2); lIsoName = tag.left(underscorePos); } else { lIsoName = tag; } QLocale loc(tag); QString description; if (!cIsoName.isEmpty()) description= QString::fromLatin1("%1 (%2)") .arg(KGlobal::locale()->languageCodeToName(lIsoName)) .arg(KGlobal::locale()->countryCodeToName(cIsoName)); else description= KGlobal::locale()->languageCodeToName(lIsoName); //qDebug()<<"Dict is "<<tag<<" ( "<<loc.name()<<")"<<", descr = "<<description; langs.insert(description, tag); }
QStringList Speller::availableLanguages() const { Loader *l = Loader::openLoader(); return l->languages(); }