Thread: Issue with spanish and serbian translations
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); } }
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++; } } }
Dave Page a écrit : > 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. > Your patch works great for me (1.6 branch). The issue you reported on some languages appearing twice occurs already without your patch. > I couldn't get Serbian to work though - does wxWidgets even support it? > If so, are we using the correct code? > wxWidgets has no translation for this language (http://www.wxwidgets.org/about/i18n.php). But serbian is listed on their language codes page (http://www.wxwidgets.org/manuals/2.8.3/wx_languagecodes.html#languagecodes). Regards. -- Guillaume. http://www.postgresqlfr.org http://docs.postgresqlfr.org
Guillaume Lelarge wrote: > Dave Page a écrit : >> 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. >> > > Your patch works great for me (1.6 branch). The issue you reported on > some languages appearing twice occurs already without your patch. Hmm, so it does. Oh well, I've applied the patch. >> I couldn't get Serbian to work though - does wxWidgets even support it? >> If so, are we using the correct code? >> > > wxWidgets has no translation for this language > (http://www.wxwidgets.org/about/i18n.php). But serbian is listed on > their language codes page > (http://www.wxwidgets.org/manuals/2.8.3/wx_languagecodes.html#languagecodes). Ahh, I see the problem. There are actually two languages (Serbian (Latin) and Serbian (Cyrillic) using the same language code. Not sure which one we actually, but changing the name in pgadmin3.lng, and adding the second entry results in two options being available in the drop down menu. Any idea which is correct? We should probably just remove the other entry. Same for the chinese (Taiwan) vs. Chinese (Simplified). Regards, Dave.
Dave Page a écrit : > Guillaume Lelarge wrote: >> [...] >> Your patch works great for me (1.6 branch). The issue you reported on >> some languages appearing twice occurs already without your patch. > > Hmm, so it does. Oh well, I've applied the patch. > Can you apply it for the 1.6 branch too ? >>> I couldn't get Serbian to work though - does wxWidgets even support it? >>> If so, are we using the correct code? >>> >> >> wxWidgets has no translation for this language >> (http://www.wxwidgets.org/about/i18n.php). But serbian is listed on >> their language codes page >> (http://www.wxwidgets.org/manuals/2.8.3/wx_languagecodes.html#languagecodes). > > > Ahh, I see the problem. There are actually two languages (Serbian > (Latin) and Serbian (Cyrillic) using the same language code. Not sure > which one we actually, but changing the name in pgadmin3.lng, and adding > the second entry results in two options being available in the drop down > menu. > > Any idea which is correct? We should probably just remove the other > entry. Same for the chinese (Taiwan) vs. Chinese (Simplified). > I agree for removing the other entry. Regards. -- Guillaume. <!-- http://abs.traduc.org/ http://lfs.traduc.org/ http://docs.postgresqlfr.org/ -->
Guillaume Lelarge wrote: > Dave Page a écrit : >> Guillaume Lelarge wrote: >>> [...] >>> Your patch works great for me (1.6 branch). The issue you reported on >>> some languages appearing twice occurs already without your patch. >> >> Hmm, so it does. Oh well, I've applied the patch. >> > > Can you apply it for the 1.6 branch too ? No point - I'm not intending to release another 1.6. >> Ahh, I see the problem. There are actually two languages (Serbian >> (Latin) and Serbian (Cyrillic) using the same language code. Not sure >> which one we actually, but changing the name in pgadmin3.lng, and >> adding the second entry results in two options being available in the >> drop down menu. >> >> Any idea which is correct? We should probably just remove the other >> entry. Same for the chinese (Taiwan) vs. Chinese (Simplified). >> > > I agree for removing the other entry. Do you know which are correct? Regards, Dave
Dave Page a écrit : > Guillaume Lelarge wrote: >> Dave Page a écrit : >>> Guillaume Lelarge wrote: >>>> [...] >>>> Your patch works great for me (1.6 branch). The issue you reported >>>> on some languages appearing twice occurs already without your patch. >>> >>> Hmm, so it does. Oh well, I've applied the patch. >>> >> >> Can you apply it for the 1.6 branch too ? > > No point - I'm not intending to release another 1.6. > Oh, OK. Is it not a bit early to close the 1.6 branch ? >>> Ahh, I see the problem. There are actually two languages (Serbian >>> (Latin) and Serbian (Cyrillic) using the same language code. Not sure >>> which one we actually, but changing the name in pgadmin3.lng, and >>> adding the second entry results in two options being available in the >>> drop down menu. >>> >>> Any idea which is correct? We should probably just remove the other >>> entry. Same for the chinese (Taiwan) vs. Chinese (Simplified). >>> >> >> I agree for removing the other entry. > > Do you know which are correct? > I don't know which is one is the official name. I prefer "Chinese (Taiwan)" because it makes a better reference to cn_TW. Regards. -- Guillaume. <!-- http://abs.traduc.org/ http://lfs.traduc.org/ http://docs.postgresqlfr.org/ -->
Guillaume Lelarge wrote: > Dave Page a écrit : >> Guillaume Lelarge wrote: >>> Dave Page a écrit : >>>> Guillaume Lelarge wrote: >>>>> [...] >>>>> Your patch works great for me (1.6 branch). The issue you reported >>>>> on some languages appearing twice occurs already without your patch. >>>> >>>> Hmm, so it does. Oh well, I've applied the patch. >>>> >>> >>> Can you apply it for the 1.6 branch too ? >> >> No point - I'm not intending to release another 1.6. >> > > Oh, OK. Is it not a bit early to close the 1.6 branch ? 1.8 will be ready in a few weeks, and given the amount of work I have on pgInstaller etc at the moment, I don't have time for another 1.6 release (we've never done one this close to a new version in the past either). >>> >>> I agree for removing the other entry. >> >> Do you know which are correct? >> > > I don't know which is one is the official name. I prefer "Chinese > (Taiwan)" because it makes a better reference to cn_TW. No, I mean for Serbian. I believe Simplified is correct for zh, because it goes with Traditional. Regards, Dave
Dave Page a écrit : > Guillaume Lelarge wrote: > [...] >>>> >>>> I agree for removing the other entry. >>> >>> Do you know which are correct? >>> >> >> I don't know which is one is the official name. I prefer "Chinese >> (Taiwan)" because it makes a better reference to cn_TW. > > No, I mean for Serbian. I believe Simplified is correct for zh, because > it goes with Traditional. > I don't know for serbian. I've CC'ed to Bojan to know his feelings about that. Regards. -- Guillaume. <!-- http://abs.traduc.org/ http://lfs.traduc.org/ http://docs.postgresqlfr.org/ -->
Guillaume Lelarge a écrit : > Dave Page a écrit : >> Guillaume Lelarge wrote: >> [...] >>>>> >>>>> I agree for removing the other entry. >>>> >>>> Do you know which are correct? >>>> >>> >>> I don't know which is one is the official name. I prefer "Chinese >>> (Taiwan)" because it makes a better reference to cn_TW. >> >> No, I mean for Serbian. I believe Simplified is correct for zh, >> because it goes with Traditional. >> > > I don't know for serbian. I've CC'ed to Bojan to know his feelings about > that. > According to Bojan, « "Serbian (Cyrillic)" wxLanguage constant=wxLANGUAGE_SERBIAN_CYRILLIC is correct. ». Regards. -- Guillaume. <!-- http://abs.traduc.org/ http://lfs.traduc.org/ http://docs.postgresqlfr.org/ -->
Guillaume Lelarge wrote: > Guillaume Lelarge a écrit : >> Dave Page a écrit : >>> Guillaume Lelarge wrote: >>> [...] >>>>>> >>>>>> I agree for removing the other entry. >>>>> >>>>> Do you know which are correct? >>>>> >>>> >>>> I don't know which is one is the official name. I prefer "Chinese >>>> (Taiwan)" because it makes a better reference to cn_TW. >>> >>> No, I mean for Serbian. I believe Simplified is correct for zh, >>> because it goes with Traditional. >>> >> >> I don't know for serbian. I've CC'ed to Bojan to know his feelings >> about that. >> > > According to Bojan, « "Serbian (Cyrillic)" wxLanguage > constant=wxLANGUAGE_SERBIAN_CYRILLIC is correct. ». Thanks, I've rmeoved Serbian (Latin) and Chinese (Taiwan). Regards, Dave