VirtualBox

Changeset 2158 in vbox


Ignore:
Timestamp:
Apr 18, 2007 11:23:14 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
20487
Message:

FE/Qt: Fixed assertion and an invalid error message when starting VirtualBox in the C locale.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
2 edited

Legend:

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

    r2068 r2158  
    18271827extern const char *gVBoxLangFileBase = "VirtualBox_";
    18281828extern const char *gVBoxLangFileExt = ".qm";
    1829 extern const char *gVBoxLangIDRegExp = "(([a-z]{2})(?:_([A-Z]{2}))?)";
    1830 extern const char *gVBoxBuiltInLangName   = "built_in";
     1829extern const char *gVBoxLangIDRegExp = "(([a-z]{2})(?:_([A-Z]{2}))?)|(C)";
     1830extern const char *gVBoxBuiltInLangName   = "C";
    18311831
    18321832class VBoxTranslator : public QTranslator
     
    18581858 *  Note that it may not match with VMGlobalSettings::languageId() if the
    18591859 *  specified language cannot be loaded.
    1860  *  If the built-in language is active, this method returns "built_in".
     1860 *  If the built-in language is active, this method returns "C".
     1861 *
     1862 *  @note "C" is treated as the built-in language for simplicity -- the C
     1863 *  locale is used in unix environments as a fallback when the requested
     1864 *  locale is invalid. This way we don't need to process both the "built_in"
     1865 *  language and the "C" language (which is a valid environment setting)
     1866 *  separately.
    18611867 */
    18621868/* static */
     
    18801886    QString selectedLangId = gVBoxBuiltInLangName;
    18811887
    1882     if (!aLangId.isNull() && aLangId != gVBoxBuiltInLangName)
     1888    Assert (!langId.isEmpty());
     1889    if (!langId.isEmpty() && langId != gVBoxBuiltInLangName)
    18831890    {
    18841891        QRegExp regExp (gVBoxLangIDRegExp);
    1885         int rule = regExp.search (langId);
    1886         /* this rule should match the language id completely */
    1887         AssertReturnVoid (rule == 0);
     1892        int pos = regExp.search (langId);
     1893        /* the language ID should match the regexp completely */
     1894        AssertReturnVoid (pos == 0);
    18881895
    18891896        QString lang = regExp.cap (2);
     
    19031910            selectedLangId = lang;
    19041911        }
    1905 
    1906         if (languageFileName.isNull())
    1907         {
    1908             vboxProblem().cannotFindLanguage (langId, nlsPath);
    1909             return;
     1912        else
     1913        {
     1914            /* Never complain when the default language is requested.  In any
     1915             * case, if no explicit language file exists, we will simply
     1916             * fall-back to English (built-in). */
     1917            if (!aLangId.isNull())
     1918                vboxProblem().cannotFindLanguage (langId, nlsPath);
     1919            /* selectedLangId remains built-in here */
     1920            AssertReturnVoid (selectedLangId == gVBoxBuiltInLangName);
    19101921        }
    19111922    }
     
    19281939        }
    19291940        /* we install the translator in any case: on failure, this will
    1930          * activate an empty (aka built-in) translator */
     1941         * activate an empty translator that will give us English
     1942         * (built-in) */
    19311943        qApp->installTranslator (sTranslator);
    19321944    }
     
    23792391 *  The order of precedence is well defined here:
    23802392 *  http://opengroup.org/onlinepubs/007908799/xbd/envvar.html
     2393 *
     2394 *  @note This method will return "C" when the requested locale is invalid or
     2395 *  when the "C" locale is set explicitly.
    23812396 */
    23822397/* static */
  • trunk/src/VBox/Frontends/VirtualBox/src/VMGlobalSettings.cpp

    r2067 r2158  
    8686 */
    8787
     88/* Defined in VBoxGlobal.cpp */
     89extern const char *gVBoxLangIDRegExp;
     90
    8891static struct
    8992{
     
    98101    { "GUI/Input/AutoCapture",  "autoCapture",  "true|false", true },
    99102    { "GUI/Customizations",     "guiFeatures",  "\\S+", true },
    100     /* LanguageID regexp must correlate with gVBoxLangIDRegExp in
    101      * VBoxGlobal.cpp */
    102     { "GUI/LanguageID",         "languageId",   "(([a-z]{2})(_([A-Z]{2}))?)|(built_in)", true },
     103    { "GUI/LanguageID",         "languageId",   gVBoxLangIDRegExp, true },
    103104};
    104105
Note: See TracChangeset for help on using the changeset viewer.

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