diff --git a/include/wx/translation.h b/include/wx/translation.h index aaa55571d4..8f465279c7 100644 --- a/include/wx/translation.h +++ b/include/wx/translation.h @@ -62,10 +62,10 @@ using wxTranslationsHashMap = std::unordered_map; wxGetTranslation((s), wxString(), c) #else #define wxGETTEXT_IN_CONTEXT(c, s) \ - wxGetTranslation(wxASCII_STR(s), wxString(), c) + wxGetTranslation(wxASCII_STR(s), wxString(), wxASCII_STR(c)) #endif #define wxGETTEXT_IN_CONTEXT_PLURAL(c, sing, plur, n) \ - wxGetTranslation((sing), (plur), n, wxString(), c) + wxGetTranslation(wxASCII_STR(sing), wxASCII_STR(plur), n, wxString(), wxASCII_STR(c)) // another one which just marks the strings for extraction, but doesn't // perform the translation (use -kwxTRANSLATE with xgettext!) diff --git a/tests/allheaders.cpp b/tests/allheaders.cpp index 5b5527f455..b59e4cd91f 100644 --- a/tests/allheaders.cpp +++ b/tests/allheaders.cpp @@ -413,4 +413,12 @@ TEST_CASE("wxNO_IMPLICIT_WXSTRING_ENCODING", "[string]") #endif wxLogSysError(wxASCII_STR("Bogus error for testing")); + + // Check that all translation macros expand to compilable + // code also when wxNO_IMPLICIT_WXSTRING_ENCODING is enabled. + + _("some text"); + wxPLURAL("singular", "plural", 2); + wxGETTEXT_IN_CONTEXT("context", "text"); + wxGETTEXT_IN_CONTEXT_PLURAL("context", "singular", "plural", 3); }