Localization improvements : Empty spaces at the end of phrase are removed from dictionary.

+ new POT
This commit is contained in:
YuSanka 2019-05-11 23:29:25 +02:00
parent 6a0885002f
commit cd82b03a0e
12 changed files with 513 additions and 520 deletions

View file

@ -6,7 +6,6 @@
#include "PresetBundle.hpp"
#include "PresetHints.hpp"
#include <boost/algorithm/string/predicate.hpp>
#include <wx/intl.h>
#include "GUI.hpp"
@ -18,38 +17,41 @@ namespace Slic3r {
std::string PresetHints::cooling_description(const Preset &preset)
{
std::string out;
char buf[MIN_BUF_LENGTH/*4096*/];
if (preset.config.opt_bool("cooling", 0)) {
if (preset.config.opt_bool("cooling", 0)) {
int slowdown_below_layer_time = preset.config.opt_int("slowdown_below_layer_time", 0);
int min_fan_speed = preset.config.opt_int("min_fan_speed", 0);
int max_fan_speed = preset.config.opt_int("max_fan_speed", 0);
int min_print_speed = int(preset.config.opt_float("min_print_speed", 0) + 0.5);
int fan_below_layer_time = preset.config.opt_int("fan_below_layer_time", 0);
sprintf(buf, _CHB(L("If estimated layer time is below ~%ds, fan will run at %d%% and print speed will be reduced so that no less than %ds are spent on that layer (however, speed will never be reduced below %dmm/s).")),
slowdown_below_layer_time, max_fan_speed, slowdown_below_layer_time, min_print_speed);
out += buf;
out += (boost::format(_utf8(L("If estimated layer time is below ~%1%s, "
"fan will run at %2%%% and print speed will be reduced "
"so that no less than %3%s are spent on that layer "
"(however, speed will never be reduced below %4%mm/s).")))
% slowdown_below_layer_time % max_fan_speed % slowdown_below_layer_time % min_print_speed).str();
if (fan_below_layer_time > slowdown_below_layer_time) {
sprintf(buf, _CHB(L("\nIf estimated layer time is greater, but still below ~%ds, fan will run at a proportionally decreasing speed between %d%% and %d%%.")),
fan_below_layer_time, max_fan_speed, min_fan_speed);
out += buf;
out += (boost::format(_utf8(L("\nIf estimated layer time is greater, but still below ~%1%s, "
"fan will run at a proportionally decreasing speed between %2%%% and %3%%%.")))
% fan_below_layer_time % max_fan_speed % min_fan_speed).str();
}
out += _CHB(L("\nDuring the other layers, fan "));
out += _utf8(L("\nDuring the other layers, fan")) + " ";
} else {
out = _CHB(L("Fan "));
out = _utf8(L("Fan")) + " ";
}
if (preset.config.opt_bool("fan_always_on", 0)) {
int disable_fan_first_layers = preset.config.opt_int("disable_fan_first_layers", 0);
int min_fan_speed = preset.config.opt_int("min_fan_speed", 0);
sprintf(buf, _CHB(L("will always run at %d%% ")), min_fan_speed);
out += buf;
if (disable_fan_first_layers > 1) {
sprintf(buf, _CHB(L("except for the first %d layers")), disable_fan_first_layers);
out += buf;
}
out += (boost::format(_utf8(L("will always run at %1%%%"))) % min_fan_speed).str() + " ";
if (disable_fan_first_layers > 1)
out += (boost::format(_utf8(L("except for the first %1% layers."))) % disable_fan_first_layers).str();
else if (disable_fan_first_layers == 1)
out += _CHB(L("except for the first layer"));
out += _utf8(L("except for the first layer."));
} else
out += _CHB(L("will be turned off."));
out += _utf8(L("will be turned off."));
return out;
}
@ -150,7 +152,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle
limit_by_first_layer_speed(std::max(external_perimeter_speed, small_perimeter_speed), max_print_speed));
if (max_flow < external_perimeter_rate) {
max_flow = external_perimeter_rate;
max_flow_extrusion_type = _CHB(L("external perimeters"));
max_flow_extrusion_type = _utf8(L("external perimeters"));
}
double perimeter_rate = Flow::new_from_config_width(frPerimeter,
first_positive(first_layer_extrusion_width_ptr, perimeter_extrusion_width, extrusion_width),
@ -159,7 +161,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle
limit_by_first_layer_speed(std::max(perimeter_speed, small_perimeter_speed), max_print_speed));
if (max_flow < perimeter_rate) {
max_flow = perimeter_rate;
max_flow_extrusion_type = _CHB(L("perimeters"));
max_flow_extrusion_type = _utf8(L("perimeters"));
}
}
if (! bridging && infill_extruder_active) {
@ -168,7 +170,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle
nozzle_diameter, lh, bfr).mm3_per_mm() * limit_by_first_layer_speed(infill_speed, max_print_speed);
if (max_flow < infill_rate) {
max_flow = infill_rate;
max_flow_extrusion_type = _CHB(L("infill"));
max_flow_extrusion_type = _utf8(L("infill"));
}
}
if (solid_infill_extruder_active) {
@ -178,7 +180,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle
(bridging ? bridge_speed : limit_by_first_layer_speed(solid_infill_speed, max_print_speed));
if (max_flow < solid_infill_rate) {
max_flow = solid_infill_rate;
max_flow_extrusion_type = _CHB(L("solid infill"));
max_flow_extrusion_type = _utf8(L("solid infill"));
}
if (! bridging) {
double top_solid_infill_rate = Flow::new_from_config_width(frInfill,
@ -186,7 +188,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle
nozzle_diameter, lh, bfr).mm3_per_mm() * limit_by_first_layer_speed(top_solid_infill_speed, max_print_speed);
if (max_flow < top_solid_infill_rate) {
max_flow = top_solid_infill_rate;
max_flow_extrusion_type = _CHB(L("top solid infill"));
max_flow_extrusion_type = _utf8(L("top solid infill"));
}
}
}
@ -197,7 +199,7 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle
(bridging ? bridge_speed : limit_by_first_layer_speed(support_material_speed, max_print_speed));
if (max_flow < support_material_rate) {
max_flow = support_material_rate;
max_flow_extrusion_type = _CHB(L("support"));
max_flow_extrusion_type = _utf8(L("support"));
}
}
if (support_material_interface_extruder_active) {
@ -207,26 +209,23 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle
(bridging ? bridge_speed : limit_by_first_layer_speed(support_material_interface_speed, max_print_speed));
if (max_flow < support_material_interface_rate) {
max_flow = support_material_interface_rate;
max_flow_extrusion_type = _CHB(L("support interface"));
max_flow_extrusion_type = _utf8(L("support interface"));
}
}
//FIXME handle gap_fill_speed
if (! out.empty())
out += "\n";
out += (first_layer ? _CHB(L("First layer volumetric")) : (bridging ? _CHB(L("Bridging volumetric")) : _CHB(L("Volumetric"))));
out += _CHB(L(" flow rate is maximized "));
out += (first_layer ? _utf8(L("First layer volumetric")) : (bridging ? _utf8(L("Bridging volumetric")) : _utf8(L("Volumetric"))));
out += " " + _utf8(L("flow rate is maximized")) + " ";
bool limited_by_max_volumetric_speed = max_volumetric_speed > 0 && max_volumetric_speed < max_flow;
out += (limited_by_max_volumetric_speed ?
_CHB(L("by the print profile maximum")) :
(_CHB(L("when printing ")) + max_flow_extrusion_type))
+ _CHB(L(" with a volumetric rate "));
_utf8(L("by the print profile maximum")) :
(_utf8(L("when printing"))+ " " + max_flow_extrusion_type))
+ " " + _utf8(L("with a volumetric rate"))+ " ";
if (limited_by_max_volumetric_speed)
max_flow = max_volumetric_speed;
char buf[MIN_BUF_LENGTH/*2048*/];
sprintf(buf, _CHB(L("%3.2f mm³/s")), max_flow);
out += buf;
sprintf(buf, _CHB(L(" at filament speed %3.2f mm/s.")), max_flow / filament_crossection);
out += buf;
out += (boost::format(_utf8(L("%3.2f mm³/s at filament speed %3.2f mm/s."))) % max_flow % (max_flow / filament_crossection)).str();
}
return out;
@ -244,7 +243,7 @@ std::string PresetHints::recommended_thin_wall_thickness(const PresetBundle &pre
std::string out;
if (layer_height <= 0.f){
out += _CHB(L("Recommended object thin wall thickness: Not available due to invalid layer height."));
out += _utf8(L("Recommended object thin wall thickness: Not available due to invalid layer height."));
return out;
}
@ -260,16 +259,13 @@ std::string PresetHints::recommended_thin_wall_thickness(const PresetBundle &pre
if (num_perimeters > 0) {
int num_lines = std::min(num_perimeters * 2, 10);
char buf[MIN_BUF_LENGTH/*256*/];
sprintf(buf, _CHB(L("Recommended object thin wall thickness for layer height %.2f and ")), layer_height);
out += buf;
out += (boost::format(_utf8(L("Recommended object thin wall thickness for layer height %.2f and"))) % layer_height).str() + " ";
// Start with the width of two closely spaced
double width = external_perimeter_flow.width + external_perimeter_flow.spacing();
for (int i = 2; i <= num_lines; thin_walls ? ++ i : i += 2) {
if (i > 2)
out += ", ";
sprintf(buf, _CHB(L("%d lines: %.2lf mm")), i, width);
out += buf;
out += (boost::format(_utf8(L("%d lines: %.2f mm"))) % i % width).str() + " ";
width += perimeter_flow.spacing() * (thin_walls ? 1.f : 2.f);
}
}