From 2287c1963b60aca4905c763b81091efa3dd1472d Mon Sep 17 00:00:00 2001 From: guillaume Date: Fri, 5 Jun 2009 15:47:47 +0000 Subject: [PATCH] =?utf8?q?Get=20translated=20help=20with=20--help=20option?= =?utf8?q?,=20per=20a=20remark=20from=20Marek=20=C4=8Cernock=C3=BD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.pgadmin.org/trunk/pgadmin3@7896 a7884b65-44f6-0310-8a51-81a127f17b15 --- pgadmin/pgAdmin3.cpp | 124 +++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/pgadmin/pgAdmin3.cpp b/pgadmin/pgAdmin3.cpp index d267346ea..0691dc2d7 100644 --- a/pgadmin/pgAdmin3.cpp +++ b/pgadmin/pgAdmin3.cpp @@ -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 -- 2.39.5