Localized the (modified) profile indicator

This commit is contained in:
YuSanka 2018-07-23 15:44:01 +02:00
parent 40b55a3818
commit dd088ba0cc
7 changed files with 3867 additions and 2185 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -250,6 +250,7 @@ bool select_language(wxArrayString & names,
g_wxLocale->AddCatalogLookupPathPrefix(wxPathOnly(localization_dir())); g_wxLocale->AddCatalogLookupPathPrefix(wxPathOnly(localization_dir()));
g_wxLocale->AddCatalog(g_wxApp->GetAppName()); g_wxLocale->AddCatalog(g_wxApp->GetAppName());
wxSetlocale(LC_NUMERIC, "C"); wxSetlocale(LC_NUMERIC, "C");
Preset::update_suffix_modified();
return true; return true;
} }
return false; return false;
@ -275,6 +276,7 @@ bool load_language()
g_wxLocale->AddCatalogLookupPathPrefix(wxPathOnly(localization_dir())); g_wxLocale->AddCatalogLookupPathPrefix(wxPathOnly(localization_dir()));
g_wxLocale->AddCatalog(g_wxApp->GetAppName()); g_wxLocale->AddCatalog(g_wxApp->GetAppName());
wxSetlocale(LC_NUMERIC, "C"); wxSetlocale(LC_NUMERIC, "C");
Preset::update_suffix_modified();
return true; return true;
} }
} }

View file

@ -146,6 +146,11 @@ const std::string& Preset::suffix_modified()
{ {
return g_suffix_modified; return g_suffix_modified;
} }
void Preset::update_suffix_modified()
{
g_suffix_modified = (" (" + _(L("modified")) + ")").ToUTF8().data();
}
// Remove an optional "(modified)" suffix from a name. // Remove an optional "(modified)" suffix from a name.
// This converts a UI name to a unique preset identifier. // This converts a UI name to a unique preset identifier.
std::string Preset::remove_suffix_modified(const std::string &name) std::string Preset::remove_suffix_modified(const std::string &name)

View file

@ -167,6 +167,7 @@ public:
static const std::vector<std::string>& printer_options(); static const std::vector<std::string>& printer_options();
// Nozzle options of the printer options. // Nozzle options of the printer options.
static const std::vector<std::string>& nozzle_options(); static const std::vector<std::string>& nozzle_options();
static void update_suffix_modified();
protected: protected:
friend class PresetCollection; friend class PresetCollection;
@ -260,7 +261,7 @@ public:
// used to update preset_choice from Tab // used to update preset_choice from Tab
const std::deque<Preset>& get_presets() { return m_presets; } const std::deque<Preset>& get_presets() { return m_presets; }
int get_idx_selected() { return m_idx_selected; } int get_idx_selected() { return m_idx_selected; }
const std::string& get_suffix_modified(); static const std::string& get_suffix_modified();
// Return a preset possibly with modifications. // Return a preset possibly with modifications.
Preset& default_preset() { return m_presets.front(); } Preset& default_preset() { return m_presets.front(); }

View file

@ -2728,7 +2728,7 @@ void SavePresetWindow::accept()
const char* unusable_symbols = "<>:/\\|?*\""; const char* unusable_symbols = "<>:/\\|?*\"";
bool is_unusable_symbol = false; bool is_unusable_symbol = false;
bool is_unusable_postfix = false; bool is_unusable_postfix = false;
const std::string unusable_postfix = "(modified)"; const std::string unusable_postfix = PresetCollection::get_suffix_modified();//"(modified)";
for (size_t i = 0; i < std::strlen(unusable_symbols); i++){ for (size_t i = 0; i < std::strlen(unusable_symbols); i++){
if (m_chosen_name.find_first_of(unusable_symbols[i]) != std::string::npos){ if (m_chosen_name.find_first_of(unusable_symbols[i]) != std::string::npos){
is_unusable_symbol = true; is_unusable_symbol = true;
@ -2743,8 +2743,9 @@ void SavePresetWindow::accept()
_(L("the following characters are not allowed:")) + " <>:/\\|?*\""); _(L("the following characters are not allowed:")) + " <>:/\\|?*\"");
} }
else if (is_unusable_postfix){ else if (is_unusable_postfix){
show_error(this, _(L("The supplied name is not valid;")) + "\n" + show_error(this,_(L("The supplied name is not valid;")) + "\n" +
_(L("the following postfix are not allowed:")) + "\n\t" + unusable_postfix); _(L("the following postfix are not allowed:")) + "\n\t" + //unusable_postfix);
wxString::FromUTF8(unusable_postfix.c_str()));
} }
else if (m_chosen_name.compare("- default -") == 0) { else if (m_chosen_name.compare("- default -") == 0) {
show_error(this, _(L("The supplied name is not available."))); show_error(this, _(L("The supplied name is not available.")));