PrusaSlicer-NonPlainar/src/slic3r/GUI/I18N.hpp

40 lines
1.3 KiB
C++
Raw Normal View History

#ifndef _
#define _(s) Slic3r::GUI::I18N::translate((s))
#endif /* _ */
#ifndef L
// !!! If you needed to translate some wxString,
// !!! please use _(L(string))
// !!! _() - is a standard wxWidgets macro to translate
// !!! L() is used only for marking localizable string
// !!! It will be used in "xgettext" to create a Locating Message Catalog.
#define L(s) s
#endif /* L */
#ifndef _CHB
//! macro used to localization, return wxScopedCharBuffer
//! With wxConvUTF8 explicitly specify that the source string is already in UTF-8 encoding
#define _CHB(s) wxGetTranslation(wxString(s, wxConvUTF8)).utf8_str()
#endif /* _CHB */
#ifndef slic3r_GUI_I18N_hpp_
#define slic3r_GUI_I18N_hpp_
#include <wx/intl.h>
namespace Slic3r { 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()); }
}
// Return translated std::string as a wxString
wxString L_str(const std::string &str);
} }
#endif /* slic3r_GUI_I18N_hpp_ */