Some more localization improvements.

This commit is contained in:
bubnikv 2019-05-09 19:24:21 +02:00
parent b6837112df
commit b7361200bf
8 changed files with 1796 additions and 1576 deletions

File diff suppressed because it is too large Load diff

View file

@ -12,9 +12,9 @@
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
ButtonsDescription::ButtonsDescription(wxWindow* parent, t_icon_descriptions* icon_descriptions) : ButtonsDescription::ButtonsDescription(wxWindow* parent, const std::vector<Entry> &entries) :
wxDialog(parent, wxID_ANY, _(L("Buttons And Text Colors Description")), wxDefaultPosition, wxDefaultSize), wxDialog(parent, wxID_ANY, _(L("Buttons And Text Colors Description")), wxDefaultPosition, wxDefaultSize),
m_icon_descriptions(icon_descriptions) m_entries(entries)
{ {
auto grid_sizer = new wxFlexGridSizer(3, 20, 20); auto grid_sizer = new wxFlexGridSizer(3, 20, 20);
@ -22,18 +22,13 @@ ButtonsDescription::ButtonsDescription(wxWindow* parent, t_icon_descriptions* ic
main_sizer->Add(grid_sizer, 0, wxEXPAND | wxALL, 20); main_sizer->Add(grid_sizer, 0, wxEXPAND | wxALL, 20);
// Icon description // Icon description
for (auto pair : *m_icon_descriptions) for (const Entry &entry : m_entries)
{ {
auto icon = new wxStaticBitmap(this, wxID_ANY, /***/pair.first->bmp()); auto icon = new wxStaticBitmap(this, wxID_ANY, entry.bitmap->bmp());
grid_sizer->Add(icon, -1, wxALIGN_CENTRE_VERTICAL); grid_sizer->Add(icon, -1, wxALIGN_CENTRE_VERTICAL);
auto description = new wxStaticText(this, wxID_ANY, _utf8(entry.symbol));
std::istringstream f(pair.second);
std::string s;
getline(f, s, ';');
auto description = new wxStaticText(this, wxID_ANY, _(s));
grid_sizer->Add(description, -1, wxALIGN_CENTRE_VERTICAL); grid_sizer->Add(description, -1, wxALIGN_CENTRE_VERTICAL);
getline(f, s, ';'); description = new wxStaticText(this, wxID_ANY, _utf8(entry.explanation));
description = new wxStaticText(this, wxID_ANY, _(s));
grid_sizer->Add(description, -1, wxALIGN_CENTRE_VERTICAL | wxEXPAND); grid_sizer->Add(description, -1, wxALIGN_CENTRE_VERTICAL | wxEXPAND);
} }

View file

@ -9,14 +9,22 @@ class ScalableBitmap;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
using t_icon_descriptions = std::vector<std::pair<ScalableBitmap*, std::string>>;
class ButtonsDescription : public wxDialog class ButtonsDescription : public wxDialog
{ {
t_icon_descriptions* m_icon_descriptions;
public: public:
ButtonsDescription(wxWindow* parent, t_icon_descriptions* icon_descriptions); struct Entry {
Entry(ScalableBitmap *bitmap, const std::string &symbol, const std::string &explanation) : bitmap(bitmap), symbol(symbol), explanation(explanation) {}
ScalableBitmap *bitmap;
std::string symbol;
std::string explanation;
};
ButtonsDescription(wxWindow* parent, const std::vector<Entry> &entries);
~ButtonsDescription() {} ~ButtonsDescription() {}
private:
std::vector<Entry> m_entries;
}; };
} // GUI } // GUI

View file

@ -795,7 +795,7 @@ bool GLCanvas3D::WarningTexture::_generate(const std::string& msg_utf8, const GL
if (msg_utf8.empty()) if (msg_utf8.empty())
return false; return false;
wxString msg = _(msg_utf8);//GUI::from_u8(msg_utf8); wxString msg = _(msg_utf8);
wxMemoryDC memDC; wxMemoryDC memDC;

View file

@ -798,8 +798,8 @@ bool GUI_App::check_unsaved_changes()
return true; return true;
// Ask the user. // Ask the user.
wxMessageDialog dialog(mainframe, wxMessageDialog dialog(mainframe,
_(L("You have unsaved changes ")) + dirty + _(L(". Discard changes and continue anyway?")), _(L("The following presets were modified: ")) + dirty + "\n" + _(L("Discard changes and continue anyway?")),
_(L("Unsaved Presets")), wxString(SLIC3R_APP_NAME) + " - " + _(L("Unsaved Presets")),
wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT); wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT);
return dialog.ShowModal() == wxID_YES; return dialog.ShowModal() == wxID_YES;
} }
@ -819,7 +819,7 @@ void GUI_App::load_current_presets()
this->plater()->set_printer_technology(printer_technology); this->plater()->set_printer_technology(printer_technology);
for (Tab *tab : tabs_list) for (Tab *tab : tabs_list)
if (tab->supports_printer_technology(printer_technology)) { if (tab->supports_printer_technology(printer_technology)) {
if (tab->name() == "printer") if (tab->type() == Preset::TYPE_PRINTER)
static_cast<TabPrinter*>(tab)->update_pages(); static_cast<TabPrinter*>(tab)->update_pages();
tab->load_current_preset(); tab->load_current_preset();
} }

View file

@ -1021,7 +1021,7 @@ void GLGizmoSlaSupports::on_set_state()
// on OSX with the wxMessageDialog being shown several times when clicked into. // on OSX with the wxMessageDialog being shown several times when clicked into.
if (m_model_object) { if (m_model_object) {
if (m_unsaved_changes) { if (m_unsaved_changes) {
wxMessageDialog dlg(GUI::wxGetApp().mainframe, _(L("Do you want to save your manually edited support points ?\n")), wxMessageDialog dlg(GUI::wxGetApp().mainframe, _(L("Do you want to save your manually edited support points?")) + "\n",
_(L("Save changes?")), wxICON_QUESTION | wxYES | wxNO); _(L("Save changes?")), wxICON_QUESTION | wxYES | wxNO);
if (dlg.ShowModal() == wxID_YES) if (dlg.ShowModal() == wxID_YES)
editing_mode_apply_changes(); editing_mode_apply_changes();
@ -1202,15 +1202,15 @@ SlaGizmoHelpDialog::SlaGizmoHelpDialog()
: wxDialog(NULL, wxID_ANY, _(L("SLA gizmo keyboard shortcuts")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER) : wxDialog(NULL, wxID_ANY, _(L("SLA gizmo keyboard shortcuts")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
{ {
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
const std::string &ctrl = GUI::shortkey_ctrl_prefix(); const wxString ctrl = GUI::shortkey_ctrl_prefix();
const std::string &alt = GUI::shortkey_alt_prefix(); const wxString alt = GUI::shortkey_alt_prefix();
// fonts // fonts
const wxFont& font = wxGetApp().small_font(); const wxFont& font = wxGetApp().small_font();
const wxFont& bold_font = wxGetApp().bold_font(); const wxFont& bold_font = wxGetApp().bold_font();
auto note_text = new wxStaticText(this, wxID_ANY, "Note: some shortcuts work in (non)editing mode only."); auto note_text = new wxStaticText(this, wxID_ANY, _(L("Note: some shortcuts work in (non)editing mode only.")));
note_text->SetFont(font); note_text->SetFont(font);
auto vsizer = new wxBoxSizer(wxVERTICAL); auto vsizer = new wxBoxSizer(wxVERTICAL);
@ -1227,22 +1227,22 @@ SlaGizmoHelpDialog::SlaGizmoHelpDialog()
vsizer->Add(gridsizer); vsizer->Add(gridsizer);
vsizer->AddSpacer(20); vsizer->AddSpacer(20);
std::vector<std::pair<std::string, wxString>> shortcuts; std::vector<std::pair<wxString, wxString>> shortcuts;
shortcuts.push_back(std::make_pair("Left click", _(L("Add point")))); shortcuts.push_back(std::make_pair(_(L("Left click")), _(L("Add point"))));
shortcuts.push_back(std::make_pair("Right click", _(L("Remove point")))); shortcuts.push_back(std::make_pair(_(L("Right click")), _(L("Remove point"))));
shortcuts.push_back(std::make_pair("Drag", _(L("Move point")))); shortcuts.push_back(std::make_pair(_(L("Drag")), _(L("Move point"))));
shortcuts.push_back(std::make_pair(ctrl+"Left click", _(L("Add point to selection")))); shortcuts.push_back(std::make_pair(ctrl+_(L("Left click")), _(L("Add point to selection"))));
shortcuts.push_back(std::make_pair(alt+"Left click", _(L("Remove point from selection")))); shortcuts.push_back(std::make_pair(alt+_(L("Left click")), _(L("Remove point from selection"))));
shortcuts.push_back(std::make_pair("Shift+drag", _(L("Select by rectangle")))); shortcuts.push_back(std::make_pair(wxString("Shift+")+_(L("Drag")), _(L("Select by rectangle"))));
shortcuts.push_back(std::make_pair(alt+"drag", _(L("Deselect by rectangle")))); shortcuts.push_back(std::make_pair(alt+_(L("Drag")), _(L("Deselect by rectangle"))));
shortcuts.push_back(std::make_pair(ctrl+"A", _(L("Select all points")))); shortcuts.push_back(std::make_pair(ctrl+"A", _(L("Select all points"))));
shortcuts.push_back(std::make_pair("Delete", _(L("Remove selected points")))); shortcuts.push_back(std::make_pair("Delete", _(L("Remove selected points"))));
shortcuts.push_back(std::make_pair(ctrl+"mouse wheel", _(L("Move clipping plane")))); shortcuts.push_back(std::make_pair(ctrl+_(L("Mouse wheel")), _(L("Move clipping plane"))));
shortcuts.push_back(std::make_pair("R", _(L("Reset clipping plane")))); shortcuts.push_back(std::make_pair("R", _(L("Reset clipping plane"))));
shortcuts.push_back(std::make_pair("Enter", _(L("Apply changes")))); shortcuts.push_back(std::make_pair("Enter", _(L("Apply changes"))));
shortcuts.push_back(std::make_pair("Esc", _(L("Discard changes")))); shortcuts.push_back(std::make_pair("Esc", _(L("Discard changes"))));
shortcuts.push_back(std::make_pair("M", _(L("Switch to editing mode")))); shortcuts.push_back(std::make_pair("M", _(L("Switch to editing mode"))));
shortcuts.push_back(std::make_pair("A", _(L("Auto-generate points")))); shortcuts.push_back(std::make_pair("A", _(L("Auto-generate points"))));
for (const auto& pair : shortcuts) { for (const auto& pair : shortcuts) {
auto shortcut = new wxStaticText(this, wxID_ANY, pair.first); auto shortcut = new wxStaticText(this, wxID_ANY, pair.first);

View file

@ -157,7 +157,7 @@ void Tab::create_preset_tab()
m_undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(true); })); m_undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(true); }));
m_question_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) m_question_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent)
{ {
auto dlg = new ButtonsDescription(this, &m_icon_descriptions); auto dlg = new ButtonsDescription(this, m_icon_descriptions);
if (dlg->ShowModal() == wxID_OK) { if (dlg->ShowModal() == wxID_OK) {
// Colors for ui "decoration" // Colors for ui "decoration"
for (Tab *tab : wxGetApp().tabs_list) { for (Tab *tab : wxGetApp().tabs_list) {
@ -3062,28 +3062,28 @@ void Tab::compatible_widget_reload(PresetDependencies &deps)
void Tab::fill_icon_descriptions() void Tab::fill_icon_descriptions()
{ {
m_icon_descriptions.push_back(t_icon_description(&m_bmp_value_lock, L("LOCKED LOCK") ";" m_icon_descriptions.emplace_back(&m_bmp_value_lock, L("LOCKED LOCK"),
// TRN Description for "LOCKED LOCK" // TRN Description for "LOCKED LOCK"
L("indicates that the settings are the same as the system values for the current option group"))); L("indicates that the settings are the same as the system values for the current option group"));
m_icon_descriptions.push_back(t_icon_description(&m_bmp_value_unlock, L("UNLOCKED LOCK") ";" m_icon_descriptions.emplace_back(&m_bmp_value_unlock, L("UNLOCKED LOCK"),
// TRN Description for "UNLOCKED LOCK" // TRN Description for "UNLOCKED LOCK"
L("indicates that some settings were changed and are not equal to the system values for " L("indicates that some settings were changed and are not equal to the system values for "
"the current option group.\n" "the current option group.\n"
"Click the UNLOCKED LOCK icon to reset all settings for current option group to " "Click the UNLOCKED LOCK icon to reset all settings for current option group to "
"the system values."))); "the system values."));
m_icon_descriptions.push_back(t_icon_description(&m_bmp_white_bullet, L("WHITE BULLET") ";" m_icon_descriptions.emplace_back(&m_bmp_white_bullet, L("WHITE BULLET"),
// TRN Description for "WHITE BULLET" // TRN Description for "WHITE BULLET"
L("for the left button: \tindicates a non-system preset,\n" L("for the left button: \tindicates a non-system preset,\n"
"for the right button: \tindicates that the settings hasn't been modified."))); "for the right button: \tindicates that the settings hasn't been modified."));
m_icon_descriptions.push_back(t_icon_description(&m_bmp_value_revert, L("BACK ARROW") ";" m_icon_descriptions.emplace_back(&m_bmp_value_revert, L("BACK ARROW"),
// TRN Description for "BACK ARROW" // TRN Description for "BACK ARROW"
L("indicates that the settings were changed and are not equal to the last saved preset for " L("indicates that the settings were changed and are not equal to the last saved preset for "
"the current option group.\n" "the current option group.\n"
"Click the BACK ARROW icon to reset all settings for the current option group to " "Click the BACK ARROW icon to reset all settings for the current option group to "
"the last saved preset."))); "the last saved preset."));
} }
void Tab::set_tooltips_text() void Tab::set_tooltips_text()

View file

@ -29,6 +29,7 @@
#include <memory> #include <memory>
#include "BedShapeDialog.hpp" #include "BedShapeDialog.hpp"
#include "ButtonsDescription.hpp"
#include "Event.hpp" #include "Event.hpp"
#include "wxExtensions.hpp" #include "wxExtensions.hpp"
@ -36,9 +37,6 @@ namespace Slic3r {
namespace GUI { namespace GUI {
typedef std::pair<ScalableBitmap*, std::string> t_icon_description;
typedef std::vector<std::pair<ScalableBitmap*, std::string>> t_icon_descriptions;
// Single Tab page containing a{ vsizer } of{ optgroups } // Single Tab page containing a{ vsizer } of{ optgroups }
// package Slic3r::GUI::Tab::Page; // package Slic3r::GUI::Tab::Page;
using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>; using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
@ -201,7 +199,7 @@ protected:
std::map<std::string, int> m_options_list; std::map<std::string, int> m_options_list;
int m_opt_status_value = 0; int m_opt_status_value = 0;
t_icon_descriptions m_icon_descriptions = {}; std::vector<ButtonsDescription::Entry> m_icon_descriptions = {};
bool m_is_modified_values{ false }; bool m_is_modified_values{ false };
bool m_is_nonsys_values{ true }; bool m_is_nonsys_values{ true };