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

From Dave Page
Subject Re: Issue with spanish and serbian translations
Date
Msg-id 4635E4F7.5060801@postgresql.org
Whole thread Raw
In response to Issue with spanish and serbian translations  (Guillaume Lelarge <guillaume@lelarge.info>)
Responses Re: Issue with spanish and serbian translations  (Guillaume Lelarge <guillaume@lelarge.info>)
List pgadmin-hackers
Guillaume Lelarge wrote:
> 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.

I hacked up the attached for testing which is a similar idea - the
downside being that languages that are listed twice in pgadmin3.lng are
shown twice in the list if they exist (eg. Chinese (Simplified) vs.
Chinese (Taiwan)). That should be an easy fix though.

I couldn't get Serbian to work though - does wxWidgets even support it?
If so, are we using the correct code?

Regards, Dave
Index: pgadmin/pgAdmin3.cpp
===================================================================
--- pgadmin/pgAdmin3.cpp    (revision 6227)
+++ pgadmin/pgAdmin3.cpp    (working copy)
@@ -301,24 +301,17 @@
             wxString englishName=line.BeforeFirst(',').Trim(true);
             wxString translatedName=line.AfterFirst(',').Trim(false);

-            langNo=2;       // skipping default, unknown
-
-            while (true)
+            langInfo=wxLocale::FindLanguageInfo(englishName);
+            if (langInfo)
             {
-                langInfo=wxLocale::GetLanguageInfo(langNo);
-                if (!langInfo)
-                    break;
-
-                if (englishName == langInfo->Description &&
-                    (langInfo->CanonicalName == wxT("en_US") ||
+                if (langInfo->CanonicalName == wxT("en_US") ||
                     (!langInfo->CanonicalName.IsEmpty() &&
-                     wxDir::Exists(i18nPath + wxT("/") + langInfo->CanonicalName))))
+                     wxDir::Exists(i18nPath + wxT("/") + langInfo->CanonicalName)))
                 {
-                    existingLangs.Add(langNo);
+                    existingLangs.Add(langInfo->Language);
                     existingLangNames.Add(translatedName);
                     langCount++;
                 }
-                langNo++;
             }
         }
     }

pgadmin-hackers by date:

Previous
From: svn@pgadmin.org
Date:
Subject: SVN Commit by dpage: r6241 - trunk/www/development
Next
From: Guillaume Lelarge
Date:
Subject: Re: Issue with spanish and serbian translations