Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVojtech Kral <vojtech@kral.hk>2019-01-22 19:52:14 +0300
committerVojtech Kral <vojtech@kral.hk>2019-01-23 11:52:34 +0300
commitfde299bf808347aa1748b503c71039bce9ee5e5d (patch)
tree329042a809f7b15a4fa961edbcb16ff972e5fadb /src/slic3r/GUI/I18N.hpp
parent78a9e6036ac767fa3772bf1d81b843ec88b48b19 (diff)
I18N: wx 3.0 back-compat for translations with context, fix #1694
Diffstat (limited to 'src/slic3r/GUI/I18N.hpp')
-rw-r--r--src/slic3r/GUI/I18N.hpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/slic3r/GUI/I18N.hpp b/src/slic3r/GUI/I18N.hpp
index c86ff7501..a899eaa59 100644
--- a/src/slic3r/GUI/I18N.hpp
+++ b/src/slic3r/GUI/I18N.hpp
@@ -2,6 +2,10 @@
#define _(s) Slic3r::GUI::I18N::translate((s))
#endif /* _ */
+#ifndef _CTX
+#define _CTX(s, ctx) Slic3r::GUI::I18N::translate((s), (ctx))
+#endif /* _ */
+
#ifndef L
// !!! If you needed to translate some wxString,
// !!! please use _(L(string))
@@ -21,6 +25,7 @@
#define slic3r_GUI_I18N_hpp_
#include <wx/intl.h>
+#include <wx/version.h>
namespace Slic3r { namespace GUI {
@@ -29,7 +34,20 @@ namespace I18N {
inline wxString translate(const wchar_t *s) { return wxGetTranslation(s); }
inline wxString translate(const std::string &s) { return wxGetTranslation(wxString(s.c_str(), wxConvUTF8)); }
inline wxString translate(const std::wstring &s) { return wxGetTranslation(s.c_str()); }
-}
+
+#if wxCHECK_VERSION(3, 1, 1)
+ #define _wxGetTranslation_ctx(S, CTX) wxGetTranslation((S), wxEmptyString, (CTX))
+#else
+ #define _wxGetTranslation_ctx(S, CTX) ((void)(CTX), wxGetTranslation((S)))
+#endif
+
+ inline wxString translate(const char *s, const char* ctx) { return _wxGetTranslation_ctx(wxString(s, wxConvUTF8), ctx); }
+ inline wxString translate(const wchar_t *s, const char* ctx) { return _wxGetTranslation_ctx(s, ctx); }
+ inline wxString translate(const std::string &s, const char* ctx) { return _wxGetTranslation_ctx(wxString(s.c_str(), wxConvUTF8), ctx); }
+ inline wxString translate(const std::wstring &s, const char* ctx) { return _wxGetTranslation_ctx(s.c_str(), ctx); }
+
+#undef _wxGetTranslation_ctx
+}
// Return translated std::string as a wxString
wxString L_str(const std::string &str);