Fixing wxString::Format encoding mismatches (part 3)

This commit is contained in:
Lukas Matena 2020-03-02 12:46:40 +01:00
parent bcd3842183
commit f2b98bddee
10 changed files with 55 additions and 38 deletions

View file

@ -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<PrintHost> 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<std::string> &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);