struct { WORD wLanguage; LPCTSTR lpszEncoding; LPCTSTR lpszCaption; LPCTSTR lpszDLLName; } encoding[] = { {MAKELANGID(LANG_ARABIC, SUBLANG_ARABIC_SAUDI_ARABIA), _T("windows-1256"), _T("Arabic (Saudi Arabia)"), _T("ResourceArSa")}, {MAKELANGID(LANG_BULGARIAN, SUBLANG_DEFAULT), _T("windows-1251"), _T("Bulgarian"), _T("ResourceBg")}, {MAKELANGID(LANG_CZECH, SUBLANG_DEFAULT), _T("windows-1250"), _T("Czech"), _T("ResourceCs")}, {MAKELANGID(LANG_DANISH, SUBLANG_DEFAULT), _T("windows-1252"), _T("Danish"), _T("ResourceDa")}, {MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), _T("windows-1252"), _T("German (Germany)"), _T("ResourceDe")}, {MAKELANGID(LANG_GREEK, SUBLANG_DEFAULT), _T("windows-1253"), _T("Greek"), _T("ResourceEl")}, // 5 {MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), _T("windows-1252"), _T("English (United States)"),_T("ResourceEn")}, {MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), _T("windows-1252"), _T("Spanish (Spain - Modern Sort)"),_T("ResourceEs")}, {MAKELANGID(LANG_ESTONIAN, SUBLANG_DEFAULT), _T("windows-1257"), _T("Estonian"), _T("ResourceEt")}, {MAKELANGID(LANG_FINNISH, SUBLANG_DEFAULT), _T("windows-1252"), _T("Finnish"), _T("ResourceFi")}, {MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH), _T("windows-1252"), _T("French (France)"), _T("ResourceFr")}, //10 {MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), _T("windows-1255"), _T("Hebrew"), _T("ResourceHe")}, {MAKELANGID(LANG_CROATIAN, SUBLANG_DEFAULT), _T("windows-1250"), _T("Croatian"), _T("ResourceHr")}, {MAKELANGID(LANG_HUNGARIAN, SUBLANG_DEFAULT), _T("windows-1250"), _T("Hungarian"), _T("ResourceHu")}, {MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN), _T("windows-1252"), _T("Italian (Italy)"), _T("ResourceIt")}, {MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), _T("shift-jis"), _T("Japanese"), _T("ResourceJa")}, //15 {MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT), _T("ks_c_5601"), _T("Korean"), _T("ResourceKo")}, {MAKELANGID(LANG_LITHUANIAN,SUBLANG_LITHUANIAN), _T("windows-1257"), _T("Lithuanian"), _T("ResourceLt")}, {MAKELANGID(LANG_LATVIAN, SUBLANG_DEFAULT), _T("windows-1257"), _T("Latvian"), _T("ResourceLv")}, {MAKELANGID(LANG_DUTCH, SUBLANG_DUTCH), _T("windows-1252"), _T("Dutch"), _T("ResourceNl")}, {MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL), _T("windows-1252"), _T("Norwegian (Bokmal)"), _T("ResourceNo")}, //20 {MAKELANGID(LANG_POLISH, SUBLANG_DEFAULT), _T("windows-1250"), _T("Polish"), _T("ResourcePl")}, {MAKELANGID(LANG_PORTUGUESE,SUBLANG_PORTUGUESE), _T("windows-1252"), _T("Portuguese (Portugal)"), _T("ResourcePt")}, {MAKELANGID(LANG_PORTUGUESE,SUBLANG_PORTUGUESE_BRAZILIAN), _T("windows-1252"), _T("Portuguese (Brazil)"), _T("ResourcePtBr")}, {MAKELANGID(LANG_ROMANIAN, SUBLANG_DEFAULT), _T("windows-1250"), _T("Romanian"), _T("ResourceRo")}, {MAKELANGID(LANG_RUSSIAN, SUBLANG_DEFAULT), _T("windows-1251"), _T("Russian"), _T("ResourceRu")}, //25 {MAKELANGID(LANG_SLOVAK, SUBLANG_DEFAULT), _T("windows-1250"), _T("Slovak"), _T("ResourceSk")}, {MAKELANGID(LANG_SLOVENIAN, SUBLANG_DEFAULT), _T("windows-1250"), _T("Slovenian"), _T("ResourceSl")}, {MAKELANGID(LANG_SERBIAN, SUBLANG_SERBIAN_LATIN), _T("windows-1250"), _T("Serbian"), _T("ResourceSr")}, {MAKELANGID(LANG_SWEDISH, SUBLANG_DEFAULT), _T("windows-1252"), _T("Swedish"), _T("ResourceSv")}, {MAKELANGID(LANG_THAI, SUBLANG_DEFAULT), _T("windows-874"), _T("Thai"), _T("ResourceTh")}, //30 {MAKELANGID(LANG_TURKISH, SUBLANG_DEFAULT), _T("windows-1254"), _T("Turkish"), _T("ResourceTr")}, {MAKELANGID(LANG_UKRAINIAN, SUBLANG_DEFAULT), _T("windows-1251"), _T("Ukrainian "), _T("ResourceUk")}, {MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), _T("gb2312"), _T("Chinese (PRC)"), _T("ResourceZhCn")}, {MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), _T("big5"), _T("Chinese (Taiwan)"), _T("ResourceZhTw")} };
#include <locale.h>
BOOL CRibbonSampleApp::InitInstance() {
//hardcoded language choosing const int kk = 34; //any //const int kk = 4; //german //const int kk = 5; //greek LCID Locale = encoding[kk].wLanguage; LPCTSTR szLocale = encoding[kk].lpszCaption; LPCTSTR szFileName = encoding[kk].lpszDLLName;
// get application path CString strPath; VERIFY(::GetModuleFileName(AfxGetApp()->m_hInstance, strPath.GetBufferSetLength(_MAX_PATH), _MAX_PATH)); strPath.ReleaseBuffer(); int nIndex = strPath.ReverseFind(_T('\\')); if (nIndex > 0) strPath = strPath.Left(nIndex + 1); else strPath.Empty(); strPath = strPath + _T("Translations\\ToolkitPro.") + szFileName + _T(".dll");
//set resource file for strings XTPResourceManager()->SetResourceManager(new CXTPResourceManager()); XTPResourceManager()->SetResourceFile(strPath); ::SetThreadLocale(MAKELCID(Locale, SORT_DEFAULT)); ::_tsetlocale(LC_ALL, szLocale);
//test loading resources //CString strTitle; //XTPResourceManager()->LoadString(&strTitle, XTP_ID_RIBBONCONTROLQUICKACCESS); |