Просмотр исходного кода

fix some un-localizable strings.

remi durand 3 лет назад
Родитель
Сommit
055794f822

+ 5 - 5
resources/localization/pom_merger.py

@@ -475,16 +475,16 @@ def parse_ui_file(file_path):
 			if items[0]=="page":
 				current_line = TranslationLine();
 				current_line.header_comment = "\n#: "+file_path;#+":"+str(line_idx);
-				current_line.raw_msgid = "msgid \""+items[1]+"\"";
-				current_line.msgid = items[1];
+				current_line.raw_msgid = "msgid \""+items[1].strip()+"\"";
+				current_line.msgid = items[1].strip();
 				current_line.raw_msgstr = "msgstr \"\"";
 				current_line.msgstr = "";
 				read_data_lines.append(current_line);
 			if items[0]=="group" or items[0]=="line":
 				current_line = TranslationLine();
 				current_line.header_comment = "\n#: "+file_path;#+":"+str(line_idx);
-				current_line.raw_msgid = "msgid \""+items[-1]+"\"";
-				current_line.msgid = items[-1];
+				current_line.raw_msgid = "msgid \""+items[-1].strip()+"\"";
+				current_line.msgid = items[-1].strip();
 				current_line.raw_msgstr = "msgstr \"\"";
 				current_line.msgstr = "";
 				read_data_lines.append(current_line);
@@ -494,7 +494,7 @@ def parse_ui_file(file_path):
 						if item.split("$")[-1] != '_' and len(item.split("$")[-1]) > 0 :
 							current_line = TranslationLine();
 							current_line.header_comment = "\n#: "+file_path+" : l"+str(line_idx);
-							current_line.msgid = item.split("$")[-1];
+							current_line.msgid = item.split("$")[-1].strip();
 							current_line.raw_msgid = "msgid \""+current_line.msgid+"\"";
 							current_line.raw_msgstr = "msgstr \"\"";
 							current_line.msgstr = "";

+ 1 - 1
resources/ui_layout/print.ui

@@ -65,7 +65,7 @@ group:Advanced
 		setting:label_width$5:label$Seam:perimeter_loop_seam
 	end_line
 	setting:perimeter_round_corners
-group: External perimeter first
+group:External perimeter first
 	setting:label$Activate:external_perimeters_first
 	line:Apply on
 		setting:external_perimeters_nothole

+ 1 - 1
src/slic3r/GUI/GUI_App.cpp

@@ -1783,7 +1783,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
         mode_menu = new wxMenu();
         mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeSimple, _L("Simple"), _L("Simple View Mode"));
 //    mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeAdvanced, _L("Advanced"), _L("Advanced View Mode"));
-        mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeAdvanced, _CTX(L_CONTEXT("Advanced", "Mode"), "Mode"), _L("Advanced View Mode"));
+        mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeAdvanced, _L("Advanced")/*_CTX(L_CONTEXT("Advanced", "Mode"), "Mode")*/, _L("Advanced View Mode"));
         mode_menu->AppendRadioItem(config_id_base + ConfigMenuModeExpert, _L("Expert"), _L("Expert View Mode"));
         Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { if (get_mode() == comSimple) evt.Check(true); }, config_id_base + ConfigMenuModeSimple);
         Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { if (get_mode() == comAdvanced) evt.Check(true); }, config_id_base + ConfigMenuModeAdvanced);

+ 6 - 4
src/slic3r/GUI/OG_CustomCtrl.cpp

