Localization improvements

This commit is contained in:
YuSanka 2019-05-04 02:07:07 +02:00
parent 8be585893a
commit 8e007c5b6a
14 changed files with 1217 additions and 1121 deletions

File diff suppressed because it is too large Load diff

View file

@ -1473,7 +1473,7 @@ void Print::process()
BOOST_LOG_TRIVIAL(info) << "Staring the slicing process." << log_memory_info();
for (PrintObject *obj : m_objects)
obj->make_perimeters();
this->set_status(70, "Infilling layers");
this->set_status(70, L("Infilling layers"));
for (PrintObject *obj : m_objects)
obj->infill();
for (PrintObject *obj : m_objects)
@ -1481,7 +1481,7 @@ void Print::process()
if (this->set_started(psSkirt)) {
m_skirt.clear();
if (this->has_skirt()) {
this->set_status(88, "Generating skirt");
this->set_status(88, L("Generating skirt"));
this->_make_skirt();
}
this->set_done(psSkirt);
@ -1489,7 +1489,7 @@ void Print::process()
if (this->set_started(psBrim)) {
m_brim.clear();
if (m_config.brim_width > 0) {
this->set_status(88, "Generating brim");
this->set_status(88, L("Generating brim"));
this->_make_brim();
}
this->set_done(psBrim);
@ -1497,7 +1497,7 @@ void Print::process()
if (this->set_started(psWipeTower)) {
m_wipe_tower_data.clear();
if (this->has_wipe_tower()) {
//this->set_status(95, "Generating wipe tower");
//this->set_status(95, L("Generating wipe tower"));
this->_make_wipe_tower();
}
this->set_done(psWipeTower);
@ -1514,7 +1514,8 @@ std::string Print::export_gcode(const std::string &path_template, GCodePreviewDa
// output everything to a G-code file
// The following call may die if the output_filename_format template substitution fails.
std::string path = this->output_filepath(path_template);
std::string message = "Exporting G-code";
std::string message = L("Exporting G-code");
// #ys_FIXME_localization
if (! path.empty() && preview_data == nullptr) {
// Only show the path if preview_data is not set -> running from command line.
message += " to ";

View file

@ -92,9 +92,9 @@ void PrintConfigDef::init_common_params()
def->default_value = new ConfigOptionString("");
def = this->add("printhost_cafile", coString);
def->label = "HTTPS CA File";
def->tooltip = "Custom CA certificate file can be specified for HTTPS OctoPrint connections, in crt/pem format. "
"If left blank, the default OS CA certificate repository is used.";
def->label = L("HTTPS CA File");
def->tooltip = L("Custom CA certificate file can be specified for HTTPS OctoPrint connections, in crt/pem format. "
"If left blank, the default OS CA certificate repository is used.");
def->mode = comAdvanced;
def->default_value = new ConfigOptionString("");
}
@ -145,6 +145,7 @@ void PrintConfigDef::init_fff_params()
def->default_value = new ConfigOptionString("");
def = this->add("bottom_solid_layers", coInt);
//TRN To be shown in Print Settings "Bottom solid layers"
def->label = L("Bottom");
def->category = L("Layers and Perimeters");
def->tooltip = L("Number of solid layers to generate on bottom surfaces.");
@ -913,10 +914,10 @@ void PrintConfigDef::init_fff_params()
def->default_value = new ConfigOptionEnum<GCodeFlavor>(gcfRepRap);
def = this->add("gcode_label_objects", coBool);
def->label = "Label objects";
def->tooltip = "Enable this to add comments into the G-Code labeling print moves with what object they belong to,"
def->label = L("Label objects");
def->tooltip = L("Enable this to add comments into the G-Code labeling print moves with what object they belong to,"
" which is useful for the Octoprint CancelObject plugin. This settings is NOT compatible with "
"Single Extruder Multi Material setup and Wipe into Object / Wipe into Infill.";
"Single Extruder Multi Material setup and Wipe into Object / Wipe into Infill.");
def->mode = comAdvanced;
def->default_value = new ConfigOptionBool(0);
@ -2038,6 +2039,7 @@ void PrintConfigDef::init_fff_params()
def->default_value = new ConfigOptionFloatOrPercent(15, false);
def = this->add("top_solid_layers", coInt);
//TRN To be shown in Print Settings "Top solid layers"
def->label = L("Top");
def->category = L("Layers and Perimeters");
def->tooltip = L("Number of solid layers to generate on top surfaces.");
@ -2141,7 +2143,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("wipe_tower_rotation_angle", coFloat);
def->label = L("Wipe tower rotation angle");
def->tooltip = L("Wipe tower rotation angle with respect to x-axis ");
def->sidetext = L("degrees");
def->sidetext = L("°");
def->mode = comAdvanced;
def->default_value = new ConfigOptionFloat(0.);

View file

@ -2,6 +2,7 @@
#include "BoundingBox.hpp"
#include "ClipperUtils.hpp"
#include "Geometry.hpp"
#include "I18N.hpp"
#include "SupportMaterial.hpp"
#include "Surface.hpp"
#include "Slicing.hpp"
@ -17,6 +18,10 @@
#include <Shiny/Shiny.h>
//! macro used to mark string used at localization,
//! return same string
#define L(s) Slic3r::I18N::translate(s)
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
#define SLIC3R_DEBUG
#endif
@ -102,7 +107,7 @@ void PrintObject::slice()
{
if (! this->set_started(posSlice))
return;
m_print->set_status(10, "Processing triangulated mesh");
m_print->set_status(10, L("Processing triangulated mesh"));
std::vector<coordf_t> layer_height_profile;
this->update_layer_height_profile(*this->model_object(), m_slicing_params, layer_height_profile);
m_print->throw_if_canceled();
@ -133,7 +138,7 @@ void PrintObject::make_perimeters()
if (! this->set_started(posPerimeters))
return;
m_print->set_status(20, "Generating perimeters");
m_print->set_status(20, L("Generating perimeters"));
BOOST_LOG_TRIVIAL(info) << "Generating perimeters..." << log_memory_info();
// merge slices if they were split into types
@ -243,7 +248,7 @@ void PrintObject::prepare_infill()
if (! this->set_started(posPrepareInfill))
return;
m_print->set_status(30, "Preparing infill");
m_print->set_status(30, L("Preparing infill"));
// This will assign a type (top/bottom/internal) to $layerm->slices.
// Then the classifcation of $layerm->slices is transfered onto
@ -383,7 +388,7 @@ void PrintObject::generate_support_material()
if (this->set_started(posSupportMaterial)) {
this->clear_support_layers();
if ((m_config.support_material || m_config.raft_layers > 0) && m_layers.size() > 1) {
m_print->set_status(85, "Generating support material");
m_print->set_status(85, L("Generating support material"));
this->_generate_support_material();
m_print->throw_if_canceled();
} else {

View file

@ -28,6 +28,7 @@
#include <boost/filesystem.hpp>
#include <boost/log/trivial.hpp>
#include <boost/nowide/cstdio.hpp>
#include "I18N.hpp"
namespace Slic3r {
@ -81,13 +82,14 @@ void BackgroundSlicingProcess::process_fff()
std::string export_path = m_fff_print->print_statistics().finalize_output_path(m_export_path);
if (copy_file(m_temp_output_path, export_path) != 0)
throw std::runtime_error("Copying of the temporary G-code to the output G-code failed");
m_print->set_status(95, "Running post-processing scripts");
m_print->set_status(95, L("Running post-processing scripts"));
run_post_process_scripts(export_path, m_fff_print->config());
m_print->set_status(100, "G-code file exported to " + export_path);
// #ys_FIXME_localization
m_print->set_status(100, L("G-code file exported to ") + export_path);
} else if (! m_upload_job.empty()) {
prepare_upload();
} else {
m_print->set_status(100, "Slicing complete");
m_print->set_status(100, L("Slicing complete"));
}
this->set_step_done(bspsGCodeFinalize);
}
@ -101,11 +103,12 @@ void BackgroundSlicingProcess::process_sla()
if (! m_export_path.empty()) {
const std::string export_path = m_sla_print->print_statistics().finalize_output_path(m_export_path);
m_sla_print->export_raster(export_path);
m_print->set_status(100, "Masked SLA file exported to " + export_path);
// #ys_FIXME_localization
m_print->set_status(100, L("Masked SLA file exported to ") + export_path);
} else if (! m_upload_job.empty()) {
prepare_upload();
} else {
m_print->set_status(100, "Slicing complete");
m_print->set_status(100, L("Slicing complete"));
}
this->set_step_done(bspsGCodeFinalize);
}
@ -394,7 +397,7 @@ void BackgroundSlicingProcess::prepare_upload()
/ boost::filesystem::unique_path("." SLIC3R_APP_KEY ".upload.%%%%-%%%%-%%%%-%%%%");
if (m_print == m_fff_print) {
m_print->set_status(95, "Running post-processing scripts");
m_print->set_status(95, L("Running post-processing scripts"));
if (copy_file(m_temp_output_path, source_path.string()) != 0) {
throw std::runtime_error("Copying of the temporary G-code to the output G-code failed");
}
@ -405,7 +408,8 @@ void BackgroundSlicingProcess::prepare_upload()
m_sla_print->export_raster(source_path.string(), m_upload_job.upload_data.upload_path.string());
}
m_print->set_status(100, (boost::format("Scheduling upload to `%1%`. See Window -> Print Host Upload Queue") % m_upload_job.printhost->get_host()).str());
// #ys_FIXME_localization
m_print->set_status(100, (boost::format(L("Scheduling upload to `%1%`. See Window -> Print Host Upload Queue")) % m_upload_job.printhost->get_host()).str());
m_upload_job.upload_data.source_path = std::move(source_path);

View file

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

View file

@ -121,7 +121,7 @@ void ObjectSettings::update_settings_list()
if (cat.second.size() == 1 && cat.second[0] == "extruder")
continue;
auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), cat.first, config, false, extra_column);
auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), _(cat.first), config, false, extra_column);
optgroup->label_width = 15;
optgroup->sidetext_width = 5.5;

View file

@ -923,7 +923,7 @@ RENDER_AGAIN:
// Following is rendered in both editing and non-editing mode:
m_imgui->text("");
if (m_clipping_plane_distance == 0.f)
m_imgui->text("Clipping of view: ");
m_imgui->text(_(L("Clipping of view:"))+ " ");
else {
if (m_imgui->button(_(L("Reset direction")))) {
wxGetApp().CallAfter([this](){

View file

@ -48,9 +48,9 @@ KBShortcutsDialog::KBShortcutsDialog()
m_head_bitmaps.reserve(m_full_shortcuts.size());
const wxSize topic_size = wxSize(10 * wxGetApp().em_unit(), -1);
for (auto& sc : m_full_shortcuts)
for (auto& shortcut : m_full_shortcuts)
{
auto sizer = sc.second.second == szLeft ? l_sizer : r_sizer;
auto sizer = shortcut.second.second == szLeft ? l_sizer : r_sizer;
wxBoxSizer* hsizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(hsizer, 0, wxEXPAND | wxTOP | wxBOTTOM, 10);
@ -59,7 +59,7 @@ KBShortcutsDialog::KBShortcutsDialog()
hsizer->Add(m_head_bitmaps.back(), 0, wxEXPAND | wxLEFT | wxRIGHT, 15);
// head
wxStaticText* head = new wxStaticText(panel, wxID_ANY, sc.first, wxDefaultPosition, topic_size);
wxStaticText* head = new wxStaticText(panel, wxID_ANY, shortcut.first, wxDefaultPosition, topic_size);
head->SetFont(head_font);
hsizer->Add(head, 0, wxALIGN_CENTER_VERTICAL);
@ -68,7 +68,7 @@ KBShortcutsDialog::KBShortcutsDialog()
auto grid_sizer = new wxFlexGridSizer(2, 5, 15);
sizer->Add(grid_sizer, 0, wxEXPAND | wxLEFT| wxRIGHT, 15);
for (auto pair : sc.second.first)
for (auto pair : shortcut.second.first)
{
auto shortcut = new wxStaticText(panel, wxID_ANY, _(pair.first));
shortcut->SetFont(bold_font);
@ -124,7 +124,7 @@ void KBShortcutsDialog::fill_shortcuts()
main_shortcuts.push_back(Shortcut("+" ,L("Add Instance to selected object ")));
main_shortcuts.push_back(Shortcut("-" ,L("Remove Instance from selected object")));
main_shortcuts.push_back(Shortcut("?" ,L("Show keyboard shortcuts list")));
main_shortcuts.push_back(Shortcut(ctrl+"LeftMouse" ,L("Select multiple object/Move multiple object")));
main_shortcuts.push_back(Shortcut(ctrl/*+"LeftMouse"*/,L("Press to select multiple object or move multiple object with mouse")));
m_full_shortcuts.push_back(std::make_pair(_(L("Main Shortcuts")), std::make_pair(main_shortcuts, szLeft)));

View file

@ -518,7 +518,9 @@ void MainFrame::init_menubar()
// The camera control accelerators are captured by GLCanvas3D::on_char().
wxMenuItem* item_iso = append_menu_item(viewMenu, wxID_ANY, _(L("Iso")) + sep + "&0", _(L("Iso View")), [this](wxCommandEvent&) { select_view("iso"); });
viewMenu->AppendSeparator();
//TRN To be shown in the main menu View->Top
wxMenuItem* item_top = append_menu_item(viewMenu, wxID_ANY, _(L("Top")) + sep + "&1", _(L("Top View")), [this](wxCommandEvent&) { select_view("top"); });
//TRN To be shown in the main menu View->Bottom
wxMenuItem* item_bottom = append_menu_item(viewMenu, wxID_ANY, _(L("Bottom")) + sep + "&2", _(L("Bottom View")), [this](wxCommandEvent&) { select_view("bottom"); });
wxMenuItem* item_front = append_menu_item(viewMenu, wxID_ANY, _(L("Front")) + sep + "&3", _(L("Front View")), [this](wxCommandEvent&) { select_view("front"); });
wxMenuItem* item_rear = append_menu_item(viewMenu, wxID_ANY, _(L("Rear")) + sep + "&4", _(L("Rear View")), [this](wxCommandEvent&) { select_view("rear"); });

View file

@ -989,7 +989,7 @@ void Sidebar::show_info_sizer()
p->object_info->manifold_warning_icon->SetToolTip(tooltip);
}
else {
p->object_info->info_manifold->SetLabel(L("Yes"));
p->object_info->info_manifold->SetLabel(_(L("Yes")));
p->object_info->showing_manifold_warning_icon = false;
p->object_info->info_manifold->SetToolTip("");
p->object_info->manifold_warning_icon->SetToolTip("");
@ -2403,7 +2403,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation)
// Background data is valid.
if ((return_state & UPDATE_BACKGROUND_PROCESS_RESTART) != 0 ||
(return_state & UPDATE_BACKGROUND_PROCESS_REFRESH_SCENE) != 0 )
this->statusbar()->set_status_text(L("Ready to slice"));
this->statusbar()->set_status_text(_(L("Ready to slice")));
sidebar->set_btn_label(ActionButtonType::abExport, _(label_btn_export));
sidebar->set_btn_label(ActionButtonType::abSendGCode, _(label_btn_send));
@ -2441,7 +2441,7 @@ bool Plater::priv::restart_background_process(unsigned int state)
// The print is valid and it can be started.
if (this->background_process.start()) {
this->statusbar()->set_cancel_callback([this]() {
this->statusbar()->set_status_text(L("Cancelling"));
this->statusbar()->set_status_text(_(L("Cancelling")));
this->background_process.stop();
});
return true;
@ -2665,7 +2665,7 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
}
this->statusbar()->set_progress(evt.status.percent);
this->statusbar()->set_status_text(_(L(evt.status.text)) + wxString::FromUTF8(""));
this->statusbar()->set_status_text(_(evt.status.text) + wxString::FromUTF8(""));
}
if (evt.status.flags & (PrintBase::SlicingStatus::RELOAD_SCENE || PrintBase::SlicingStatus::RELOAD_SLA_SUPPORT_POINTS)) {
switch (this->printer_technology) {
@ -2724,7 +2724,7 @@ void Plater::priv::on_process_completed(wxCommandEvent &evt)
this->statusbar()->set_status_text(message);
}
if (canceled)
this->statusbar()->set_status_text(L("Cancelled"));
this->statusbar()->set_status_text(_(L("Cancelled")));
this->sidebar->show_sliced_info_sizer(success);

View file

@ -1678,7 +1678,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup)
}
auto printhost_browse = [=](wxWindow* parent) {
add_scaled_button(parent, &m_printhost_browse_btn, "browse", _(L(" Browse ")) + dots, wxBU_LEFT | wxBU_EXACTFIT);
add_scaled_button(parent, &m_printhost_browse_btn, "browse", _(L("Browse")) + " "+ dots, wxBU_LEFT | wxBU_EXACTFIT);
ScalableButton* btn = m_printhost_browse_btn;
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
@ -2057,7 +2057,7 @@ void TabPrinter::build_sla()
optgroup->append_single_option_line("area_fill");
optgroup = page->new_optgroup(_(L("Corrections")));
line = Line{ m_config->def()->get("relative_correction")->full_label, "" };
line = Line{ _(m_config->def()->get("relative_correction")->full_label), "" };
// std::vector<std::string> axes{ "X", "Y", "Z" };
std::vector<std::string> axes{ "XY", "Z" };
int id = 0;
@ -3313,7 +3313,7 @@ void TabSLAMaterial::build()
// std::vector<std::string> axes{ "X", "Y", "Z" };
std::vector<std::string> axes{ "XY", "Z" };
for (auto& opt_key : corrections) {
auto line = Line{ m_config->def()->get(opt_key)->full_label, "" };
auto line = Line{ _(m_config->def()->get(opt_key)->full_label), "" };
int id = 0;
for (auto& axis : axes) {
auto opt = optgroup->get_option(opt_key, id);

View file

@ -346,6 +346,28 @@ wxBitmap create_scaled_bitmap(wxWindow *win, const std::string& bmp_name_in, con
// ObjectDataViewModelNode
// ----------------------------------------------------------------------------
ObjectDataViewModelNode::ObjectDataViewModelNode(ObjectDataViewModelNode* parent, const ItemType type) :
m_parent(parent),
m_type(type),
m_extruder(wxEmptyString)
{
if (type == itSettings) {
m_name = "Settings to modified";
}
else if (type == itInstanceRoot) {
m_name = _(L("Instances"));
#ifdef __WXGTK__
m_container = true;
#endif //__WXGTK__
}
else if (type == itInstance) {
m_idx = parent->GetChildCount();
m_name = wxString::Format(_(L("Instance_%d")), m_idx + 1);
set_action_icon();
}
}
void ObjectDataViewModelNode::set_action_icon()
{
m_action_icon_name = m_type == itObject ? "advanced_plus" :
@ -384,7 +406,7 @@ bool ObjectDataViewModelNode::update_settings_digest(const std::vector<std::stri
m_name = wxEmptyString;
for (auto& cat : m_opt_categories)
m_name += cat + "; ";
m_name += _(cat) + "; ";
if (!m_name.IsEmpty())
m_name.erase(m_name.Length()-2, 2); // Delete last "; "

View file

@ -219,28 +219,7 @@ public:
set_action_icon();
}
ObjectDataViewModelNode(ObjectDataViewModelNode* parent,
const ItemType type) :
m_parent(parent),
m_type(type),
m_extruder(wxEmptyString)
{
if (type == itSettings) {
m_name = "Settings to modified";
}
else if (type == itInstanceRoot) {
m_name = "Instances";
#ifdef __WXGTK__
m_container = true;
#endif //__WXGTK__
}
else if (type == itInstance) {
m_idx = parent->GetChildCount();
m_name = wxString::Format("Instance_%d", m_idx+1);
set_action_icon();
}
}
ObjectDataViewModelNode(ObjectDataViewModelNode* parent, const ItemType type);
~ObjectDataViewModelNode()
{