Issue with spanish and serbian translations - Mailing list pgadmin-hackers

From Guillaume Lelarge
Subject Issue with spanish and serbian translations
Date
Msg-id 4635D7D2.8010709@lelarge.info
Whole thread Raw
Responses Re: Issue with spanish and serbian translations  (Dave Page <dpage@postgresql.org>)
List pgadmin-hackers
Hi,

I've worked on an issue reported by Diego Gil. There's no spanish and
serbian options in the combo box of the options's dialog.

I've looked at this issue a bit. The problem seems related to
pgAdmin3::OnInit method in src/pgAdmin3.cpp. Here is the specific part :

while (true)
{
   langInfo=wxLocale::GetLanguageInfo(langNo);
   if (!langInfo)
     break;

   if (englishName == langInfo->Description &&
     (langInfo->CanonicalName == wxT("en_US") ||
     (!langInfo->CanonicalName.IsEmpty() &&
     wxDir::Exists(i18nPath + wxT("/") + langInfo->CanonicalName))))
   {
     existingLangs.Add(langNo);
     existingLangNames.Add(translatedName);
     langCount++;
   }
   langNo++;
}

I tried with the change on the patch attached. Now, I see the spanish
option, but the serbian one is still missing. And start time is quite
longer.

I also took a look at the internat sample from wxWidgets. They use an
array to list all translations available... :
static const wxLanguage langIds[] =
{
     wxLANGUAGE_DEFAULT,
     wxLANGUAGE_FRENCH,
     wxLANGUAGE_GERMAN,
     wxLANGUAGE_RUSSIAN,
     wxLANGUAGE_BULGARIAN,
     wxLANGUAGE_CZECH,
     wxLANGUAGE_POLISH,
     wxLANGUAGE_SWEDISH,
#if wxUSE_UNICODE || defined(__WXMOTIF__)
     wxLANGUAGE_JAPANESE,
#endif
#if wxUSE_UNICODE
     wxLANGUAGE_GEORGIAN,
     wxLANGUAGE_ENGLISH,
     wxLANGUAGE_ENGLISH_US,
     wxLANGUAGE_ARABIC,
     wxLANGUAGE_ARABIC_EGYPT
#endif
};

I wonder if we can do the same.

If we prefer to get a dynamic list, I think it would be better to get
the list of the i18n's subdirectories and use wxLocale::FindLanguageInfo
with each subdirectories' titles.

Some advices would be really appreciated.

Regards.


--
Guillaume.
http://www.postgresqlfr.org
http://docs.postgresqlfr.org
Index: src/pgAdmin3.cpp
===================================================================
--- src/pgAdmin3.cpp    (révision 6239)
+++ src/pgAdmin3.cpp    (copie de travail)
@@ -317,9 +317,10 @@

             while (true)
             {
+        if (langNo >= 100000)
+          break;
                 langInfo=wxLocale::GetLanguageInfo(langNo);
-                if (!langInfo)
-                    break;
+                if (langInfo) {

                 if (englishName == langInfo->Description &&
                     (langInfo->CanonicalName == wxT("en_US") ||
@@ -330,8 +331,11 @@
                     existingLangNames.Add(translatedName);
                     langCount++;
                 }
+}
                 langNo++;
             }
+
+//wxLogError(str);
         }
     }


pgadmin-hackers by date:

Previous
From: svn@pgadmin.org
Date:
Subject: SVN Commit by guillaume: r6239 - trunk/pgadmin3/i18n/fr_FR
Next
From: svn@pgadmin.org
Date:
Subject: SVN Commit by dpage: r6240 - in trunk/pgadmin3: . pgadmin/frm pgadmin/include/frm