mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-07-18 02:30:50 +00:00
Fixes and implement WideToUtf8 and Utf8ToWide from Minecraft.Server
* MessageBox now uses WideToUtf8. This fixes RUS and ES languages. * Fixed OnButtonClicked.
This commit is contained in:
@@ -38,19 +38,15 @@ int SystemInterface_Win64::TranslateString(Rml::String& translated, const Rml::S
|
||||
if (end != Rml::String::npos)
|
||||
{
|
||||
Rml::String key = input.substr(i + 1, end - i - 1);
|
||||
int wlen = MultiByteToWideChar(CP_UTF8, 0, key.c_str(), (int)key.size(), nullptr, 0);
|
||||
if (wlen > 0)
|
||||
std::wstring wkey = utils.Utf8ToWide(key);
|
||||
if (!wkey.empty())
|
||||
{
|
||||
std::wstring wkey(wlen, L'\0');
|
||||
MultiByteToWideChar(CP_UTF8, 0, key.c_str(), (int)key.size(), &wkey[0], wlen);
|
||||
LPCWSTR wstr = app.GetString(wkey);
|
||||
if (wstr && wcslen(wstr) > 0)
|
||||
{
|
||||
int utf8len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, nullptr, 0, nullptr, nullptr);
|
||||
if (utf8len > 0)
|
||||
std::string utf8 = utils.WideToUtf8(wstr);
|
||||
if (!utf8.empty())
|
||||
{
|
||||
std::string utf8(utf8len - 1, '\0');
|
||||
WideCharToMultiByte(CP_UTF8, 0, wstr, -1, &utf8[0], utf8len, nullptr, nullptr);
|
||||
result += utf8;
|
||||
count++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user