| 110 | } |
| 111 | |
| 112 | std::thread Localization::ShowLocalizedMessageBox(uint16_t resource, UINT type, HINSTANCE hInst, WORD lang) |
| 113 | { |
| 114 | const auto msg = LoadLocalizedResourceString(resource, hInst, lang); |
| 115 | |
| 116 | // attempt to find out if the target locale is RTL |
| 117 | DWORD readingLayout = 0; |
| 118 | if (GetLocaleInfo(lang, LOCALE_IREADINGLAYOUT | LOCALE_RETURN_NUMBER, reinterpret_cast<LPWSTR>(&readingLayout), sizeof(readingLayout))) |
| 119 | { |
| 120 | // 1 == RTL, https://learn.microsoft.com/en-us/windows/win32/intl/locale-ireadinglayout |
| 121 | if (readingLayout == 1) |
| 122 | { |
| 123 | type |= MB_RTLREADING | MB_RIGHT; |
| 124 | } |
| 125 | } |
| 126 | else |
| 127 | { |
| 128 | LastErrorHandle(spdlog::level::warn, L"Failed to get locale info"); |
| 129 | } |
| 130 | |
| 131 | return std::thread([msg, type, lang]() noexcept |
| 132 | { |
| 133 | MessageBoxEx(Window::NullWindow, msg.c_str(), APP_NAME, type, lang); |
| 134 | }); |
| 135 | } |