diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp index 6707dc0ed..bae60e47f 100644 --- a/src/slic3r/GUI/PrintHostDialogs.cpp +++ b/src/slic3r/GUI/PrintHostDialogs.cpp @@ -269,7 +269,7 @@ void PrintHostQueueDialog::on_error(Event &evt) set_state(evt.job_id, ST_ERROR); - auto errormsg = wxString::Format("%s\n%s", _(L("Error uploading to print host:")), evt.error); + auto errormsg = from_u8((boost::format("%1%\n%2%") % _utf8(L("Error uploading to print host:")) % std::string(evt.error.ToUTF8())).str()); job_list->SetValue(wxVariant(0), evt.job_id, COL_PROGRESS); job_list->SetValue(wxVariant(errormsg), evt.job_id, COL_ERRORMSG); // Stashes the error message into a hidden column for later diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index bb81b56c0..4707f0f06 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -1470,9 +1470,10 @@ void Selection::toggle_instance_printable_state() ModelInstance* instance = model_object->instances[instance_idx]; const bool printable = !instance->printable; - wxString snapshot_text = model_object->instances.size() == 1 ? wxString::Format("%s %s", - printable ? _(L("Set Printable")) : _(L("Set Unprintable")), model_object->name) : - printable ? _(L("Set Printable Instance")) : _(L("Set Unprintable Instance")); + wxString snapshot_text = model_object->instances.size() == 1 ? wxString::FromUTF8((boost::format("%1% %2%") + % (printable ? _utf8(L("Set Printable")) : _utf8(L("Set Unprintable"))) + % model_object->name).str()) : + (printable ? _(L("Set Printable Instance")) : _(L("Set Unprintable Instance"))); wxGetApp().plater()->take_snapshot(snapshot_text); instance->printable = printable; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index ac141caa4..1033ffac4 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -130,7 +130,7 @@ void Tab::create_preset_tab() add_scaled_button(panel, &m_btn_hide_incompatible_presets, m_bmp_hide_incompatible_presets.name()); // TRN "Save current Settings" - m_btn_save_preset->SetToolTip(wxString::Format(_(L("Save current %s")),m_title)); + m_btn_save_preset->SetToolTip(from_u8((boost::format(_utf8(L("Save current %s"))) % m_title).str())); m_btn_delete_preset->SetToolTip(_(L("Delete this preset"))); m_btn_delete_preset->Disable(); @@ -956,8 +956,8 @@ void Tab::update_preset_description_line() } else if (parent == nullptr) { description_line = _(L("Current preset is inherited from the default preset.")); } else { - description_line = wxString::Format( - _(L("Current preset is inherited from:\n\t%s")), GUI::from_u8(parent->name)); + description_line = from_u8((boost::format( + _utf8(L("Current preset is inherited from:\n\t%s"))) % parent->name).str()); } if (preset.is_default || preset.is_system) @@ -1683,8 +1683,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup) btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) { std::unique_ptr host(PrintHost::get_print_host(m_config)); if (! host) { - const auto text = wxString::Format("%s", - _(L("Could not get a valid Printer Host reference"))); + const wxString text = _(L("Could not get a valid Printer Host reference")); show_error(this, text); return; } @@ -1753,11 +1752,11 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup) line.full_width = 1; line.widget = [this, ca_file_hint] (wxWindow* parent) { - auto txt = new wxStaticText(parent, wxID_ANY, wxString::Format("%s\n\n\t%s", - wxString::Format(_(L("HTTPS CA File:\n\ + auto txt = new wxStaticText(parent, wxID_ANY, from_u8((boost::format("%1%\n\n\t%2%") + % (boost::format(_utf8(L("HTTPS CA File:\n\ \tOn this system, %s uses HTTPS certificates from the system Certificate Store or Keychain.\n\ - \tTo use a custom CA file, please import your CA file into Certificate Store / Keychain.")), SLIC3R_APP_NAME), - ca_file_hint)); + \tTo use a custom CA file, please import your CA file into Certificate Store / Keychain."))) % SLIC3R_APP_NAME).str() + % std::string(ca_file_hint.ToUTF8())).str())); txt->SetFont(Slic3r::GUI::wxGetApp().normal_font()); auto sizer = new wxBoxSizer(wxHORIZONTAL); sizer->Add(txt); @@ -2916,8 +2915,8 @@ bool Tab::may_discard_current_dirty_preset(PresetCollection* presets /*= nullptr std::string type_name = presets->name(); wxString tab = " "; wxString name = old_preset.is_default ? - wxString::Format(_(L("Default preset (%s)")), _(type_name)) : - wxString::Format(_(L("Preset (%s)")), _(type_name)) + "\n" + tab + old_preset.name; + from_u8((boost::format(_utf8(L("Default preset (%s)"))) % _utf8(type_name)).str()) : + from_u8((boost::format(_utf8(L("Preset (%s)"))) % _utf8(type_name)).str()) + "\n" + tab + old_preset.name; // Collect descriptions of the dirty options. wxString changes; @@ -3173,7 +3172,7 @@ wxSizer* Tab::compatible_widget_create(wxWindow* parent, PresetDependencies &dep { deps.checkbox = new wxCheckBox(parent, wxID_ANY, _(L("All"))); deps.checkbox->SetFont(Slic3r::GUI::wxGetApp().normal_font()); - add_scaled_button(parent, &deps.btn, "printer_white", wxString::Format(" %s %s", _(L("Set")), dots), wxBU_LEFT | wxBU_EXACTFIT); + add_scaled_button(parent, &deps.btn, "printer_white", from_u8((boost::format(" %s %s") % _utf8(L("Set")) % std::string(dots.ToUTF8())).str()), wxBU_LEFT | wxBU_EXACTFIT); deps.btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); auto sizer = new wxBoxSizer(wxHORIZONTAL); @@ -3414,7 +3413,7 @@ ConfigOptionsGroupShp Page::new_optgroup(const wxString& title, int noncommon_la void SavePresetWindow::build(const wxString& title, const std::string& default_name, std::vector &values) { // TRN Preset - auto text = new wxStaticText(this, wxID_ANY, wxString::Format(_(L("Save %s as:")), title), + auto text = new wxStaticText(this, wxID_ANY, from_u8((boost::format(_utf8(L("Save %s as:"))) % title).str()), wxDefaultPosition, wxDefaultSize); m_combo = new wxComboBox(this, wxID_ANY, from_u8(default_name), wxDefaultPosition, wxDefaultSize, 0, 0, wxTE_PROCESS_ENTER); diff --git a/src/slic3r/GUI/UpdateDialogs.cpp b/src/slic3r/GUI/UpdateDialogs.cpp index 9619846da..b3b35d68d 100644 --- a/src/slic3r/GUI/UpdateDialogs.cpp +++ b/src/slic3r/GUI/UpdateDialogs.cpp @@ -265,8 +265,8 @@ MsgDataIncompatible::~MsgDataIncompatible() {} MsgDataLegacy::MsgDataLegacy() : MsgDialog(nullptr, _(L("Configuration update")), _(L("Configuration update"))) { - auto *text = new wxStaticText(this, wxID_ANY, wxString::Format( - _(L( + auto *text = new wxStaticText(this, wxID_ANY, from_u8((boost::format( + _utf8(L( "%s now uses an updated configuration structure.\n\n" "So called 'System presets' have been introduced, which hold the built-in default settings for various " @@ -276,8 +276,9 @@ MsgDataLegacy::MsgDataLegacy() : "Please proceed with the %s that follows to set up the new presets " "and to choose whether to enable automatic preset updates." - )), - SLIC3R_APP_NAME, _(ConfigWizard::name()) + ))) + % SLIC3R_APP_NAME + % _utf8(ConfigWizard::name())).str() )); text->Wrap(CONTENT_WIDTH * wxGetApp().em_unit()); content_sizer->Add(text); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index d3d9e61a2..713cd187f 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -603,7 +603,9 @@ void apply_extruder_selector(wxBitmapComboBox** ctrl, ++i; } - (*ctrl)->Append(use_full_item_name ? wxString::Format("%s %d", str, i) : wxString::Format("%d", i), *bmp); + (*ctrl)->Append(use_full_item_name + ? wxString::FromUTF8((boost::format("%1% %2%") % str % i).str()) + : wxString::Format("%d", i), *bmp); ++i; } (*ctrl)->SetSelection(0); @@ -700,8 +702,9 @@ ModeButton::ModeButton( wxWindow* parent, void ModeButton::Init(const wxString &mode) { - m_tt_focused = wxString::Format(_(L("Switch to the %s mode")), mode); - m_tt_selected = wxString::Format(_(L("Current mode is %s")), mode); + std::string mode_str = std::string(mode.ToUTF8()); + m_tt_focused = wxString::FromUTF8((boost::format(_utf8(L("Switch to the %s mode"))) % mode_str).str()); + m_tt_selected = wxString::FromUTF8((boost::format(_utf8(L("Current mode is %s"))) % mode_str).str()); SetBitmapMargins(3, 0); diff --git a/src/slic3r/Utils/AstroBox.cpp b/src/slic3r/Utils/AstroBox.cpp index 83a72e64a..20560f1c1 100644 --- a/src/slic3r/Utils/AstroBox.cpp +++ b/src/slic3r/Utils/AstroBox.cpp @@ -13,6 +13,7 @@ #include "libslic3r/PrintConfig.hpp" #include "slic3r/GUI/I18N.hpp" +#include "slic3r/GUI/GUI.hpp" #include "Http.hpp" @@ -65,7 +66,7 @@ bool AstroBox::test(wxString &msg) const const auto text = ptree.get_optional("text"); res = validate_version_text(text); if (! res) { - msg = wxString::Format(_(L("Mismatched type of print host: %s")), text ? *text : "AstroBox"); + msg = GUI::from_u8((boost::format(_utf8(L("Mismatched type of print host: %s"))) % (text ? *text : "AstroBox")).str()); } } catch (const std::exception &) { @@ -85,8 +86,10 @@ wxString AstroBox::get_test_ok_msg () const wxString AstroBox::get_test_failed_msg (wxString &msg) const { - return wxString::Format("%s: %s\n\n%s", - _(L("Could not connect to AstroBox")), msg, _(L("Note: AstroBox version at least 1.1.0 is required."))); + return GUI::from_u8((boost::format("%s: %s\n\n%s") + % _utf8(L("Could not connect to AstroBox")) + % std::string(msg.ToUTF8()) + % _utf8(L("Note: AstroBox version at least 1.1.0 is required."))).str()); } bool AstroBox::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const diff --git a/src/slic3r/Utils/Duet.cpp b/src/slic3r/Utils/Duet.cpp index 554d3f5f5..4536dd217 100644 --- a/src/slic3r/Utils/Duet.cpp +++ b/src/slic3r/Utils/Duet.cpp @@ -51,7 +51,9 @@ wxString Duet::get_test_ok_msg () const wxString Duet::get_test_failed_msg (wxString &msg) const { - return wxString::Format("%s: %s", _(L("Could not connect to Duet")), msg); + return GUI::from_u8((boost::format("%s: %s") + % _utf8(L("Could not connect to Duet")) + % std::string(msg.ToUTF8())).str()); } bool Duet::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const diff --git a/src/slic3r/Utils/FlashAir.cpp b/src/slic3r/Utils/FlashAir.cpp index 735e4a70a..c033bd843 100644 --- a/src/slic3r/Utils/FlashAir.cpp +++ b/src/slic3r/Utils/FlashAir.cpp @@ -70,7 +70,10 @@ wxString FlashAir::get_test_ok_msg () const wxString FlashAir::get_test_failed_msg (wxString &msg) const { - return wxString::Format("%s: %s", _(L("Could not connect to FlashAir")), msg, _(L("Note: FlashAir with firmware 2.00.02 or newer and activated upload function is required."))); + return wxString::FromUTF8((boost::format("%s: %s") + % _utf8(L("Could not connect to FlashAir")) + % std::string(msg.ToUTF8()) + % _utf8(L("Note: FlashAir with firmware 2.00.02 or newer and activated upload function is required."))).str()); } bool FlashAir::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const diff --git a/src/slic3r/Utils/OctoPrint.cpp b/src/slic3r/Utils/OctoPrint.cpp index 48f8ba0b9..ee87f822f 100644 --- a/src/slic3r/Utils/OctoPrint.cpp +++ b/src/slic3r/Utils/OctoPrint.cpp @@ -13,6 +13,7 @@ #include "libslic3r/PrintConfig.hpp" #include "slic3r/GUI/I18N.hpp" +#include "slic3r/GUI/GUI.hpp" #include "Http.hpp" @@ -65,7 +66,7 @@ bool OctoPrint::test(wxString &msg) const const auto text = ptree.get_optional("text"); res = validate_version_text(text); if (! res) { - msg = wxString::Format(_(L("Mismatched type of print host: %s")), text ? *text : "OctoPrint"); + msg = GUI::from_u8((boost::format(_utf8(L("Mismatched type of print host: %s"))) % (text ? *text : "OctoPrint")).str()); } } catch (const std::exception &) { @@ -85,8 +86,10 @@ wxString OctoPrint::get_test_ok_msg () const wxString OctoPrint::get_test_failed_msg (wxString &msg) const { - return wxString::Format("%s: %s\n\n%s", - _(L("Could not connect to OctoPrint")), msg, _(L("Note: OctoPrint version at least 1.1.0 is required."))); + return GUI::from_u8((boost::format("%s: %s\n\n%s") + % _utf8(L("Could not connect to OctoPrint")) + % std::string(msg.ToUTF8()) + % _utf8(L("Note: OctoPrint version at least 1.1.0 is required."))).str()); } bool OctoPrint::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn) const @@ -178,7 +181,9 @@ wxString SL1Host::get_test_ok_msg () const wxString SL1Host::get_test_failed_msg (wxString &msg) const { - return wxString::Format("%s: %s", _(L("Could not connect to Prusa SLA")), msg); + return GUI::from_u8((boost::format("%s: %s") + % _utf8(L("Could not connect to Prusa SLA")) + % std::string(msg.ToUTF8())).str()); } bool SL1Host::validate_version_text(const boost::optional &version_text) const diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 909595cc0..a28937e15 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -702,15 +702,15 @@ PresetUpdater::UpdateResult PresetUpdater::config_update(const Semver &old_slic3 const auto max_slic3r = incompat.version.max_slic3r_version; wxString restrictions; if (min_slic3r != Semver::zero() && max_slic3r != Semver::inf()) { - restrictions = wxString::Format(_(L("requires min. %s and max. %s")), - min_slic3r.to_string(), - max_slic3r.to_string() + restrictions = GUI::from_u8((boost::format(_utf8(L("requires min. %s and max. %s"))) + % min_slic3r.to_string() + % max_slic3r.to_string()).str() ); } else if (min_slic3r != Semver::zero()) { - restrictions = wxString::Format(_(L("requires min. %s")), min_slic3r.to_string()); + restrictions = GUI::from_u8((boost::format(_utf8(L("requires min. %s"))) % min_slic3r.to_string()).str()); BOOST_LOG_TRIVIAL(debug) << "Bundle is not downgrade, user will now have to do whole wizard. This should not happen."; } else { - restrictions = wxString::Format(_(L("requires max. %s")), max_slic3r.to_string()); + restrictions = GUI::from_u8((boost::format(_utf8(L("requires max. %s"))) % max_slic3r.to_string()).str()); } incompats_map.emplace(std::make_pair(incompat.vendor, std::move(restrictions)));