@@ -176,9 +176,11 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
                 // add label if any
                 if (!option.label.empty()) {
                     std::string opt_label = (option.label.empty() || option.label.back() != '_') ? option.label : option.label.substr(0, option.label.size() - 1);
+                    std::cout << "translate '" << opt_label << "' to '";
                     //!            To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
-                    label = (opt_label == L_CONTEXT("Top", "Layers") || opt_label == L_CONTEXT("Bottom", "Layers")) ?
-                        _CTX(opt_label, "Layers") : _(opt_label);
+                    label = /*(opt_label == L_CONTEXT("Top", "Layers") || opt_label == L_CONTEXT("Bottom", "Layers")) ?
+                        _CTX(opt_label, "Layers") :*/ _(opt_label);
+                    std::cout << label << "'\n";
                     bool no_dots = label.empty() || option.label.back() == '_';
                     if (!no_dots)
                         label += ":";
@@ -605,8 +607,8 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord v_pos)
         if (!option.label.empty()) {
             std::string opt_label = (option.label.empty() || option.label.back() != '_') ? option.label : option.label.substr(0, option.label.size() - 1);
             //!            To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
-            wxString label = (opt_label == L_CONTEXT("Top", "Layers") || opt_label == L_CONTEXT("Bottom", "Layers")) ?
-                _CTX(opt_label, "Layers") : _(opt_label);
+            wxString label = /*(opt_label == L_CONTEXT("Top", "Layers") || opt_label == L_CONTEXT("Bottom", "Layers")) ?
+                _CTX(opt_label, "Layers") :*/ _(opt_label);
             bool no_dots = label.empty() || option.label.back() == '_';
             if (!no_dots)
                 label += ":";

+ 2 - 2
src/slic3r/GUI/OptionsGroup.cpp

@@ -337,8 +337,8 @@ void OptionsGroup::activate_line(Line& line)
 		if (!option.label.empty() && !custom_ctrl) {
 //!			To correct translation by context have to use wxGETTEXT_IN_CONTEXT macro from wxWidget 3.1.1
 			std::string opt_label = (option.label.empty() || option.label.back() != '_') ? option.label : option.label.substr(0, option.label.size() - 1);
-			wxString str_label = (opt_label == L_CONTEXT("Top", "Layers") || opt_label == L_CONTEXT("Bottom", "Layers")) ?
-								_CTX(opt_label, "Layers") :
+			wxString str_label = /*(opt_label == L_CONTEXT("Top", "Layers") || opt_label == L_CONTEXT("Bottom", "Layers")) ?
+								_CTX(opt_label, "Layers") :*/
 								_(opt_label);
 
             bool no_dots = str_label.empty() || option.label.back() == '_';

+ 24 - 24
src/slic3r/GUI/Preferences.cpp

@@ -112,14 +112,14 @@ void PreferencesDialog::build()
 #if ENABLE_CUSTOMIZABLE_FILES_ASSOCIATION_ON_WIN
 #ifdef _WIN32
 		// Please keep in sync with ConfigWizard
-		def.label = (boost::format(L("Associate .3mf files to %1%")) % SLIC3R_APP_NAME).str();
+		def.label = (boost::format(_u8L("Associate .3mf files to %1%")) % SLIC3R_APP_NAME).str();
 		def.type = coBool;
 		def.tooltip = L("If enabled, sets Slic3r as default application to open .3mf files.");
 		def.set_default_value(new ConfigOptionBool(app_config->get("associate_3mf") == "1"));
 		option = Option(def, "associate_3mf");
 		m_optgroup_general->append_single_option_line(option);
 
-		def.label = (boost::format(L("Associate .stl files to %1%")) % SLIC3R_APP_NAME).str();
+		def.label = (boost::format(_u8L("Associate .stl files to %1%")) % SLIC3R_APP_NAME).str();
 		def.type = coBool;
 		def.tooltip = L("If enabled, sets Slic3r as default application to open .stl files.");
 		def.set_default_value(new ConfigOptionBool(app_config->get("associate_stl") == "1"));
@@ -168,11 +168,11 @@ void PreferencesDialog::build()
 
 		
 #if __APPLE__
-		def.label = (boost::format(L("Allow just a single %1% instance")) % SLIC3R_APP_NAME).str();
+		def.label = (boost::format(_u8L("Allow just a single %1% instance")) % SLIC3R_APP_NAME).str();
 		def.type = coBool;
 	def.tooltip = L("On OSX there is always only one instance of app running by default. However it is allowed to run multiple instances of same app from the command line. In such case this settings will allow only one instance.");
 #else
-		def.label = (boost::format(L("Allow just a single %1% instance")) % SLIC3R_APP_NAME).str();
+		def.label = (boost::format(_u8L("Allow just a single %1% instance")) % SLIC3R_APP_NAME).str();
 		def.type = coBool;
 		def.tooltip = L("If this is enabled, when starting Slic3r and another instance of the same Slic3r is already running, that instance will be reactivated instead.");
 #endif
@@ -211,9 +211,9 @@ void PreferencesDialog::build()
 #if ENABLE_CUSTOMIZABLE_FILES_ASSOCIATION_ON_WIN
 #ifdef _WIN32
 	else {
-		def.label = (boost::format(L("Associate .gcode files to %1%")) % GCODEVIEWER_APP_NAME).str();
+		def.label = (boost::format(_u8L("Associate .gcode files to %1%")) % GCODEVIEWER_APP_NAME).str();
 		def.type = coBool;
-		def.tooltip = (boost::format(L("If enabled, sets %1% as default application to open .gcode files.")) % GCODEVIEWER_APP_NAME).str();
+		def.tooltip = (boost::format(_u8L("If enabled, sets %1% as default application to open .gcode files.")) % GCODEVIEWER_APP_NAME).str();
 		def.set_default_value(new ConfigOptionBool(app_config->get("associate_gcode") == "1"));
 		option = Option(def, "associate_gcode");
 		m_optgroup_general->append_single_option_line(option);
@@ -398,10 +398,10 @@ void PreferencesDialog::build()
 
 	def.label = L("Very dark gui color");
 	def.type = coString;
-	def.tooltip = std::string(L("Very dark color, in the RGB hex format."))
-		+ std::string(L(" Mainly used as background or dark text color."))
-		+ std::string(L("\nYou have to restart the application before any change will be taken into account."))
-		+ std::string(L("\nSlic3r(yellow): ada230, PrusaSlicer(orange): c46737, SuperSlicer(blue): 0047c7"));
+	def.tooltip = _u8L("Very dark color, in the RGB hex format.")
+		+ " "  + _u8L("Mainly used as background or dark text color.")
+		+ "\n" + _u8L("You have to restart the application before any change will be taken into account.")
+		+ "\n" + _u8L("Slic3r(yellow): ada230, PrusaSlicer(orange): c46737, SuperSlicer(blue): 0047c7");
 	def.set_default_value(new ConfigOptionString{ app_config->get("color_very_dark") });
 	option = Option(def, "color_very_dark");
 	option.opt.width = 6;
@@ -409,10 +409,10 @@ void PreferencesDialog::build()
 
 	def.label = L("Dark gui color");
 	def.type = coString;
-	def.tooltip = std::string(L("Dark color, in the RGB hex format."))
-		+ std::string(L(" Mainly used as icon color."))
-		+ std::string(L("\nYou have to restart the application before any change will be taken into account."))
-		+ std::string(L("\nSlic3r(yellow): cabe39, PrusaSlicer(orange): ed6b21, SuperSlicer(blue): 2172eb"));
+	def.tooltip = _u8L("Dark color, in the RGB hex format.")
+		+ " " + _u8L("Mainly used as icon color.")
+		+ "\n" + _u8L("You have to restart the application before any change will be taken into account.")
+		+ "\n" + _u8L("Slic3r(yellow): cabe39, PrusaSlicer(orange): ed6b21, SuperSlicer(blue): 2172eb");
 	def.set_default_value(new ConfigOptionString{ app_config->get("color_dark") });
 	option = Option(def, "color_dark");
 	option.opt.width = 6;
@@ -420,9 +420,9 @@ void PreferencesDialog::build()
 
 	def.label = L("Gui color");
 	def.type = coString;
-	def.tooltip = std::string(L("Main color, in the RGB hex format."))
-		+ std::string(L("\nYou have to restart the application before any change will be taken into account.")) 
-		+ std::string(L(" Slic3r(yellow): eddc21, PrusaSlicer(orange): fd7e42, SuperSlicer(blue): 428dfd"));
+	def.tooltip = _u8L("Main color, in the RGB hex format.")
+		+ "\n" + _u8L("You have to restart the application before any change will be taken into account.")
+		+ " " + _u8L("Slic3r(yellow): eddc21, PrusaSlicer(orange): fd7e42, SuperSlicer(blue): 428dfd");
 	def.set_default_value(new ConfigOptionString{ app_config->get("color") });
 	option = Option(def, "color");
 	option.opt.width = 6;
@@ -430,9 +430,9 @@ void PreferencesDialog::build()
 
 	def.label = L("Light gui color");
 	def.type = coString;
-	def.tooltip = std::string(L("Light color, in the RGB hex format."))
-		+ std::string(L("\nYou have to restart the application before any change will be taken into account.")) 
-		+ std::string(L(" Slic3r(yellow): ffee38, PrusaSlicer(orange): feac8b, SuperSlicer(blue): 8bb9fe"));
+	def.tooltip = _u8L("Light color, in the RGB hex format.")
+		+ "\n" + _u8L("You have to restart the application before any change will be taken into account.")
+		+ " " + _u8L("Slic3r(yellow): ffee38, PrusaSlicer(orange): feac8b, SuperSlicer(blue): 8bb9fe");
 	def.set_default_value(new ConfigOptionString{ app_config->get("color_light") });
 	option = Option(def, "color_light");
 	option.opt.width = 6;
@@ -440,10 +440,10 @@ void PreferencesDialog::build()
 
 	def.label = L("Very light gui color");
 	def.type = coString;
-	def.tooltip = std::string(L("Very light color, in the RGB hex format."))
-		+ std::string(L(" Mainly used as light text color."))
-		+ std::string(L("\nYou have to restart the application before any change will be taken into account."))
-		+ std::string(L("\nSlic3r(yellow): fef48b, PrusaSlicer(orange): ff7d38, SuperSlicer(blue): 428cff"));
+	def.tooltip = _u8L("Very light color, in the RGB hex format.")
+		+ " " + _u8L("Mainly used as light text color.")
+		+ "\n" + _u8L("You have to restart the application before any change will be taken into account.")
+		+ "\n" + _u8L("Slic3r(yellow): fef48b, PrusaSlicer(orange): ff7d38, SuperSlicer(blue): 428cff");
 	def.set_default_value(new ConfigOptionString{ app_config->get("color_very_light") });
 	option = Option(def, "color_very_light");
 	option.opt.width = 6;

+ 1 - 1
src/slic3r/GUI/SavePresetDialog.cpp

@@ -212,7 +212,7 @@ void SavePresetDialog::build(std::vector<Preset::Type> types, std::string suffix
 #endif // ENABLE_WX_3_1_3_DPI_CHANGED_EVENT
 
     if (suffix.empty())
-        suffix = _CTX_utf8(L_CONTEXT("Copy", "PresetName"), "PresetName");
+        suffix = _u8L("Copy")/*_CTX_utf8(L_CONTEXT("Copy", "PresetName") , "PresetName")*/;
 
     wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
 

+ 7 - 7
src/slic3r/GUI/Tab.cpp

@@ -1571,7 +1571,7 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page)
                 }
             }
             
-            current_group = current_page->new_optgroup(_L(params.back()), nolabel?0:-1);
+            current_group = current_page->new_optgroup(_(params.back()), nolabel?0:-1);
             for (int i = 1; i < params.size() - 1; i++) {
                 if (boost::starts_with(params[i], "title_width$")) {
                     current_group->title_width = atoi(params[i].substr(12, params[i].size() - 12).c_str());
@@ -1790,7 +1790,7 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page)
                 }
                 else if (params[i] == "full_label")
                 {
-                    option.opt.full_label = L(params[i].substr(11, params[i].size() - 11));
+                    option.opt.full_label = (params[i].substr(11, params[i].size() - 11));
                     need_to_notified_search = true;
                 }
                 else if (params[i] == "full_label")
@@ -1800,7 +1800,7 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page)
                 }
                 else if (boost::starts_with(params[i], "label$"))
                 {
-                    option.opt.label = L(params[i].substr(6, params[i].size() - 6));
+                    option.opt.label = (params[i].substr(6, params[i].size() - 6));
                     need_to_notified_search = true;
                 }
                 else if (boost::starts_with(params[i], "label_width$")) {
@@ -1808,7 +1808,7 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page)
                 }
                 else if (boost::starts_with(params[i], "sidetext$"))
                 {
-                    option.opt.sidetext = L(params[i].substr(9, params[i].size() - 9));
+                    option.opt.sidetext = (params[i].substr(9, params[i].size() - 9));
                 }
                 else if (boost::starts_with(params[i], "sidetext_width$"))
                 {
@@ -1834,7 +1834,7 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page)
                 }
                 else if (boost::starts_with(params[i], "tooltip$"))
                 {
-                    option.opt.tooltip = L(params[i].substr(8, params[i].size() - 8));
+                    option.opt.tooltip = (params[i].substr(8, params[i].size() - 8));
                     need_to_notified_search = true;
                 }
             }
