User interface for language selection.
[dcpomatic.git] / src / tools / dvdomatic.cc
index f5d9bdf181a3e82b3a40dac108c75bc129cca020..66f366a24148d7ea1ee1f07966ed73b04b172389 100644 (file)
@@ -407,12 +407,22 @@ private:
                }
                info.SetDescription (_("Free, open-source DCP generation from almost anything."));
                info.SetCopyright (_("(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole Laursen"));
+
                wxArrayString authors;
                authors.Add (wxT ("Carl Hetherington"));
                authors.Add (wxT ("Terrence Meiczinger"));
                authors.Add (wxT ("Paul Davis"));
                authors.Add (wxT ("Ole Laursen"));
                info.SetDevelopers (authors);
+
+               wxArrayString translators;
+               translators.Add (wxT ("Olivier Perriere"));
+               translators.Add (wxT ("Lilian Lefranc"));
+               translators.Add (wxT ("Thierry Journet"));
+               translators.Add (wxT ("Massimiliano Broggi"));
+               translators.Add (wxT ("Manuel AC"));
+               info.SetTranslators (translators);
+               
                info.SetWebSite (wxT ("http://carlh.net/software/dvdomatic"));
                wxAboutBox (info);
        }
@@ -438,13 +448,18 @@ void
 setup_i18n ()
 {
        int language = wxLANGUAGE_DEFAULT;
+
+       if (Config::instance()->language()) {
+               wxLanguageInfo const * li = wxLocale::FindLanguageInfo (std_to_wx (Config::instance()->language().get()));
+               language = li->Language;
+       }
  
        if (wxLocale::IsAvailable (language)) {
                locale = new wxLocale (language, wxLOCALE_LOAD_DEFAULT);
 
-#ifdef __WXGTK__
-               locale->AddCatalogLookupPathPrefix (wxT (LOCALE_PREFIX "/locale"));
-#endif
+#ifdef DVDOMATIC_WINDOWS
+               locale->AddCatalogLookupPathPrefix (std_to_wx (mo_path().string()));
+#endif         
 
                locale->AddCatalog (wxT ("libdvdomatic-wx"));
                locale->AddCatalog (wxT ("dvdomatic"));
@@ -455,6 +470,10 @@ setup_i18n ()
                        language = wxLANGUAGE_ENGLISH;
                }
        }
+
+       if (locale) {
+               dvdomatic_setup_i18n (wx_to_std (locale->GetCanonicalName ()));
+       }
 }
 
 class App : public wxApp
@@ -468,12 +487,27 @@ class App : public wxApp
 #ifdef DVDOMATIC_POSIX         
                unsetenv ("UBUNTU_MENUPROXY");
 #endif         
-               
+
                wxInitAllImageHandlers ();
+
+               /* Enable i18n; this will create a Config object
+                  to look for a force-configured language.  This Config
+                  object will be wrong, however, because dvdomatic_setup
+                  hasn't yet been called and there aren't any scalers, filters etc.
+                  set up yet.
+               */
                setup_i18n ();
-               
+
+               /* Set things up, including scalers / filters etc.
+                  which will now be internationalised correctly.
+               */
                dvdomatic_setup ();
 
+               /* Force the configuration to be re-loaded correctly next
+                  time it is needed.
+               */
+               Config::drop ();
+
                if (!film_to_load.empty() && boost::filesystem::is_directory (film_to_load)) {
                        try {
                                film.reset (new Film (film_to_load));