Provide a callback to libslic3r to translate texts.

Moved the "translate" functions to namespaces to avoid clashes
between the code in libslic3r and Slic3r GUI projects.
This commit is contained in:
bubnikv 2018-06-20 18:33:46 +02:00
parent 6b2b970b9a
commit 02d4f3e14d
6 changed files with 23 additions and 13 deletions

View file

@ -33,11 +33,14 @@ class PresetUpdater;
class DynamicPrintConfig;
class TabIface;
#define _(s) Slic3r::translate((s))
inline wxString translate(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)); }
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()); }
#define _(s) Slic3r::GUI::I18N::translate((s))
namespace GUI { namespace I18N {
inline wxString translate(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)); }
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 you needed to translate some wxString,
// !!! please use _(L(string))