summaryrefslogtreecommitdiff
path: root/src/wx/wx_util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-21 12:56:47 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-21 12:56:47 +0100
commit5f0f0de782100a5cb558f30c7768c8af0c19bcb7 (patch)
treeacb5c1624e6b5687f94eca0882c37afb0971018c /src/wx/wx_util.cc
parent3fc3aad8735903ced3dae65f764eb33e3f5b3f11 (diff)
parent47e6b6725168213f2a7db24c2965cfa173f755b4 (diff)
Merge master.
Diffstat (limited to 'src/wx/wx_util.cc')
-rw-r--r--src/wx/wx_util.cc38
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 ()));
+ }
+}