diff --git a/src/Cafe/Filesystem/FST/KeyCache.cpp b/src/Cafe/Filesystem/FST/KeyCache.cpp index 4235877d..6699f49b 100644 --- a/src/Cafe/Filesystem/FST/KeyCache.cpp +++ b/src/Cafe/Filesystem/FST/KeyCache.cpp @@ -108,7 +108,7 @@ void KeyCache_Prepare() continue; if( strishex(line) == false ) { - auto errorMsg = fmt::format(fmt::runtime(_tr("Error in keys.txt at line {}")), lineNumber); + auto errorMsg = _tr("Error in keys.txt at line {}", lineNumber); WindowSystem::showErrorDialog(errorMsg, WindowSystem::ErrorCategory::KEYS_TXT_CREATION); continue; } diff --git a/src/Cafe/GraphicPack/GraphicPack2Patches.cpp b/src/Cafe/GraphicPack/GraphicPack2Patches.cpp index 0838b1b5..3236341a 100644 --- a/src/Cafe/GraphicPack/GraphicPack2Patches.cpp +++ b/src/Cafe/GraphicPack/GraphicPack2Patches.cpp @@ -43,9 +43,9 @@ void PatchErrorHandler::showStageErrorMessageBox() if (m_gp) { if (m_stage == STAGE::PARSER) - errorMsg.assign(fmt::format(fmt::runtime(_tr("Failed to load patches for graphic pack \'{}\'")), m_gp->GetName())); + errorMsg.assign(_tr("Failed to load patches for graphic pack \'{}\'", m_gp->GetName())); else - errorMsg.assign(fmt::format(fmt::runtime(_tr("Failed to apply patches for graphic pack \'{}\'")), m_gp->GetName())); + errorMsg.assign(_tr("Failed to apply patches for graphic pack \'{}\'", m_gp->GetName())); } else { diff --git a/src/Cafe/HW/MMU/MMU.cpp b/src/Cafe/HW/MMU/MMU.cpp index 99c3185d..02a9003b 100644 --- a/src/Cafe/HW/MMU/MMU.cpp +++ b/src/Cafe/HW/MMU/MMU.cpp @@ -91,7 +91,7 @@ void MMURange::mapMem() cemu_assert_debug(!m_isMapped); if (MemMapper::AllocateMemory(memory_base + baseAddress, size, MemMapper::PAGE_PERMISSION::P_RW, true) == nullptr) { - std::string errorMsg = fmt::format(fmt::runtime(_tr("Unable to allocate {} memory")), name); + std::string errorMsg = _tr("Unable to allocate {} memory", name); WindowSystem::showErrorDialog(errorMsg, _tr("Error")); #if BOOST_OS_WINDOWS ExitProcess(-1); diff --git a/src/Common/precompiled.h b/src/Common/precompiled.h index d4db9d84..2d3f7e2a 100644 --- a/src/Common/precompiled.h +++ b/src/Common/precompiled.h @@ -132,12 +132,24 @@ inline void SetTranslationCallback(std::function #define TR_NOOP(str) str -inline std::string _tr(std::string_view msgId) +inline std::string _tr(std::string_view text) { if (g_translate) - return g_translate(msgId); + return g_translate(text); - return std::string{msgId}; + return std::string{text}; +} + +template +inline std::string _tr(fmt::format_string text, TArgs... args) +{ + if (g_translate) + { + std::string_view textSV{text.get().data(), text.get().size()}; + return fmt::format(fmt::runtime(g_translate(textSV)), std::forward(args)...); + } + + return fmt::format(text, std::forward(args)...); } // manual endian-swapping diff --git a/src/gui/wxgui/input/HotkeySettings.h b/src/gui/wxgui/input/HotkeySettings.h index 77478ea9..f418a930 100644 --- a/src/gui/wxgui/input/HotkeySettings.h +++ b/src/gui/wxgui/input/HotkeySettings.h @@ -30,7 +30,7 @@ private: wxTimer* m_controllerTimer{ nullptr }; const wxSize m_minButtonSize{ 250, 45 }; const wxString m_disabledHotkeyText{ _("----") }; - const wxString m_editModeHotkeyText{ _("") }; + const wxString m_editModeHotkeyText{ "" }; std::vector m_hotkeys; std::weak_ptr m_activeController{};