mlang: Implement LcidToRfc1766 and GetRfc1766FromLcid.
This commit is contained in:
parent
884e7eed4a
commit
ff90dbc086
|
@ -5,6 +5,7 @@ VPATH = @srcdir@
|
||||||
MODULE = mlang.dll
|
MODULE = mlang.dll
|
||||||
IMPORTLIB = libmlang.$(IMPLIBEXT)
|
IMPORTLIB = libmlang.$(IMPLIBEXT)
|
||||||
IMPORTS = ole32 user32 gdi32 advapi32 kernel32 ntdll
|
IMPORTS = ole32 user32 gdi32 advapi32 kernel32 ntdll
|
||||||
|
DELAYIMPORTS = oleaut32
|
||||||
EXTRALIBS = -luuid
|
EXTRALIBS = -luuid
|
||||||
EXTRADEFS = -DCOM_NO_WINDOWS_H
|
EXTRADEFS = -DCOM_NO_WINDOWS_H
|
||||||
|
|
||||||
|
|
|
@ -654,21 +654,55 @@ HRESULT WINAPI IsConvertINetStringAvailable(
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline INT lcid_to_rfc1766A( LCID lcid, LPSTR rfc1766, INT len )
|
||||||
|
{
|
||||||
|
INT n = GetLocaleInfoA( lcid, LOCALE_SISO639LANGNAME, rfc1766, len );
|
||||||
|
if (n)
|
||||||
|
{
|
||||||
|
rfc1766[n - 1] = '-';
|
||||||
|
n += GetLocaleInfoA( lcid, LOCALE_SISO3166CTRYNAME, rfc1766 + n, len - n ) + 1;
|
||||||
|
LCMapStringA( LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, rfc1766, n, rfc1766, len );
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline INT lcid_to_rfc1766W( LCID lcid, LPWSTR rfc1766, INT len )
|
||||||
|
{
|
||||||
|
INT n = GetLocaleInfoW( lcid, LOCALE_SISO639LANGNAME, rfc1766, len );
|
||||||
|
if (n)
|
||||||
|
{
|
||||||
|
rfc1766[n - 1] = '-';
|
||||||
|
n += GetLocaleInfoW( lcid, LOCALE_SISO3166CTRYNAME, rfc1766 + n, len - n ) + 1;
|
||||||
|
LCMapStringW( LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, rfc1766, n, rfc1766, len );
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT WINAPI LcidToRfc1766A(
|
HRESULT WINAPI LcidToRfc1766A(
|
||||||
LCID Locale,
|
LCID lcid,
|
||||||
LPSTR pszRfc1766,
|
LPSTR pszRfc1766,
|
||||||
INT nChar)
|
INT nChar)
|
||||||
{
|
{
|
||||||
FIXME("%d %s %u\n", Locale, pszRfc1766, nChar);
|
TRACE("%04x %p %u\n", lcid, pszRfc1766, nChar);
|
||||||
|
|
||||||
|
if (lcid_to_rfc1766A( lcid, pszRfc1766, nChar ))
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI LcidToRfc1766W(
|
HRESULT WINAPI LcidToRfc1766W(
|
||||||
LCID Locale,
|
LCID lcid,
|
||||||
LPWSTR pszRfc1766,
|
LPWSTR pszRfc1766,
|
||||||
INT nChar)
|
INT nChar)
|
||||||
{
|
{
|
||||||
FIXME("%d %p %u\n", Locale, pszRfc1766, nChar);
|
TRACE("%04x %p %u\n", lcid, pszRfc1766, nChar);
|
||||||
|
|
||||||
|
if (lcid_to_rfc1766W( lcid, pszRfc1766, nChar ))
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1552,11 +1586,19 @@ static HRESULT WINAPI fnIMultiLanguage_ConvertStringReset(
|
||||||
|
|
||||||
static HRESULT WINAPI fnIMultiLanguage_GetRfc1766FromLcid(
|
static HRESULT WINAPI fnIMultiLanguage_GetRfc1766FromLcid(
|
||||||
IMultiLanguage* iface,
|
IMultiLanguage* iface,
|
||||||
LCID Locale,
|
LCID lcid,
|
||||||
BSTR* pbstrRfc1766)
|
BSTR* pbstrRfc1766)
|
||||||
{
|
{
|
||||||
FIXME("\n");
|
WCHAR buf[MAX_RFC1766_NAME];
|
||||||
return E_NOTIMPL;
|
|
||||||
|
TRACE("%p %04x %p\n", iface, lcid, pbstrRfc1766);
|
||||||
|
|
||||||
|
if (lcid_to_rfc1766W( lcid, buf, MAX_RFC1766_NAME ))
|
||||||
|
{
|
||||||
|
*pbstrRfc1766 = SysAllocString( buf );
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI fnIMultiLanguage_GetLcidFromRfc1766(
|
static HRESULT WINAPI fnIMultiLanguage_GetLcidFromRfc1766(
|
||||||
|
@ -1709,7 +1751,6 @@ struct enum_locales_data
|
||||||
|
|
||||||
static BOOL CALLBACK enum_locales_proc(LPWSTR locale)
|
static BOOL CALLBACK enum_locales_proc(LPWSTR locale)
|
||||||
{
|
{
|
||||||
DWORD n;
|
|
||||||
WCHAR *end;
|
WCHAR *end;
|
||||||
struct enum_locales_data *data = TlsGetValue(MLANG_tls_index);
|
struct enum_locales_data *data = TlsGetValue(MLANG_tls_index);
|
||||||
RFC1766INFO *info;
|
RFC1766INFO *info;
|
||||||
|
@ -1730,13 +1771,8 @@ static BOOL CALLBACK enum_locales_proc(LPWSTR locale)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
info->wszRfc1766[0] = 0;
|
info->wszRfc1766[0] = 0;
|
||||||
n = GetLocaleInfoW(info->lcid, LOCALE_SISO639LANGNAME, info->wszRfc1766, MAX_RFC1766_NAME);
|
lcid_to_rfc1766W( info->lcid, info->wszRfc1766, MAX_RFC1766_NAME );
|
||||||
if (n && n < MAX_RFC1766_NAME)
|
|
||||||
{
|
|
||||||
info->wszRfc1766[n - 1] = '-';
|
|
||||||
GetLocaleInfoW(info->lcid, LOCALE_SISO3166CTRYNAME, info->wszRfc1766 + n, MAX_RFC1766_NAME - n);
|
|
||||||
LCMapStringW(LOCALE_USER_DEFAULT, LCMAP_LOWERCASE, info->wszRfc1766 + n, -1, info->wszRfc1766 + n, MAX_RFC1766_NAME - n);
|
|
||||||
}
|
|
||||||
info->wszLocaleName[0] = 0;
|
info->wszLocaleName[0] = 0;
|
||||||
GetLocaleInfoW(info->lcid, LOCALE_SLANGUAGE, info->wszLocaleName, MAX_LOCALE_NAME);
|
GetLocaleInfoW(info->lcid, LOCALE_SLANGUAGE, info->wszLocaleName, MAX_LOCALE_NAME);
|
||||||
TRACE("ISO639: %s SLANGUAGE: %s\n", wine_dbgstr_w(info->wszRfc1766), wine_dbgstr_w(info->wszLocaleName));
|
TRACE("ISO639: %s SLANGUAGE: %s\n", wine_dbgstr_w(info->wszRfc1766), wine_dbgstr_w(info->wszLocaleName));
|
||||||
|
@ -2066,11 +2102,19 @@ static HRESULT WINAPI fnIMultiLanguage2_ConvertStringReset(
|
||||||
|
|
||||||
static HRESULT WINAPI fnIMultiLanguage2_GetRfc1766FromLcid(
|
static HRESULT WINAPI fnIMultiLanguage2_GetRfc1766FromLcid(
|
||||||
IMultiLanguage3* iface,
|
IMultiLanguage3* iface,
|
||||||
LCID Locale,
|
LCID lcid,
|
||||||
BSTR* pbstrRfc1766)
|
BSTR* pbstrRfc1766)
|
||||||
{
|
{
|
||||||
FIXME("\n");
|
WCHAR buf[MAX_RFC1766_NAME];
|
||||||
return E_NOTIMPL;
|
|
||||||
|
TRACE("%p %04x %p\n", iface, lcid, pbstrRfc1766);
|
||||||
|
|
||||||
|
if (lcid_to_rfc1766W( lcid, buf, MAX_RFC1766_NAME ))
|
||||||
|
{
|
||||||
|
*pbstrRfc1766 = SysAllocString( buf );
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI fnIMultiLanguage2_GetLcidFromRfc1766(
|
static HRESULT WINAPI fnIMultiLanguage2_GetLcidFromRfc1766(
|
||||||
|
|
|
@ -33,12 +33,14 @@
|
||||||
#define CP_UNICODE 1200
|
#define CP_UNICODE 1200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*#define DUMP_CP_INFO*/
|
#if 0
|
||||||
/*#define DUMP_SCRIPT_INFO*/
|
#define DUMP_CP_INFO
|
||||||
|
#define DUMP_SCRIPT_INFO
|
||||||
|
|
||||||
#if defined DUMP_CP_INFO || defined DUMP_SCRIPT_INFO
|
#if defined DUMP_CP_INFO || defined DUMP_SCRIPT_INFO
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* 0 */
|
||||||
|
|
||||||
#define TRACE_2 OutputDebugStringA
|
#define TRACE_2 OutputDebugStringA
|
||||||
|
|
||||||
|
@ -314,8 +316,8 @@ static void test_EnumCodePages(IMultiLanguage2 *iML2, DWORD flags)
|
||||||
static const WCHAR autoW[] = {'_','a','u','t','o',0};
|
static const WCHAR autoW[] = {'_','a','u','t','o',0};
|
||||||
|
|
||||||
#ifdef DUMP_CP_INFO
|
#ifdef DUMP_CP_INFO
|
||||||
trace("MIMECPINFO #%lu:\n"
|
trace("MIMECPINFO #%u:\n"
|
||||||
"dwFlags %08lx %s\n"
|
"dwFlags %08x %s\n"
|
||||||
"uiCodePage %u\n"
|
"uiCodePage %u\n"
|
||||||
"uiFamilyCodePage %u\n"
|
"uiFamilyCodePage %u\n"
|
||||||
"wszDescription %s\n"
|
"wszDescription %s\n"
|
||||||
|
@ -554,7 +556,7 @@ static void test_EnumScripts(IMultiLanguage2 *iML2, DWORD flags)
|
||||||
{
|
{
|
||||||
CPINFOEXA cpinfoex;
|
CPINFOEXA cpinfoex;
|
||||||
#ifdef DUMP_SCRIPT_INFO
|
#ifdef DUMP_SCRIPT_INFO
|
||||||
trace("SCRIPTINFO #%lu:\n"
|
trace("SCRIPTINFO #%u:\n"
|
||||||
"ScriptId %08x\n"
|
"ScriptId %08x\n"
|
||||||
"uiCodePage %u\n"
|
"uiCodePage %u\n"
|
||||||
"wszDescription %s\n"
|
"wszDescription %s\n"
|
||||||
|
@ -657,7 +659,7 @@ static void test_rfc1766(IMultiLanguage2 *iML2)
|
||||||
if (ret != S_OK) break;
|
if (ret != S_OK) break;
|
||||||
|
|
||||||
#ifdef DUMP_CP_INFO
|
#ifdef DUMP_CP_INFO
|
||||||
trace("lcid %04lx rfc_name %s locale_name %s\n",
|
trace("lcid %04x rfc_name %s locale_name %s\n",
|
||||||
info.lcid, wine_dbgstr_w(info.wszRfc1766), wine_dbgstr_w(info.wszLocaleName));
|
info.lcid, wine_dbgstr_w(info.wszRfc1766), wine_dbgstr_w(info.wszLocaleName));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue