i18n(fr): fix untranslated UI strings, extract hardcoded ones, complete French catalog (#14164)

This commit is contained in:
foXaCe
2026-06-11 22:10:31 +02:00
committed by GitHub
parent 15f330641c
commit d641ca598a
23 changed files with 1028 additions and 265 deletions

View File

@@ -141,9 +141,9 @@ namespace Slic3r {
const int error_code = root.get<int>("error_code", -1);
if (error_code != 0) {
error_message = root.get<std::string>("message", "Printer returned an error");
error_message = root.get<std::string>("message", _u8L("Printer returned an error"));
if (error_message.empty())
error_message = "Printer returned an error";
error_message = _u8L("Printer returned an error");
error_message += " (" + std::to_string(error_code) + ")";
return false;
}
@@ -151,13 +151,13 @@ namespace Slic3r {
if (serial_number != nullptr) {
const auto system_info = root.get_child_optional("system_info");
if (!system_info) {
error_message = "Missing system_info in response";
error_message = _u8L("Missing system_info in response");
return false;
}
const auto sn = system_info->get_optional<std::string>("sn");
if (!sn || sn->empty()) {
error_message = "Missing printer serial number in response";
error_message = _u8L("Missing printer serial number in response");
return false;
}
*serial_number = *sn;
@@ -165,7 +165,7 @@ namespace Slic3r {
return true;
} catch (const std::exception&) {
error_message = "Error parsing response";
error_message = _u8L("Error parsing response");
return false;
}
}
@@ -431,7 +431,7 @@ namespace Slic3r {
if (std::regex_search(body, match, re)) {
res = true;
} else {
msg = format_error(body, "ElegooLink not detected", 0);
msg = format_error(body, _u8L("ElegooLink not detected"), 0);
res = false;
}
})
@@ -472,9 +472,9 @@ namespace Slic3r {
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error getting CC2 device info: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
res = false;
if (status == 401 || status == 403)
msg = format_error(body, "Invalid access code", status);
msg = format_error(body, _u8L("Invalid access code"), status);
else
msg = format_error(body, error.empty() ? "CC2 device not detected" : error, status);
msg = format_error(body, error.empty() ? _u8L("CC2 device not detected") : error, status);
})
.on_complete([&](std::string body, unsigned status) {
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: Got CC2 device info: %2%") % name % body;
@@ -482,7 +482,7 @@ namespace Slic3r {
std::string serial_number;
if (!parse_cc2_response(body, error_message, &serial_number)) {
res = false;
msg = format_error(body, error_message.empty() ? "CC2 device not detected" : error_message, status);
msg = format_error(body, error_message.empty() ? _u8L("CC2 device not detected") : error_message, status);
return;
}
persist_sn(Http::get_host_header_value(m_host), token, serial_number);
@@ -531,7 +531,7 @@ namespace Slic3r {
if (std::regex_search(body, match, re)) {
res = true;
} else {
msg = format_error(body, "ElegooLink not detected", 0);
msg = format_error(body, _u8L("ElegooLink not detected"), 0);
res = false;
}
})
@@ -570,16 +570,16 @@ namespace Slic3r {
error % status % body;
res = false;
if (status == 401 || status == 403)
msg = format_error(body, "Invalid access code", status);
msg = format_error(body, _u8L("Invalid access code"), status);
else
msg = format_error(body, error.empty() ? "CC2 device not detected" : error, status);
msg = format_error(body, error.empty() ? _u8L("CC2 device not detected") : error, status);
})
.on_complete([&](std::string body, unsigned status) {
std::string error_message;
std::string serial_number;
if (!parse_cc2_response(body, error_message, &serial_number)) {
res = false;
msg = format_error(body, error_message.empty() ? "CC2 device not detected" : error_message, status);
msg = format_error(body, error_message.empty() ? _u8L("CC2 device not detected") : error_message, status);
return;
}
res = true;
@@ -735,7 +735,7 @@ namespace Slic3r {
} else {
// get error messages
pt::ptree messages = root.get_child("messages");
std::string error_message = "ErrorCode : " + code + "\n";
std::string error_message = (boost::format(_u8L("Error code: %1%")) % code).str() + "\n";
for (pt::ptree::value_type& message : messages) {
std::string field = message.second.get<std::string>("field");
std::string msg = message.second.get<std::string>("message");
@@ -745,10 +745,10 @@ namespace Slic3r {
}
} catch (...) {
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error parsing response: %2%") % name % body;
error_fn(wxString::FromUTF8("Error parsing response"));
error_fn(_L("Error parsing response"));
}
} else {
error_fn(format_error(body, "upload failed", status));
error_fn(format_error(body, _u8L("Upload failed"), status));
}
})
.on_error([&](std::string body, std::string error, unsigned status) {
@@ -921,7 +921,7 @@ namespace Slic3r {
BOOST_LOG_TRIVIAL(debug) << boost::format("%1%: CC2 chunk uploaded: HTTP %2%: %3%") % name % status % body;
std::string error_message;
if (!parse_cc2_response(body, error_message)) {
error_fn(format_error(body, error_message.empty() ? "CC2 upload failed" : error_message, status));
error_fn(format_error(body, error_message.empty() ? _u8L("CC2 upload failed") : error_message, status));
return;
}
result = true;
@@ -929,9 +929,9 @@ namespace Slic3r {
.on_error([&](std::string body, std::string error, unsigned status) {
BOOST_LOG_TRIVIAL(error) << boost::format("%1%: Error uploading CC2 chunk: %2%, HTTP %3%, body: `%4%`") % name % error % status % body;
if (status == 401 || status == 403)
error_fn(format_error(body, "Invalid access code", status));
error_fn(format_error(body, _u8L("Invalid access code"), status));
else
error_fn(format_error(body, error.empty() ? "CC2 upload failed" : error, status));
error_fn(format_error(body, error.empty() ? _u8L("CC2 upload failed") : error, status));
})
.on_progress([&](Http::Progress progress, bool& cancel) {
if (progress.ultotal == progress.ulnow)