FIX: [STUDIO-2698] Load failed content translation

Jira: STUDIO-2698

Change-Id: Ic59868492eff4f91b765cb0907a94a880dba9c0f
This commit is contained in:
maosheng.wei 2023-04-17 11:15:27 +08:00 committed by Lane.Wei
parent 793c50b1a6
commit ad035fa637
13 changed files with 83 additions and 63 deletions

View file

@ -37,6 +37,11 @@
#include "MeshBoolean.hpp"
#include "Format/3mf.hpp"
// Transtltion
#include "I18N.hpp"
#define _L(s) Slic3r::I18N::translate(s)
namespace Slic3r {
// BBS initialization of static variables
std::map<size_t, ExtruderParams> Model::extruderParamsMap = { {0,{"",0,0}}};
@ -191,7 +196,7 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
//BBS: is_xxx is used for is_bbs_3mf when load 3mf
result = load_bbs_3mf(input_file.c_str(), config, config_substitutions, &model, plate_data, project_presets, is_xxx, file_version, proFn, options, project, plate_id);
else
throw Slic3r::RuntimeError("Unknown file format. Input file must have .stl, .obj, .amf(.xml) extension.");
throw Slic3r::RuntimeError(_L("Unknown file format. Input file must have .stl, .obj, .amf(.xml) extension."));
if (is_cb_cancel) {
Model empty_model;
@ -200,13 +205,13 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
if (!result) {
if (message.empty())
throw Slic3r::RuntimeError("Loading of a model file failed.");
throw Slic3r::RuntimeError(_L("Loading of a model file failed."));
else
throw Slic3r::RuntimeError(message);
}
if (model.objects.empty())
throw Slic3r::RuntimeError("The supplied file couldn't be read because it's empty");
throw Slic3r::RuntimeError(_L("The supplied file couldn't be read because it's empty"));
for (ModelObject *o : model.objects)
o->input_file = input_file;
@ -252,14 +257,14 @@ Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig
else if (boost::algorithm::iends_with(input_file, ".zip.amf"))
result = load_amf(input_file.c_str(), config, config_substitutions, &model, &is_bbl_3mf);
else
throw Slic3r::RuntimeError("Unknown file format. Input file must have .3mf or .zip.amf extension.");
throw Slic3r::RuntimeError(_L("Unknown file format. Input file must have .3mf or .zip.amf extension."));
if (out_file_type != En3mfType::From_Prusa) {
out_file_type = is_bbl_3mf ? En3mfType::From_BBS : En3mfType::From_Other;
}
if (!result)
throw Slic3r::RuntimeError("Loading of a model file failed.");
throw Slic3r::RuntimeError(_L("Loading of a model file failed."));
for (ModelObject *o : model.objects) {
// if (boost::algorithm::iends_with(input_file, ".zip.amf"))
@ -278,7 +283,7 @@ Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig
if (proFn) {
proFn(IMPORT_STAGE_ADD_INSTANCE, 0, 1, cb_cancel);
if (cb_cancel)
throw Slic3r::RuntimeError("Canceled");
throw Slic3r::RuntimeError(_L("Canceled"));
}
}
@ -289,7 +294,7 @@ Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig
if (proFn) {
proFn(IMPORT_STAGE_UPDATE_GCODE, 0, 1, cb_cancel);
if (cb_cancel)
throw Slic3r::RuntimeError("Canceled");
throw Slic3r::RuntimeError(_L("Canceled"));
}
//BBS
@ -300,7 +305,7 @@ Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig
if (proFn) {
proFn(IMPORT_STAGE_CHECK_MODE_GCODE, 0, 1, cb_cancel);
if (cb_cancel)
throw Slic3r::RuntimeError("Canceled");
throw Slic3r::RuntimeError(_L("Canceled"));
}
handle_legacy_sla(*config);