mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-13 19:01:21 +00:00
Translate the web dialogs and pages through the .po catalogs (#16363)
This commit is contained in:
@@ -73,6 +73,7 @@
|
||||
#include "Plater.hpp"
|
||||
#include <boost/dll.hpp>
|
||||
#include <slic3r/GUI/Widgets/WebView.hpp>
|
||||
#include <slic3r/GUI/Widgets/WebViewHostDialog.hpp>
|
||||
#include <libslic3r/Utils.hpp>
|
||||
#include "CreatePresetsDialog.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
@@ -85,6 +86,71 @@ using namespace nlohmann;
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
// The strings of every setup wizard page (resources/web/guide), keyed by their data-i18n and T() ids.
|
||||
// The pages share one web view, so they share one table.
|
||||
static json guide_strings()
|
||||
{
|
||||
return {
|
||||
{"loading", _u8L("Loading…")},
|
||||
{"welcome", _u8L("Welcome to Orca Slicer")},
|
||||
{"setup_intro", _u8L("Orca Slicer will be set up in several steps. Let's start!")},
|
||||
{"get_started", _u8L("Get Started")},
|
||||
{"login_region", _u8L("Please select your login region")},
|
||||
{"asia_pacific", _u8L("Asia-Pacific")},
|
||||
{"china", _u8L("China")},
|
||||
{"europe", _u8L("Europe")},
|
||||
{"north_america", _u8L("North America")},
|
||||
{"others", _u8L("Others")},
|
||||
{"back", _u8L_CONTEXT("Back", "Navigation")},
|
||||
{"next", _u8L("Next")},
|
||||
{"finish", _u8L("Finish")},
|
||||
{"confirm", _u8L("Confirm")},
|
||||
{"cancel", _u8L("Cancel")},
|
||||
{"ok", _u8L("OK")},
|
||||
{"yes", _u8L("Yes")},
|
||||
{"no", _u8L("No")},
|
||||
{"error", _u8L("Error")},
|
||||
{"information", _u8L("Information")},
|
||||
{"printer_selection", _u8L("Printer Selection")},
|
||||
{"vendors", _u8L("Vendors")},
|
||||
{"search", _u8L("Search")},
|
||||
{"custom_printer", _u8L("Custom Printer")},
|
||||
{"nozzle", _u8L("Nozzle")},
|
||||
{"create", _u8L("Create")},
|
||||
{"check_new_printers", _u8L("Check for new printers")},
|
||||
{"printer_required", _u8L("At least one printer must be selected.")},
|
||||
{"new_printers_found", _u8L("New printers found")},
|
||||
{"new_vendors_installed", _u8L("New printer vendors installed: %s")},
|
||||
{"vendors_declined", _u8L("New printer vendors were found, but installation was cancelled.")},
|
||||
{"no_new_printers", _u8L("No new printers found.")},
|
||||
{"filament_selection", _u8L("Filament Selection")},
|
||||
{"system_filaments", _u8L("System Filaments")},
|
||||
{"custom_filaments", _u8L("Custom Filaments")},
|
||||
{"create_new", _u8L("Create New")},
|
||||
{"printer", _u8L("Printer")},
|
||||
{"filament_type", _u8L("Filament type")},
|
||||
{"vendor", _u8L("Vendor")},
|
||||
{"all", _u8L("All")},
|
||||
{"no_items", _u8L("No items")},
|
||||
{"filter_items", _u8L("Filter items")},
|
||||
{"checked", _u8L("Checked")},
|
||||
{"unchecked", _u8L("Unchecked")},
|
||||
{"select_filtered", _u8L("Select filtered")},
|
||||
{"select_visible", _u8L("Select visible")},
|
||||
{"clear_all", _u8L("Clear all")},
|
||||
{"filament_required", _u8L("At least one filament must be selected.")},
|
||||
{"use_default_filament", _u8L("Do you want to use the default filament?")},
|
||||
{"stealth_mode", _u8L("Stealth Mode")},
|
||||
{"stealth_mode_desc", _u8L("This disables all cloud features, including Orca Cloud profile syncing. Users who prefer to work entirely offline can enable this option.")},
|
||||
{"stealth_mode_note", _u8L("Note: When Stealth Mode is enabled, your user profiles will not be backed up to Orca Cloud.")},
|
||||
{"enable_stealth_mode", _u8L("Enable Stealth Mode.")},
|
||||
{"proprietary_plugins", _u8L("Proprietary Plugins")},
|
||||
{"proprietary_plugins_desc", _u8L("Some printer vendors require proprietary plugins for communication with their printers. Please select the corresponding plugin if you use such printers.")},
|
||||
{"proprietary_plugins_risk", _u8L("Please be aware that these plugins are not developed or maintained by OrcaSlicer. They should be used at your own discretion and risk.")},
|
||||
{"install_bambu_plugin", _u8L("Install Bambu Network plug-in")},
|
||||
};
|
||||
}
|
||||
|
||||
static wxString update_custom_filaments()
|
||||
{
|
||||
json m_Res = json::object();
|
||||
@@ -157,6 +223,7 @@ GuideFrame::GuideFrame(GUI_App *pGUI, long style)
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
// INI
|
||||
m_SectionName = "firstguide";
|
||||
m_page = BBL_WELCOME;
|
||||
PrivacyUse = false;
|
||||
StealthMode = false;
|
||||
InstallNetplugin = false;
|
||||
@@ -166,15 +233,14 @@ GuideFrame::GuideFrame(GUI_App *pGUI, long style)
|
||||
// set the frame icon
|
||||
wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
wxString TargetUrl = SetStartPage(BBL_WELCOME, false);
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", set start page to welcome ");
|
||||
|
||||
// Create the webview
|
||||
m_browser = WebView::CreateWebView(this, TargetUrl);
|
||||
// Created empty and loaded by SetStartPage(BBL_REGION) below, after the strings are added, so the
|
||||
// first load already has them.
|
||||
m_browser = WebView::CreateWebView(this, wxEmptyString);
|
||||
if (m_browser == nullptr) {
|
||||
wxLogError("Could not init m_browser");
|
||||
return;
|
||||
}
|
||||
m_browser->AddUserScript(wxString::FromUTF8(WebViewHostDialog::localized_strings_script(guide_strings())));
|
||||
m_browser->Hide();
|
||||
m_browser->SetSize(0, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user