User interface for language selection.
[dcpomatic.git] / src / tools / dvdomatic.cc
index 8cbd8527035cfa8c9b095ddb37346bc9c979ea8b..66f366a24148d7ea1ee1f07966ed73b04b172389 100644 (file)
@@ -416,7 +416,11 @@ private:
                info.SetDevelopers (authors);
 
                wxArrayString translators;
-               translators.Add (wxT ("Olivier (freedcp.net"));
+               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"));
@@ -444,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"));
@@ -461,6 +470,10 @@ setup_i18n ()
                        language = wxLANGUAGE_ENGLISH;
                }
        }
+
+       if (locale) {
+               dvdomatic_setup_i18n (wx_to_std (locale->GetCanonicalName ()));
+       }
 }
 
 class App : public wxApp
@@ -474,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));