VirtualBox

Ignore:
Timestamp:
Apr 13, 2007 10:01:20 AM (18 years ago)
Author:
vboxsync
Message:

FE/Qt: Added the Default choice for to the language selection UI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r2055 r2068  
    18681868/**
    18691869 *  Loads the language by language ID.
    1870  *  @param aLang language ID in in form of xx_YY
     1870 *
     1871 *  @param aLangId Language ID in in form of xx_YY. QString::null means the
     1872 *                 system default language.
    18711873 */
    18721874/* static */
    1873 void VBoxGlobal::loadLanguage (const QString &aLang)
    1874 {
    1875     QString langId = aLang.isNull() ?
    1876         VBoxGlobal::systemLanguageId() : aLang;
    1877     QString languageFileName = QString::null;
     1875void VBoxGlobal::loadLanguage (const QString &aLangId)
     1876{
     1877    QString langId = aLangId.isNull() ?
     1878        VBoxGlobal::systemLanguageId() : aLangId;
     1879    QString languageFileName;
    18781880    QString selectedLangId = gVBoxBuiltInLangName;
    18791881
    1880     if (aLang != gVBoxBuiltInLangName)
     1882    if (!aLangId.isNull() && aLangId != gVBoxBuiltInLangName)
    18811883    {
    18821884        QRegExp regExp (gVBoxLangIDRegExp);
    18831885        int rule = regExp.search (langId);
    18841886        /* this rule should match the language id completely */
    1885         Assert (!rule);
    1886         if (rule == -1) return;
    1887 
    1888         QString mId1part = regExp.cap (2);
    1889         QString mId2part = regExp.cap (4);
    1890         /* language localization (second part) should not be empty? */
    1891         // Assert (!mId2part.isEmpty());
     1887        AssertReturnVoid (rule == 0);
     1888
     1889        QString lang = regExp.cap (2);
    18921890
    18931891        QString nlsPath = qApp->applicationDirPath() + gVBoxLangSubDir;
     
    18991897            selectedLangId = langId;
    19001898        }
    1901         else if (nlsDir.exists (gVBoxLangFileBase + mId1part + gVBoxLangFileExt))
    1902         {
    1903             languageFileName = nlsDir.absFilePath (gVBoxLangFileBase + mId1part +
     1899        else if (nlsDir.exists (gVBoxLangFileBase + lang + gVBoxLangFileExt))
     1900        {
     1901            languageFileName = nlsDir.absFilePath (gVBoxLangFileBase + lang +
    19041902                                                   gVBoxLangFileExt);
    1905             selectedLangId = mId1part;
    1906         }
    1907 
    1908         if (sTranslator && languageFileName.isNull())
     1903            selectedLangId = lang;
     1904        }
     1905
     1906        if (languageFileName.isNull())
    19091907        {
    19101908            vboxProblem().cannotFindLanguage (langId, nlsPath);
     
    19241922    if (sTranslator)
    19251923    {
    1926         /* an empty file name means built-in English*/
    19271924        if (selectedLangId != gVBoxBuiltInLangName)
    19281925        {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette