Fixed localization of the "Machine Limits" parameters.

Fixed localization of some other parameters (templating is not supported
inside the PrintConfig.cpp as these strings are translated not inside
PrintConfig.cpp, but by the calling GUI code).
Fixed localization of SLA status bar.
This commit is contained in:
bubnikv 2019-05-09 14:15:56 +02:00
parent 39946ce28c
commit 92ba75ed75
5 changed files with 7362 additions and 7685 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,8 @@ namespace Slic3r {
//! macro used to mark string used at localization, //! macro used to mark string used at localization,
//! return same string //! return same string
#define L(s) Slic3r::I18N::translate(s) #define L(s) (s)
#define _(s) Slic3r::I18N::translate(s)
static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology) static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology)
{ {
@ -1073,9 +1074,17 @@ void PrintConfigDef::init_fff_params()
std::string axis_upper = boost::to_upper_copy<std::string>(axis.name); std::string axis_upper = boost::to_upper_copy<std::string>(axis.name);
// Add the machine feedrate limits for XYZE axes. (M203) // Add the machine feedrate limits for XYZE axes. (M203)
def = this->add("machine_max_feedrate_" + axis.name, coFloats); def = this->add("machine_max_feedrate_" + axis.name, coFloats);
def->full_label = (boost::format(L("Maximum feedrate %1%")) % axis_upper).str(); def->full_label = (boost::format("Maximum feedrate %1%") % axis_upper).str();
L("Maximum feedrate x");
L("Maximum feedrate y");
L("Maximum feedrate z");
L("Maximum feedrate e");
def->category = L("Machine limits"); def->category = L("Machine limits");
def->tooltip = (boost::format(L("Maximum feedrate of the %1% axis")) % axis_upper).str(); def->tooltip = (boost::format("Maximum feedrate of the %1% axis") % axis_upper).str();
L("Maximum feedrate of the x axis");
L("Maximum feedrate of the y axis");
L("Maximum feedrate of the z axis");
L("Maximum feedrate of the e axis");
def->sidetext = L("mm/s"); def->sidetext = L("mm/s");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width; def->width = machine_limits_opt_width;
@ -1083,9 +1092,13 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloats(axis.max_feedrate)); def->set_default_value(new ConfigOptionFloats(axis.max_feedrate));
// Add the machine acceleration limits for XYZE axes (M201) // Add the machine acceleration limits for XYZE axes (M201)
def = this->add("machine_max_acceleration_" + axis.name, coFloats); def = this->add("machine_max_acceleration_" + axis.name, coFloats);
def->full_label = (boost::format(L("Maximum acceleration %1%")) % axis_upper).str(); def->full_label = (boost::format("Maximum acceleration %1%") % axis_upper).str();
L("Maximum acceleration x");
L("Maximum acceleration y");
L("Maximum acceleration z");
L("Maximum acceleration e");
def->category = L("Machine limits"); def->category = L("Machine limits");
def->tooltip = (boost::format(L("Maximum acceleration of the %1% axis")) % axis_upper).str(); def->tooltip = (boost::format("Maximum acceleration of the %1% axis") % axis_upper).str();
def->sidetext = L("mm/s²"); def->sidetext = L("mm/s²");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width; def->width = machine_limits_opt_width;
@ -1093,9 +1106,17 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloats(axis.max_acceleration)); def->set_default_value(new ConfigOptionFloats(axis.max_acceleration));
// Add the machine jerk limits for XYZE axes (M205) // Add the machine jerk limits for XYZE axes (M205)
def = this->add("machine_max_jerk_" + axis.name, coFloats); def = this->add("machine_max_jerk_" + axis.name, coFloats);
def->full_label = (boost::format(L("Maximum jerk %1%")) % axis_upper).str(); def->full_label = (boost::format("Maximum jerk %1%") % axis_upper).str();
L("Maximum jerk x");
L("Maximum jerk y");
L("Maximum jerk z");
L("Maximum jerk e");
def->category = L("Machine limits"); def->category = L("Machine limits");
def->tooltip = (boost::format(L("Maximum jerk of the %1% axis")) % axis_upper).str(); def->tooltip = (boost::format("Maximum jerk of the %1% axis") % axis_upper).str();
L("Maximum jerk of the x axis");
L("Maximum jerk of the y axis");
L("Maximum jerk of the z axis");
L("Maximum jerk of the e axis");
def->sidetext = L("mm/s"); def->sidetext = L("mm/s");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width; def->width = machine_limits_opt_width;
@ -1108,7 +1129,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("machine_min_extruding_rate", coFloats); def = this->add("machine_min_extruding_rate", coFloats);
def->full_label = L("Minimum feedrate when extruding"); def->full_label = L("Minimum feedrate when extruding");
def->category = L("Machine limits"); def->category = L("Machine limits");
def->tooltip = L("Minimum feedrate when extruding") + " (M205 S)"; def->tooltip = L("Minimum feedrate when extruding (M205 S)");
def->sidetext = L("mm/s"); def->sidetext = L("mm/s");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width; def->width = machine_limits_opt_width;
@ -1119,7 +1140,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("machine_min_travel_rate", coFloats); def = this->add("machine_min_travel_rate", coFloats);
def->full_label = L("Minimum travel feedrate"); def->full_label = L("Minimum travel feedrate");
def->category = L("Machine limits"); def->category = L("Machine limits");
def->tooltip = L("Minimum travel feedrate") + " (M205 T)"; def->tooltip = L("Minimum travel feedrate (M205 T)");
def->sidetext = L("mm/s"); def->sidetext = L("mm/s");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width; def->width = machine_limits_opt_width;
@ -1130,7 +1151,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("machine_max_acceleration_extruding", coFloats); def = this->add("machine_max_acceleration_extruding", coFloats);
def->full_label = L("Maximum acceleration when extruding"); def->full_label = L("Maximum acceleration when extruding");
def->category = L("Machine limits"); def->category = L("Machine limits");
def->tooltip = L("Maximum acceleration when extruding") + " (M204 S)"; def->tooltip = L("Maximum acceleration when extruding (M204 S)");
def->sidetext = L("mm/s²"); def->sidetext = L("mm/s²");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width; def->width = machine_limits_opt_width;
@ -1141,7 +1162,7 @@ void PrintConfigDef::init_fff_params()
def = this->add("machine_max_acceleration_retracting", coFloats); def = this->add("machine_max_acceleration_retracting", coFloats);
def->full_label = L("Maximum acceleration when retracting"); def->full_label = L("Maximum acceleration when retracting");
def->category = L("Machine limits"); def->category = L("Machine limits");
def->tooltip = L("Maximum acceleration when retracting") + " (M204 T)"; def->tooltip = L("Maximum acceleration when retracting (M204 T)");
def->sidetext = L("mm/s²"); def->sidetext = L("mm/s²");
def->min = 0; def->min = 0;
def->width = machine_limits_opt_width; def->width = machine_limits_opt_width;
@ -1829,8 +1850,8 @@ void PrintConfigDef::init_fff_params()
// def->min = 0; // def->min = 0;
def->enum_values.push_back("0"); def->enum_values.push_back("0");
def->enum_values.push_back("0.2"); def->enum_values.push_back("0.2");
def->enum_labels.push_back((boost::format("0 (%1%)") % L("soluble")).str()); def->enum_labels.push_back(L("0 (soluble)"));
def->enum_labels.push_back((boost::format("0.2 (%1%)") % L("detachable")).str()); def->enum_labels.push_back(L("0.2 (detachable)"));
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0.2)); def->set_default_value(new ConfigOptionFloat(0.2));
@ -2736,6 +2757,7 @@ double PrintConfig::min_object_distance(const ConfigBase *config)
: duplicate_distance; : duplicate_distance;
} }
//FIXME localize this function.
std::string FullPrintConfig::validate() std::string FullPrintConfig::validate()
{ {
// --layer-height // --layer-height

View File

@ -50,13 +50,18 @@ const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS =
30, // slaposSliceSupports, 30, // slaposSliceSupports,
}; };
const std::array<std::string, slaposCount> OBJ_STEP_LABELS = // Object step to status label. The labels are localized at the time of calling, thus supporting language switching.
std::string OBJ_STEP_LABELS(size_t idx)
{ {
L("Slicing model"), // slaposObjectSlice, switch (idx) {
L("Generating support points"), // slaposSupportPoints, case slaposObjectSlice: return L("Slicing model");
L("Generating support tree"), // slaposSupportTree, case slaposSupportPoints: return L("Generating support points");
L("Generating pad"), // slaposBasePool, case slaposSupportTree: return L("Generating support tree");
L("Slicing supports"), // slaposSliceSupports, case slaposBasePool: return L("Generating pad");
case slaposSliceSupports: return L("Slicing supports");
default:;
}
assert(false); return "Out of bounds!";
}; };
// Should also add up to 100 (%) // Should also add up to 100 (%)
@ -66,10 +71,15 @@ const std::array<unsigned, slapsCount> PRINT_STEP_LEVELS =
90, // slapsRasterize 90, // slapsRasterize
}; };
const std::array<std::string, slapsCount> PRINT_STEP_LABELS = // Print step to status label. The labels are localized at the time of calling, thus supporting language switching.
std::string PRINT_STEP_LABELS(size_t idx)
{ {
L("Merging slices and calculating statistics"), // slapsStats switch (idx) {
L("Rasterizing layers"), // slapsRasterize case slapsMergeSlicesAndEval: return L("Merging slices and calculating statistics");
case slapsRasterize: return L("Rasterizing layers");
default:;
}
assert(false); return "Out of bounds!";
}; };
} }
@ -128,7 +138,7 @@ static std::vector<SLAPrintObject::Instance> sla_instances(const ModelObject &mo
instances.emplace_back( instances.emplace_back(
model_instance->id(), model_instance->id(),
Point::new_scale(model_instance->get_offset(X), model_instance->get_offset(Y)), Point::new_scale(model_instance->get_offset(X), model_instance->get_offset(Y)),
float(Geometry::rotation_diff_z(rotation0, model_instance->get_rotation()))); float(Geometry::rotation_diff_z(rotation0, model_instance->get_rotation())));
} }
} }
return instances; return instances;
@ -705,7 +715,7 @@ void SLAPrint::process()
po.closest_slice_record(po.m_slice_index, float(bb3d.min(Z))); po.closest_slice_record(po.m_slice_index, float(bb3d.min(Z)));
if(slindex_it == po.m_slice_index.end()) if(slindex_it == po.m_slice_index.end())
//TRN To be shown at the status bar on SLA slicing error. //TRN To be shown at the status bar on SLA slicing error.
throw std::runtime_error(L("Slicing had to be stopped " throw std::runtime_error(L("Slicing had to be stopped "
"due to an internal error.")); "due to an internal error."));
@ -783,7 +793,7 @@ void SLAPrint::process()
double current = init + st * d; double current = init + st * d;
if(std::round(m_report_status.status()) < std::round(current)) if(std::round(m_report_status.status()) < std::round(current))
m_report_status(*this, current, m_report_status(*this, current,
OBJ_STEP_LABELS[slaposSupportPoints]); OBJ_STEP_LABELS(slaposSupportPoints));
}; };
@ -837,7 +847,7 @@ void SLAPrint::process()
double current = init + st * d; double current = init + st * d;
if(std::round(m_report_status.status()) < std::round(current)) if(std::round(m_report_status.status()) < std::round(current))
m_report_status(*this, current, m_report_status(*this, current,
OBJ_STEP_LABELS[slaposSupportTree]); OBJ_STEP_LABELS(slaposSupportTree));
}; };
@ -1347,7 +1357,7 @@ void SLAPrint::process()
double st = std::round(dstatus); double st = std::round(dstatus);
if(st > pst) { if(st > pst) {
m_report_status(*this, st, m_report_status(*this, st,
PRINT_STEP_LABELS[slapsRasterize]); PRINT_STEP_LABELS(slapsRasterize));
pst = st; pst = st;
} }
} }
@ -1413,7 +1423,7 @@ void SLAPrint::process()
st += incr * ostepd; st += incr * ostepd;
if(po->m_stepmask[currentstep] && po->set_started(currentstep)) { if(po->m_stepmask[currentstep] && po->set_started(currentstep)) {
m_report_status(*this, st, OBJ_STEP_LABELS[currentstep]); m_report_status(*this, st, OBJ_STEP_LABELS(currentstep));
pobj_program[currentstep](*po); pobj_program[currentstep](*po);
throw_if_canceled(); throw_if_canceled();
po->set_done(currentstep); po->set_done(currentstep);
@ -1440,7 +1450,7 @@ void SLAPrint::process()
if(m_stepmask[currentstep] && set_started(currentstep)) if(m_stepmask[currentstep] && set_started(currentstep))
{ {
m_report_status(*this, st, PRINT_STEP_LABELS[currentstep]); m_report_status(*this, st, PRINT_STEP_LABELS(currentstep));
print_program[currentstep](); print_program[currentstep]();
throw_if_canceled(); throw_if_canceled();
set_done(currentstep); set_done(currentstep);

View File

@ -619,7 +619,11 @@ void MainFrame::quick_slice(const int qs)
// { // {
// validate configuration // validate configuration
auto config = wxGetApp().preset_bundle->full_config(); auto config = wxGetApp().preset_bundle->full_config();
config.validate(); auto valid = config.validate();
if (! valid.empty()) {
show_error(this, valid);
return;
}
// select input file // select input file
if (!(qs & qsReslice)) { if (!(qs & qsReslice)) {
@ -783,8 +787,8 @@ void MainFrame::export_config()
auto config = wxGetApp().preset_bundle->full_config(); auto config = wxGetApp().preset_bundle->full_config();
// Validate the cummulative configuration. // Validate the cummulative configuration.
auto valid = config.validate(); auto valid = config.validate();
if (!valid.empty()) { if (! valid.empty()) {
// Slic3r::GUI::catch_error(this); show_error(this, valid);
return; return;
} }
// Ask user for the file name for the config file. // Ask user for the file name for the config file.