Changeset 2158 in vbox
- Timestamp:
- Apr 18, 2007 11:23:14 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 20487
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r2068 r2158 1827 1827 extern const char *gVBoxLangFileBase = "VirtualBox_"; 1828 1828 extern const char *gVBoxLangFileExt = ".qm"; 1829 extern const char *gVBoxLangIDRegExp = "(([a-z]{2})(?:_([A-Z]{2}))?) ";1830 extern const char *gVBoxBuiltInLangName = " built_in";1829 extern const char *gVBoxLangIDRegExp = "(([a-z]{2})(?:_([A-Z]{2}))?)|(C)"; 1830 extern const char *gVBoxBuiltInLangName = "C"; 1831 1831 1832 1832 class VBoxTranslator : public QTranslator … … 1858 1858 * Note that it may not match with VMGlobalSettings::languageId() if the 1859 1859 * 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. 1861 1867 */ 1862 1868 /* static */ … … 1880 1886 QString selectedLangId = gVBoxBuiltInLangName; 1881 1887 1882 if (!aLangId.isNull() && aLangId != gVBoxBuiltInLangName) 1888 Assert (!langId.isEmpty()); 1889 if (!langId.isEmpty() && langId != gVBoxBuiltInLangName) 1883 1890 { 1884 1891 QRegExp regExp (gVBoxLangIDRegExp); 1885 int rule= regExp.search (langId);1886 /* th is rule should match the language idcompletely */1887 AssertReturnVoid ( rule== 0);1892 int pos = regExp.search (langId); 1893 /* the language ID should match the regexp completely */ 1894 AssertReturnVoid (pos == 0); 1888 1895 1889 1896 QString lang = regExp.cap (2); … … 1903 1910 selectedLangId = lang; 1904 1911 } 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); 1910 1921 } 1911 1922 } … … 1928 1939 } 1929 1940 /* 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) */ 1931 1943 qApp->installTranslator (sTranslator); 1932 1944 } … … 2379 2391 * The order of precedence is well defined here: 2380 2392 * 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. 2381 2396 */ 2382 2397 /* static */ -
trunk/src/VBox/Frontends/VirtualBox/src/VMGlobalSettings.cpp
r2067 r2158 86 86 */ 87 87 88 /* Defined in VBoxGlobal.cpp */ 89 extern const char *gVBoxLangIDRegExp; 90 88 91 static struct 89 92 { … … 98 101 { "GUI/Input/AutoCapture", "autoCapture", "true|false", true }, 99 102 { "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 }, 103 104 }; 104 105
Note:
See TracChangeset
for help on using the changeset viewer.