Get translated help with --help option, per a remark from Marek Černocký.
authorguillaume <guillaume@a7884b65-44f6-0310-8a51-81a127f17b15>
Fri, 5 Jun 2009 15:47:47 +0000 (15:47 +0000)
committerguillaume <guillaume@a7884b65-44f6-0310-8a51-81a127f17b15>
Fri, 5 Jun 2009 15:47:47 +0000 (15:47 +0000)
git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@7896 a7884b65-44f6-0310-8a51-81a127f17b15

pgadmin/pgAdmin3.cpp

index d267346ea9e548b6d9d860c0299e8b1ac2d1a3f0..0691dc2d753b7ff299813bfbb7ac7cef68ae451d 100644 (file)
@@ -189,6 +189,68 @@ bool pgAdmin3::OnInit()
     wxLog *seLog=new wxLogStderr();
     wxLog::SetActiveTarget(seLog);
       
+    // Setup the basic paths for the app installation. Required by settings!
+    InitAppPaths();
+
+    // Load the Settings
+#ifdef __WXMSW__
+    settings = new sysSettings(wxT("pgAdmin III"));
+#else
+    settings = new sysSettings(wxT("pgadmin3"));
+#endif
+
+    // Setup additional helper paths etc. Requires settings!
+    InitXtraPaths();
+
+    locale = new wxLocale();
+    locale->AddCatalogLookupPathPrefix(i18nPath);
+
+    wxLanguage langId = (wxLanguage)settings->Read(wxT("LanguageId"), wxLANGUAGE_DEFAULT);
+    if (locale->Init(langId))
+    {
+#ifdef __LINUX__
+        {
+            wxLogNull noLog;
+            locale->AddCatalog(wxT("fileutils"));
+        }
+#endif
+        locale->AddCatalog(wxT("pgadmin3"));
+    }
+
+
+    long langCount=0;
+    const wxLanguageInfo *langInfo;
+
+    wxString langfile=FileRead(i18nPath + wxT("/") LANG_FILE, 1);
+
+    if (!langfile.IsEmpty())
+    {
+        wxStringTokenizer tk(langfile, wxT("\n\r"));
+
+        while (tk.HasMoreTokens())
+        {
+            wxString line=tk.GetNextToken().Strip(wxString::both);
+            if (line.IsEmpty() || line.StartsWith(wxT("#")))
+                continue;
+
+            wxString englishName=line.BeforeFirst(',').Trim(true);
+            wxString translatedName=line.AfterFirst(',').Trim(false);
+
+            langInfo=wxLocale::FindLanguageInfo(englishName);
+            if (langInfo)
+            {
+                if (langInfo->CanonicalName == wxT("en_US") || 
+                    (!langInfo->CanonicalName.IsEmpty() && 
+                     wxDir::Exists(i18nPath + wxT("/") + langInfo->CanonicalName)))
+                {
+                    existingLangs.Add(langInfo->Language);
+                    existingLangNames.Add(translatedName);
+                    langCount++;
+                }
+            }
+        }
+    }
+
     static const wxCmdLineEntryDesc cmdLineDesc[] = 
     {
         {wxCMD_LINE_SWITCH, wxT("h"), wxT("help"), _("show this help message"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
@@ -206,19 +268,6 @@ bool pgAdmin3::OnInit()
         {wxCMD_LINE_NONE}
     };
 
-    // Setup the basic paths for the app installation. Required by settings!
-    InitAppPaths();
-
-    // Load the Settings
-#ifdef __WXMSW__
-    settings = new sysSettings(wxT("pgAdmin III"));
-#else
-    settings = new sysSettings(wxT("pgadmin3"));
-#endif
-
-    // Setup additional helper paths etc. Requires settings!
-    InitXtraPaths();
-
     frmConfig::tryMode configMode=frmConfig::NONE;
     wxString configFile;
 
@@ -301,55 +350,6 @@ bool pgAdmin3::OnInit()
     signal(SIGPIPE, SIG_IGN);
 #endif
 
-    locale = new wxLocale();
-    locale->AddCatalogLookupPathPrefix(i18nPath);
-
-    wxLanguage langId = (wxLanguage)settings->Read(wxT("LanguageId"), wxLANGUAGE_DEFAULT);
-    if (locale->Init(langId))
-    {
-#ifdef __LINUX__
-        {
-            wxLogNull noLog;
-            locale->AddCatalog(wxT("fileutils"));
-        }
-#endif
-        locale->AddCatalog(wxT("pgadmin3"));
-    }
-
-
-    long langCount=0;
-    const wxLanguageInfo *langInfo;
-
-    wxString langfile=FileRead(i18nPath + wxT("/") LANG_FILE, 1);
-
-    if (!langfile.IsEmpty())
-    {
-        wxStringTokenizer tk(langfile, wxT("\n\r"));
-
-        while (tk.HasMoreTokens())
-        {
-            wxString line=tk.GetNextToken().Strip(wxString::both);
-            if (line.IsEmpty() || line.StartsWith(wxT("#")))
-                continue;
-
-            wxString englishName=line.BeforeFirst(',').Trim(true);
-            wxString translatedName=line.AfterFirst(',').Trim(false);
-
-            langInfo=wxLocale::FindLanguageInfo(englishName);
-            if (langInfo)
-            {
-                if (langInfo->CanonicalName == wxT("en_US") || 
-                    (!langInfo->CanonicalName.IsEmpty() && 
-                     wxDir::Exists(i18nPath + wxT("/") + langInfo->CanonicalName)))
-                {
-                    existingLangs.Add(langInfo->Language);
-                    existingLangNames.Add(translatedName);
-                    langCount++;
-                }
-            }
-        }
-    }
-
     // Show the splash screen
     // NOTE: We must *always* do this as in -q and -qc modes
     //       the splash screen becomes the top level window and