mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-07-11 10:09:27 +00:00
Add StringTableNameMap.h with 2312 name-to-ID entries for static mode fallback
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
#include "..\Common\Consoles_App.h"
|
||||
#include "StringTable.h"
|
||||
#include "Windows64_App.h"
|
||||
#include "..\Assets\Localisation\strings.h"
|
||||
#include "StringTableNameMap.h"
|
||||
|
||||
SystemInterface_Win64::SystemInterface_Win64()
|
||||
{
|
||||
@@ -42,20 +44,24 @@ 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);
|
||||
// Convert UTF-8 key to wide string for StringTable lookup
|
||||
int wlen = MultiByteToWideChar(CP_UTF8, 0, key.c_str(), (int)key.size(), nullptr, 0);
|
||||
if (wlen > 0)
|
||||
{
|
||||
std::wstring wkey(wlen, L'\0');
|
||||
MultiByteToWideChar(CP_UTF8, 0, key.c_str(), (int)key.size(), &wkey[0], wlen);
|
||||
LPCWSTR wstr = st->getString(wkey);
|
||||
if (!wstr || wcslen(wstr) == 0)
|
||||
{
|
||||
int id = GetStringIDByName(wkey);
|
||||
if (id >= 0)
|
||||
wstr = st->getString(id);
|
||||
}
|
||||
if (wstr && wcslen(wstr) > 0)
|
||||
{
|
||||
// Convert wide result back to UTF-8
|
||||
int utf8len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, nullptr, 0, nullptr, nullptr);
|
||||
if (utf8len > 0)
|
||||
{
|
||||
std::string utf8(utf8len - 1, '\0'); // -1 for null terminator
|
||||
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