Public Member Functions | Static Public Member Functions

Language Class Reference

List of all members.

Public Member Functions

 Language (const QLocale::Language &language)
bool operator< (const Language &lang) const
const QString & name () const
const QLocale::Language & language () const
const QString & countryName () const

Static Public Member Functions

static const LanguageListgetAllLanguages ()
static LanguageList getTrLanguages (const QString &translationPath)

Detailed Description

Definition at line 55 of file qxtlanguagecombobox.cpp.


Constructor & Destructor Documentation

Language::Language ( const QLocale::Language &  language ) [inline]

Definition at line 58 of file qxtlanguagecombobox.cpp.

References language().

Referenced by getAllLanguages(), and getTrLanguages().

            : _mLanguage(language)
            , _mCountryCode("C")
    {
        QLocale loc(language);
        if (loc.language() == language)
            _mCountryCode = loc.name().right(2);
        else
            _mCountryCode = "";

        _mDisplayName = qApp->translate("QLocale", qPrintable(QLocale::languageToString(_mLanguage)));
    };

Member Function Documentation

const QString& Language::countryName (  ) const [inline]

Definition at line 124 of file qxtlanguagecombobox.cpp.

    {
        return _mCountryCode;
    }
static const LanguageList& Language::getAllLanguages (  ) [inline, static]

Definition at line 76 of file qxtlanguagecombobox.cpp.

References Language().

    {
        if (_smAllLanguages.empty())
        {

            for (int idx = 0; idx < QLocale::LastLanguage; ++idx)
            {
                QLocale::Language l = static_cast<QLocale::Language>(idx);
                if (l == QLocale::LastLanguage)
                    continue;
                // obsolete - NorwegianNynorsk is used instead
                if (l == QLocale::Nynorsk)
                    continue;
                if (l == QLocale::C)
                    continue;

                _smAllLanguages.push_back(Language(l));
            }

            qSort(_smAllLanguages);
        }
        return _smAllLanguages;
    };
static LanguageList Language::getTrLanguages ( const QString &  translationPath ) [inline, static]

Definition at line 100 of file qxtlanguagecombobox.cpp.

References findQmFiles(), and Language().

    {
        LanguageList trLanguages;

        QStringList qms = findQmFiles(translationPath);
        for (int i = 0; i < qms.size(); ++i)
        {
            QLocale locale(qms[i]);
            if (locale.language() == QLocale::C)
                continue;
            trLanguages.push_back(Language(locale.language()));
        }
        qSort(trLanguages);
        return trLanguages;
    };
const QLocale::Language& Language::language (  ) const [inline]

Definition at line 120 of file qxtlanguagecombobox.cpp.

Referenced by Language().

    {
        return _mLanguage;
    }
const QString& Language::name (  ) const [inline]

Definition at line 116 of file qxtlanguagecombobox.cpp.

    {
        return _mDisplayName;
    }
bool Language::operator< ( const Language lang ) const [inline]

Definition at line 71 of file qxtlanguagecombobox.cpp.

    {
        return _mDisplayName.localeAwareCompare(lang._mDisplayName) < 0;
    }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines