当前位置: 首页>>代码示例>>C++>>正文


C++ SUBLANGID函数代码示例

本文整理汇总了C++中SUBLANGID函数的典型用法代码示例。如果您正苦于以下问题:C++ SUBLANGID函数的具体用法?C++ SUBLANGID怎么用?C++ SUBLANGID使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SUBLANGID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lcid_to_rfc1766

static HRESULT lcid_to_rfc1766(LCID lcid, WCHAR *rfc1766, INT len)
{
    WCHAR buffer[6 /* MAX_RFC1766_NAME */];
    INT n = GetLocaleInfoW(lcid, LOCALE_SISO639LANGNAME, buffer, ARRAY_SIZE(buffer));
    INT i;

    if (n)
    {
        i = PRIMARYLANGID(lcid);
        if ((((i == LANG_ENGLISH) || (i == LANG_CHINESE) || (i == LANG_ARABIC)) &&
            (SUBLANGID(lcid) == SUBLANG_DEFAULT)) ||
            (SUBLANGID(lcid) > SUBLANG_DEFAULT)) {

            buffer[n - 1] = '-';
            i = GetLocaleInfoW(lcid, LOCALE_SISO3166CTRYNAME, buffer + n, ARRAY_SIZE(buffer) - n);
            if (!i)
                buffer[n - 1] = '\0';
        }
        else
            i = 0;

        LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, buffer, n + i, rfc1766, len);
        return ((n + i) > len) ? E_INVALIDARG : S_OK;
    }
    return E_FAIL;
}
开发者ID:wine-mirror,项目名称:wine,代码行数:26,代码来源:main.c

示例2: lcid_to_fl

static const int lcid_to_fl(LCID lcid, FL_Locale *rtn)
{
	LANGID langid       = LANGIDFROMLCID(lcid);
	LANGID primary_lang = PRIMARYLANGID(langid);
	LANGID sub_lang     = SUBLANGID(langid);
	int    i;

	// try to find an exact primary/sublanguage combo that we know about
	for (i = 0; i < num_both_to_code; ++i)
	{
		if (both_to_code[i].id == langid)
		{
			accumulate_locstring(both_to_code[i].code, rtn);
			return 1;
		}
	}
	// fallback to just checking the primary language id
	for (i = 0; i < num_primary_to_code; ++i)
	{
		if (primary_to_code[i].id == primary_lang)
		{
			accumulate_locstring(primary_to_code[i].code, rtn);
			return 1;
		}
	}
	return 0;
}
开发者ID:Classixz,项目名称:etlegacy,代码行数:27,代码来源:i18n_findlocale.c

示例3: TaLocale_GuessBestLangID

LANGID TaLocale_GuessBestLangID (LANGID lang)
{
   switch (PRIMARYLANGID(lang))
      {
      case LANG_KOREAN:
         return MAKELANGID(LANG_KOREAN,SUBLANG_KOREAN);

      case LANG_JAPANESE:
         return MAKELANGID(LANG_JAPANESE,SUBLANG_DEFAULT);

      case LANG_ENGLISH:
         return MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US);

      case LANG_CHINESE:
         if (SUBLANGID(lang) != SUBLANG_CHINESE_TRADITIONAL)
            return MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED);

      case LANG_GERMAN:
         return MAKELANGID(LANG_GERMAN,SUBLANG_GERMAN);

      case LANG_SPANISH:
         return MAKELANGID(LANG_SPANISH,SUBLANG_SPANISH);

      case LANG_PORTUGUESE:
         return MAKELANGID(LANG_PORTUGUESE,SUBLANG_PORTUGUESE_BRAZILIAN);
      }

   return lang;
}
开发者ID:maxendpoint,项目名称:openafs_cvs,代码行数:29,代码来源:tal_main.cpp

示例4: match_ctry_lang

/***
*BOOL match_ctry_lang - match country with language
*
*Purpose:
*       ensure language and country match, choose proper values for language
*  and country when matching, country ids converted to proper language id
*
*Entry:
*       pwCtry - pointer to country id to match and set
*       pwLang - pointer to language id to match and set
*
*Exit:
*
*Exceptions:
*
*******************************************************************************/
static BOOL match_ctry_lang(WORD *pwCtry, WORD *pwLang)
{
        UINT i;
        WORD wCtry = *pwCtry;
        WORD wLang = *pwLang;
        WORD wLangT;

        /* only use base 10 two least significant digits */
        wCtry = wCtry % 100;

        if (wCtry > MAX_CTRY_NUM)
            return FALSE;

        /* see if any of the sublanguages for this country match*/
        for (i = 0; i < MAX_LANG_PER_CTRY; i++)
        {
            if (!(wLangT = __rgrgwlang[wCtry][i]))
                break;
            if (PRIMARYLANGID(wLangT) == PRIMARYLANGID(wLang))
            {
                /* they match*/
                if (!SUBLANGID(wLang))
                    /* don't override sublanguage*/
                    *pwLang = wLangT;
                    *pwCtry = wLangT;
            return TRUE;
            }
        }
        /* get the default language for this country*/
        if (!(*pwCtry = __rgrgwlang[wCtry][0]))
            /* bad country number*/
            return FALSE;
        return TRUE;
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:50,代码来源:getqloc.c

示例5: PRIMARYLANGID

void ASLocalizer::setLanguageFromLCID(size_t lcid)
// Windows get the language to use from the user locale.
// NOTE: GetUserDefaultLocaleName() gets nearly the same name as Linux.
//       But it needs Windows Vista or higher.
//       Same with LCIDToLocaleName().
{
	m_lcid = lcid;
	m_langID = "en";	// default to english

	size_t lang = PRIMARYLANGID(LANGIDFROMLCID(m_lcid));
	size_t sublang = SUBLANGID(LANGIDFROMLCID(m_lcid));
	// find language in the wlc table
	size_t count = sizeof(wlc) / sizeof(wlc[0]);
	for (size_t i = 0; i < count; i++)
	{
		if (wlc[i].winLang == lang)
		{
			m_langID = wlc[i].canonicalLang;
			break;
		}
	}
	if (m_langID == "zh")
	{
		if (sublang == SUBLANG_CHINESE_SIMPLIFIED || sublang == SUBLANG_CHINESE_SINGAPORE)
			m_subLangID = "CHS";
		else
			m_subLangID = "CHT";	// default
	}
	setTranslationClass();
}
开发者ID:crabant,项目名称:astyle-mirror,代码行数:30,代码来源:ASLocalizer.cpp

示例6: GetSystemDefaultLangID

CMediaInfoDlg::CMediaInfoDlg()
{
	LANGID   _SysLangId   =   GetSystemDefaultLangID();

	if(PRIMARYLANGID(_SysLangId)   ==   LANG_CHINESE) {
		if(SUBLANGID(_SysLangId)   ==   SUBLANG_CHINESE_SIMPLIFIED)
			codepage = 936;		//Simplified Chinese GBK
		else if(SUBLANGID(_SysLangId)   ==   SUBLANG_CHINESE_TRADITIONAL)
			codepage = 950;		//Traditional Chinese Big5
		else if(SUBLANGID(_SysLangId)   ==   SUBLANG_CHINESE_HONGKONG)
			codepage = 950;		//Traditional Chinese Big5
	} else if(PRIMARYLANGID(_SysLangId)   ==   LANG_JAPANESE)
		codepage = 932;			//Japanese Shift-JIS
	else if(PRIMARYLANGID(_SysLangId)   ==   LANG_KOREAN)
		codepage = 949;			//Korean

	m_wndListCtrl.RegisterClass();
}
开发者ID:william0wang,项目名称:meditor,代码行数:18,代码来源:MediaInfoDlg.cpp

示例7: GetLanguageID

void GetLanguageID()
{
	LANGID   _SysLangId   =   GetSystemDefaultLangID();

	if(PRIMARYLANGID(_SysLangId)   ==   LANG_CHINESE)
	{
		if(SUBLANGID(_SysLangId)   ==   SUBLANG_CHINESE_SIMPLIFIED)
			sys_language_id = 936;		//Simplified Chinese GBK
		else if(SUBLANGID(_SysLangId)   ==   SUBLANG_CHINESE_TRADITIONAL)
			sys_language_id = 950;		//Traditional Chinese Big5
		else if(SUBLANGID(_SysLangId)   ==   SUBLANG_CHINESE_HONGKONG)
			sys_language_id = 950;		//Traditional Chinese Big5
		else
			sys_language_id = CP_ACP;		//ANSI
	}
	else if(PRIMARYLANGID(_SysLangId)   ==   LANG_JAPANESE)
		sys_language_id = 932;			//Japanese Shift-JIS
	else if(PRIMARYLANGID(_SysLangId)   ==   LANG_KOREAN)
		sys_language_id = 949;			//Korean
	else
		sys_language_id = CP_ACP;			//ANSI
}
开发者ID:william0wang,项目名称:meditor,代码行数:22,代码来源:shared.cpp

示例8: switch

int	MLocale::GetCharsetFromLang(LANGID langid)
{
	switch( PRIMARYLANGID(langid) )
	{
		case LANG_JAPANESE:
			return SHIFTJIS_CHARSET;
		case LANG_KOREAN:
			return HANGEUL_CHARSET;
		case LANG_CHINESE:
			switch( SUBLANGID(langid) )
			{
				case SUBLANG_CHINESE_SIMPLIFIED:
					return GB2312_CHARSET;
				case SUBLANG_CHINESE_TRADITIONAL:
					return CHINESEBIG5_CHARSET;
				default:
					return ANSI_CHARSET;
			}
		case LANG_GREEK:
			return GREEK_CHARSET;
		case LANG_TURKISH:
			return TURKISH_CHARSET;
		case LANG_HEBREW:
			return HEBREW_CHARSET;
		case LANG_ARABIC:
			return ARABIC_CHARSET;
		case LANG_ESTONIAN:
		case LANG_LATVIAN:
		case LANG_LITHUANIAN:
			return BALTIC_CHARSET;
		case LANG_THAI:
			return THAI_CHARSET;
		case LANG_CZECH:
		case LANG_HUNGARIAN:
		case LANG_POLISH:
		case LANG_PORTUGUESE:
		case LANG_CROATIAN:
		case LANG_MACEDONIAN:
		case LANG_ROMANIAN:
		case LANG_SLOVAK:
		case LANG_SLOVENIAN:
			return EASTEUROPE_CHARSET;
		case LANG_RUSSIAN:
		case LANG_BELARUSIAN:
		case LANG_BULGARIAN:
		case LANG_UKRAINIAN:
			return RUSSIAN_CHARSET;
		default:
			return ANSI_CHARSET;
	}
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:51,代码来源:MLocale.cpp

示例9: tstr_to_str

	int meshml_export::DoExport(TCHAR const * name, ExpInterface* /*exp_interface*/, Interface* max_interface,
							BOOL /*suppress_prompts*/, DWORD options)
	{
		file_name_ = tstr_to_str(name);

		max_interface_ = max_interface;

		export_nodes_.clear();
		if (options & SCENE_EXPORT_SELECTED)
		{
			int count = max_interface_->GetSelNodeCount();
			for (int i = 0; i < count; ++ i)
			{
				this->enum_node(max_interface_->GetSelNode(i));
			}
		}
		else
		{
			this->enum_node(this->max_interface_->GetRootNode());
		}

		DWORD dlg_id;
		WORD lang_id = MaxSDK::Util::GetLanguageID();
		if ((LANG_CHINESE == PRIMARYLANGID(lang_id)) && (SUBLANG_CHINESE_SIMPLIFIED == SUBLANGID(lang_id)))
		{
			dlg_id = IDD_MESHML_EXPORT_CHS;
			in_chs_ = true;
		}
		else
		{
			dlg_id = IDD_MESHML_EXPORT_EN;
			in_chs_ = false;
		}

		HWND max_wnd = max_interface->GetMAXHWnd();
		if (::DialogBoxParam(dll_instance, MAKEINTRESOURCE(dlg_id), max_wnd,
			export_wnd_proc, reinterpret_cast<LPARAM>(this)))
		{
			if (in_chs_)
			{
				::MessageBox(max_wnd, TEXT("导出成功!"), TEXT("MeshML导出插件"), MB_OK);
			}
			else
			{
				::MessageBox(max_wnd, TEXT("Export Successful!"), TEXT("MeshML Export"), MB_OK);
			}
		}

		return 1;
	}
开发者ID:BitYorkie,项目名称:KlayGE,代码行数:50,代码来源:meshml.cpp

示例10: get_system_language

	static std::wstring get_system_language()
	{
		LCID locale = GetUserDefaultLCID();
		wchar_t buffer[9];
		int length = ::GetLocaleInfoW(locale, LOCALE_SISO639LANGNAME, &buffer[0], _countof(buffer));
		if (length <= 1)
			return std::move(std::wstring());
		std::wstring res(buffer);
		if (SUBLANGID(locale) == SUBLANG_NEUTRAL)
			return std::move(language);
		length = ::GetLocaleInfoW(locale, LOCALE_SISO3166CTRYNAME, &buffer[0], _countof(buffer));
		if (length <= 1)
			return std::move(language);
		return std::move(res.append(1, '-').append(buffer));
	}
开发者ID:luciouskami,项目名称:YDWE,代码行数:15,代码来源:gettext.cpp

示例11: switch

//! note: this function can be extended to include other exotic cases as they arise.
// This function was added in response to bug [#25715]
// This is going to be a long list [T42426]
GHOST_TKey GHOST_SystemWin32::processSpecialKey(GHOST_IWindow *window, short vKey, short scanCode) const
{
	GHOST_TKey key = GHOST_kKeyUnknown;
	switch (PRIMARYLANGID(m_langId)) {
		case LANG_FRENCH:
			if (vKey == VK_OEM_8) key = GHOST_kKeyF13;  // oem key; used purely for shortcuts .
			break;
		case LANG_ENGLISH:
			if (SUBLANGID(m_langId) == SUBLANG_ENGLISH_UK && vKey == VK_OEM_8) // "`¬"
				key = GHOST_kKeyAccentGrave;
			break;
	}

	return key;
}
开发者ID:denvrnaicker,项目名称:blender-git,代码行数:18,代码来源:GHOST_SystemWin32.cpp

示例12: main

int main()
{
	LANGID langID;
	WORD primLang;
	WORD subLang;

	setlocale( LC_ALL, "" );

	langID = GetUserDefaultLangID();
	printf("langID=0x%x\n",langID);

	primLang = (WORD)(PRIMARYLANGID(langID));
	subLang = (WORD)(SUBLANGID(langID));

	printf("primLang=%d subLang=%d\n",(unsigned)primLang,(unsigned)subLang);

	return 0;
}
开发者ID:Bernieboy,项目名称:nds4ios,代码行数:18,代码来源:wine_GetXXXDefaultLangID.cpp

示例13: _tcscpy_s

HINSTANCE CLangDll::Init(LPCTSTR appname, unsigned long langID)
{
	TCHAR langpath[MAX_PATH] = {0};
	TCHAR langdllpath[MAX_PATH] = {0};
	TCHAR sVer[MAX_PATH] = {0};
	_tcscpy_s(sVer, MAX_PATH, _T(STRPRODUCTVER));
	GetModuleFileName(NULL, langpath, MAX_PATH);
	TCHAR * pSlash = _tcsrchr(langpath, '\\');
	if (pSlash)
	{
		*pSlash = 0;
		pSlash = _tcsrchr(langpath, '\\');
		if (pSlash)
		{
			*pSlash = 0;
			_tcscat_s(langpath, MAX_PATH, _T("\\Languages\\"));
			assert(m_hInstance == NULL);
			do
			{
				_stprintf_s(langdllpath, MAX_PATH, _T("%s%s%lu.dll"), langpath, appname, langID);

				m_hInstance = LoadLibrary(langdllpath);

				if (!DoVersionStringsMatch(sVer, langdllpath))
				{
					FreeLibrary(m_hInstance);
					m_hInstance = NULL;
				}
				if (m_hInstance == NULL)
				{
					DWORD lid = SUBLANGID(langID);
					lid--;
					if (lid > 0)
					{
						langID = MAKELANGID(PRIMARYLANGID(langID), lid);
					}
					else
						langID = 0;
				}
			} while ((m_hInstance == NULL) && (langID != 0));
		}
	}
	return m_hInstance;
}
开发者ID:iamduyu,项目名称:TortoiseGit,代码行数:44,代码来源:LangDll.cpp

示例14: FindLocaleDirectory

// FindLocaleDirectory:  Search the provided path for one of the expected code page subdirectories
// Returns empty string on failure, or the full path to the c:\my\directory\1033\myrcfile.dll
static MyString FindLocaleDirectory(const MyString &path, const MyString &dllName)
{
    // We'll be checking for 3 different locales:  The user's default locale
    // The user's primary language locale, and english (in that order)
    const LCID lcidUser = MAKELCID(GetUserDefaultUILanguage(), SORT_DEFAULT);
    LCID rglcid[3] = {lcidUser, MAKELCID(MAKELANGID(PRIMARYLANGID(lcidUser), SUBLANG_DEFAULT), SORTIDFROMLCID(lcidUser)), ENGLISH_LCID};

    for (int i = 0; i < _countof(rglcid); i++)
    {
        LCID lcid = rglcid[i];
        // Turn the LCID into a string
        wchar_t wzNumBuf[12];
        _itow_s(lcid, wzNumBuf, _countof(wzNumBuf), 10);
        MyString localePath = MakePath(path, wzNumBuf, dllName);

        // Check to see if the file exists
        if (FileExists(localePath))
        {
            // make sure the console can support a codepage for this language.
            UINT ConsoleCP = GetConsoleOutputCP();
            
            // Dev10 #843375: For a GUI application, GetConsoleOutputCP returns 0
            // If that's the case, we don't care about capabilities of the console, 
            // since we're not outputting to the console, anyway...
            if ( ConsoleCP != 0 && lcid != ENGLISH_LCID )
            {
                LANGID LanguageID = MAKELANGID( lcid, SUBLANGID(lcid) );
                // we know the console cannot support arabic or hebrew (right to left scripts?)
                if( PRIMARYLANGID(LanguageID) == LANG_ARABIC || PRIMARYLANGID(LanguageID) == LANG_HEBREW )
                    continue;

                UINT LangOEMCodepage = GetCodePage(LanguageID, LOCALE_IDEFAULTCODEPAGE);
                UINT LangANSICodepage = GetCodePage(LanguageID, LOCALE_IDEFAULTANSICODEPAGE);

                // We can only support it if the console's code page is UTF8, OEM, or ANSI
                if( ConsoleCP != CP_UTF8 && ConsoleCP != LangOEMCodepage && ConsoleCP != LangANSICodepage )
                    continue;
            }

            return localePath;
        }
    }
    return W("");
}
开发者ID:0-wiz-0,项目名称:coreclr,代码行数:46,代码来源:loadrc-impl.cpp

示例15: TRACE

int CMultiLanguage::PrintThreeLetterLanguageCodeList( void )
{
    LANGID  id[] =
    {
        0x0436,0x041c,0x0401,0x0801,0x0c01,0x1001,0x1401,0x1801,0x1c01,0x2001,0x2401,0x2801,
        0x2c01,0x3001,0x3401,0x3801,0x3c01,0x4001,0x042b,0x042c,0x082c,0x042d,0x0423,0x0445,
        0x141a,0x0402,0x0455,0x0403,0x0404,0x0804,0x0c04,0x1004,0x1404,0x041a,0x101a,0x0405,
        0x0406,0x0465,0x0413,0x0813,0x0409,0x0809,0x0c09,0x1009,0x1409,0x1809,0x1c09,0x2009,
        0x2409,0x2809,0x2c09,0x3009,0x3409,0x0425,0x0438,0x0429,0x040b,0x040c,0x080c,0x0c0c,
        0x100c,0x140c,0x180c,0x0456,0x0437,0x0407,0x0807,0x0c07,0x1007,0x1407,0x0408,0x0447,
        0x040d,0x0439,0x040e,0x040f,0x0421,0x0434,0x0435,0x0410,0x0810,0x0411,0x044b,0x0457,
        0x0412,0x0812,0x0440,0x0426,0x0427,0x0827,0x042f,0x043e,0x083e,0x044c,0x0481,0x043a,
        0x044e,0x0450,0x0414,0x0814,0x0415,0x0416,0x0816,0x0446,0x046b,0x086b,0x0c6b,0x0418,
        0x0419,0x044f,0x043b,0x083b,0x0c3b,0x103b,0x143b,0x183b,0x1c3b,0x203b,0x243b,0x0c1a,
        0x1c1a,0x081a,0x181a,0x046c,0x0432,0x041b,0x0424,0x040a,0x080a,0x0c0a,0x100a,0x140a,
        0x180a,0x1c0a,0x200a,0x240a,0x280a,0x2c0a,0x300a,0x340a,0x380a,0x3c0a,0x400a,0x440a,
        0x480a,0x4c0a,0x500a,0x0430,0x0441,0x041d,0x081d,0x045a,0x0449,0x0444,0x044a,0x041e,
        0x041f,0x0422,0x0420,0x0820,0x0443,0x0843,0x042a,0x0452
    };

    LCID    lcid, lcidMain;
    int     nResult;
    TCHAR   szLangCode[4];
    TCHAR   szLangCodeMain[4];

    TRACE(_T("Identifier\tThree-letter Abbrev. lang. Name\n"));
    for ( int i=0; i< sizeof(id)/sizeof(id[0]); i++ )
    {
        lcid = MAKELCID( id[i], SORT_DEFAULT );
        LANGID langid = id[i];      // Without sub language
        int nPrimaryLang = PRIMARYLANGID(langid);
        int nSubLang = SUBLANGID(langid);
        lcidMain = MAKELCID(MAKELANGID(nPrimaryLang, SUBLANG_NEUTRAL), SORT_DEFAULT);
        lstrcpy(szLangCode, _T("==="));
        lstrcpy(szLangCodeMain, _T("==="));
        nResult = ::GetLocaleInfo(lcid, LOCALE_SABBREVLANGNAME, szLangCode, 4);
        nResult = ::GetLocaleInfo(lcidMain, LOCALE_SABBREVLANGNAME, szLangCodeMain, 4);
        TRACE(_T("0x%04X,\t%s,\t%s\n"), lcid, szLangCode, szLangCodeMain );
    }
    return 0;
}
开发者ID:ArunMaiya,项目名称:busmaster,代码行数:41,代码来源:MultiLanguage.cpp


注:本文中的SUBLANGID函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。