Index: src/libictranslate/ResourceManager.cpp =================================================================== diff -u -rf1ce2f1e90a5a90b713a998cda2d4cdaf2090fbd -r3275c48bbd0163b93e9a13c72abb77be85e92c54 --- src/libictranslate/ResourceManager.cpp (.../ResourceManager.cpp) (revision f1ce2f1e90a5a90b713a998cda2d4cdaf2090fbd) +++ src/libictranslate/ResourceManager.cpp (.../ResourceManager.cpp) (revision 3275c48bbd0163b93e9a13c72abb77be85e92c54) @@ -525,10 +525,48 @@ bool CResourceManager::SetLanguage(PCTSTR pszPath) { + WORD wOldLang = 0; + bool bRet = false; + WORD wNewLang = 0; + + tchar_t szPath[_MAX_PATH]; + + // parse the path to allow reading the english language first + const tchar_t* pszBaseName = _t("english.lng"); + if(_tcsstr(pszPath, pszBaseName) != NULL) + { + _tcscpy(szPath, pszPath); + pszPath = NULL; + } + else + { + const tchar_t* pszData = _tcsrchr(pszPath, _t('\\')); + if(pszData != NULL) + { + memset(szPath, 0, _MAX_PATH*sizeof(tchar_t)); + _tcsncpy(szPath, pszPath, pszData - pszPath + 1); + szPath[_MAX_PATH - 1] = _T('\0'); + _tcscat(szPath, pszBaseName); + } + else + _tcscpy(szPath, pszPath); + } + + // and load everything EnterCriticalSection(&m_cs); - WORD wOldLang=m_ld.GetLangCode(); - bool bRet=m_ld.ReadTranslation(pszPath); - WORD wNewLang=m_ld.GetLangCode(); + try + { + wOldLang=m_ld.GetLangCode(); + bRet = m_ld.ReadTranslation(szPath); // base language + if(bRet && pszPath) + bRet=m_ld.ReadTranslation(pszPath, true); // real language + wNewLang=m_ld.GetLangCode(); + } + catch(...) + { + LeaveCriticalSection(&m_cs); + return false; + } LeaveCriticalSection(&m_cs); if (!bRet) return false;