diff options
Diffstat (limited to 'src/wx/wx_util.cc')
| -rw-r--r-- | src/wx/wx_util.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 77f5da293..1a7b73faf 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -25,6 +25,8 @@ #include <wx/filepicker.h> #include <wx/spinctrl.h> #include "wx_util.h" +#include "config.h" +#include "util.h" using namespace std; using namespace boost; @@ -211,3 +213,39 @@ checked_set (wxRadioButton* widget, bool value) widget->SetValue (value); } } + +void +dvdomatic_setup_i18n () +{ + int language = wxLANGUAGE_DEFAULT; + + boost::optional<string> config_lang = Config::instance()->language (); + if (config_lang && !config_lang->empty ()) { + wxLanguageInfo const * li = wxLocale::FindLanguageInfo (std_to_wx (config_lang.get ())); + if (li) { + language = li->Language; + } + } + + wxLocale* locale = 0; + if (wxLocale::IsAvailable (language)) { + locale = new wxLocale (language, wxLOCALE_LOAD_DEFAULT); + +#ifdef DVDOMATIC_WINDOWS + locale->AddCatalogLookupPathPrefix (std_to_wx (mo_path().string())); +#endif + + locale->AddCatalog (wxT ("libdvdomatic-wx")); + locale->AddCatalog (wxT ("dvdomatic")); + + if (!locale->IsOk()) { + delete locale; + locale = new wxLocale (wxLANGUAGE_ENGLISH); + language = wxLANGUAGE_ENGLISH; + } + } + + if (locale) { + dvdomatic_setup_gettext_i18n (wx_to_std (locale->GetCanonicalName ())); + } +} |
