Reworked selection of locales and translation dictionaries.

Slicer now tries to heed user's locales, also it tries to switch
to the language recommended by the operating system (Windows & OSX
specific).
This commit is contained in:
bubnikv 2019-08-29 14:07:45 +02:00
parent d60480ca7c
commit 468abfefbc
2 changed files with 104 additions and 95 deletions

View file

@ -88,7 +88,7 @@ class GUI_App : public wxApp
size_t m_em_unit; // width of a "m"-symbol in pixels for current system font
// Note: for 100% Scale m_em_unit = 10 -> it's a good enough coefficient for a size setting of controls
wxLocale* m_wxLocale{ nullptr };
std::unique_ptr<wxLocale> m_wxLocale;
std::unique_ptr<ImGuiWrapper> m_imgui;
std::unique_ptr<PrintHostJobQueue> m_printhost_job_queue;
@ -132,7 +132,7 @@ public:
void update_ui_from_settings();
bool switch_language();
bool load_language(wxString language);
bool load_language(wxString language, bool initial);
Tab* get_tab(Preset::Type type);
ConfigOptionMode get_mode();
@ -144,7 +144,7 @@ public:
bool checked_tab(Tab* tab);
void load_current_presets();
wxString current_language_code() const { assert(m_wxLocale != nullptr); return m_wxLocale->GetCanonicalName(); }
wxString current_language_code() const { return m_wxLocale->GetCanonicalName(); }
// Translate the language code to a code, for which Prusa Research maintains translations. Defaults to "en_US".
wxString current_language_code_safe() const;
@ -187,7 +187,6 @@ private:
void window_pos_restore(wxTopLevelWindow* window, const std::string &name, bool default_maximized = false);
void window_pos_sanitize(wxTopLevelWindow* window);
bool select_language();
std::vector<const wxLanguageInfo*> get_installed_languages();
#ifdef __WXMSW__
void associate_3mf_files();
#endif // __WXMSW__