@@ -2562,13 +2562,13 @@ PageShp TabPrinter::build_kinematics_page()
         def.gui_type = "legend";
         def.mode = comAdvanced;
         def.tooltip = L("Values in this column are for Normal mode");
-        def.set_default_value(new ConfigOptionString{ _(L("Normal")).ToUTF8().data() });
+        def.set_default_value(new ConfigOptionString{ _u8L("Normal").data() });
 
         auto option = Option(def, "full_power_legend");
         line.append_option(option);
 
         def.tooltip = L("Values in this column are for Stealth mode");
-        def.set_default_value(new ConfigOptionString{ _(L("Stealth")).ToUTF8().data() });
+        def.set_default_value(new ConfigOptionString{ _u8L("Stealth").data() });
         option = Option(def, "silent_legend");
         line.append_option(option);
 

+ 3 - 3
src/slic3r/GUI/wxExtensions.cpp

@@ -706,10 +706,10 @@ ModeSizer::ModeSizer(wxWindow *parent, int hgap/* = 0*/) :
     SetFlexibleDirection(wxHORIZONTAL);
 
     std::vector < std::pair < wxString, std::string >> buttons = {
-        {_(L("Simple")),    "mode_simple"},
+        {_L("Simple"),    "mode_simple"},
 //        {_(L("Advanced")),  "mode_advanced"},
-        {_CTX(L_CONTEXT("Advanced", "Mode"), "Mode"), "mode_advanced"},
-        {_(L("Expert")),    "mode_expert"},
+        {_L("Advanced") /*_CTX(L_CONTEXT("Advanced", "Mode") , "Mode")*/, "mode_advanced"},
+        {_L("Expert"),    "mode_expert"},
     };
 
     auto modebtnfn = [](wxCommandEvent &event, int mode_id) {