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

@ -56,7 +56,7 @@
#include "../Utils/PresetUpdater.hpp"
#include "../Config/Snapshot.hpp"
#include "libslic3r/I18N.hpp"
namespace Slic3r { namespace GUI {
@ -149,9 +149,13 @@ void update_label_colours_from_appconfig()
}
}
static std::string libslic3r_translate_callback(const char *s) { return wxGetTranslation(wxString(s, wxConvUTF8)); }
void set_wxapp(wxApp *app)
{
g_wxApp = app;
// Let the libslic3r know the callback, which will translate messages on demand.
Slic3r::I18N::set_translate_callback(libslic3r_translate_callback);
init_label_colours();
}