예제 #1
0
QStringList KSwitchLanguageDialogPrivate::applicationLanguageList()
{
    KSharedConfigPtr config = KGlobal::config();
    QStringList languagesList;

    if (config->hasGroup("Locale"))
    {
        KConfigGroup group(config, "Locale");
        if (group.hasKey("Language"))
        {
            languagesList = group.readEntry("Language", QString()).split(':');
        }
    }
    if (languagesList.isEmpty())
    {
      languagesList = KGlobal::locale()->languageList();
    }

    KLocale *locale = KGlobal::locale();
    for (int i = 0; i < languagesList.count();)
    {
      if (!locale->isApplicationTranslatedInto(languagesList[i]))
        languagesList.removeAt(i);
      else
        ++i;
    }

    return languagesList;
}
예제 #2
0
void KSwitchLanguageDialogPrivate::fillApplicationLanguages(KLanguageButton *button)
{
    KLocale *locale = KGlobal::locale();
    const QStringList allLanguages = locale->allLanguagesList();
    for ( int i = 0, count = allLanguages.count(); i < count; ++i )
    {
        QString languageCode = allLanguages[i];
        if (locale->isApplicationTranslatedInto(languageCode))
        {
            button->insertLanguage(languageCode);
        }
    }
}