Jean-Michel POURE wrote:

On Sunday 06 July 2003 19:52, you wrote:


I recieve an error
"Cannot set locale to fa_IR". I have run the program with farsi with those
20 translated strings and it looked good. Could this be a file permission
error? I will keep trying!



This bug was fixed recently by Andreas. I am rebuilding the binaries. You will be able to download and install them in a couple of minutes.


Actually what I fixed was *not* that inability to set the locale to fa_IR. pgAdmin3 assumed the setting of locale to be always successful, and stored this in preferences. Now the returncode is checked, and if setting locale was unsuccessful the previous value will be preserved.

I had a deeper look as my Linux system (vanilla SuSE 8.1) and found out that the fa_IR locale actually is named fa_IR.utf8, but wxWindows isn't aware of that. The attached patch will make wxWindows able to use Farsi.

Regards,
Andreas
Index: intl.cpp
===================================================================
RCS file: /pack/cvsroots/wxwindows/wxWindows/src/common/intl.cpp,v
retrieving revision 1.96
diff -c -r1.96 intl.cpp
*** intl.cpp    2003/06/13 10:16:19     1.96
--- intl.cpp    2003/07/07 00:30:25
***************
*** 141,146 ****
--- 141,163 ----
  #endif // __UNIX__
  
  
+ #if wxUSE_UNICODE
+ 
+ static wxWCharBuffer wxSetlocaleUtf(int c, const wxChar *lc)
+ {
+     wxWCharBuffer l=wxSetlocale(c, lc);
+     if (!l)
+     {
+       wxString buf(lc);
+       buf += wxT(".utf8");
+       l=wxSetlocale(c, buf.c_str());
+     }
+     return l;
+ }
+ #else
+ #define wxSetlocaleUtf(c, lc)  wxSetlocale(c, lc)
+ #endif
+ 
  // ----------------------------------------------------------------------------
  // wxMsgCatalogFile corresponds to one disk-file message catalog.
  //
***************
*** 615,621 ****
      wxCHECK_MSG( szLocale, FALSE, _T("no locale to set in wxLocale::Init()") );
    }
  
!   m_pszOldLocale = wxStrdup(wxSetlocale(LC_ALL, szLocale));
    if ( m_pszOldLocale == NULL )
      wxLogError(_("locale '%s' can not be set."), szLocale);
  
--- 632,638 ----
      wxCHECK_MSG( szLocale, FALSE, _T("no locale to set in wxLocale::Init()") );
    }
  
!   m_pszOldLocale = wxStrdup(wxSetlocaleUtf(LC_ALL, szLocale));
    if ( m_pszOldLocale == NULL )
      wxLogError(_("locale '%s' can not be set."), szLocale);
  
***************
*** 679,690 ****
      else
          locale = info->CanonicalName;
  
!     wxMB2WXbuf retloc = wxSetlocale(LC_ALL, locale);
  
      if ( !retloc )
      {
          // Some C libraries don't like xx_YY form and require xx only
!         retloc = wxSetlocale(LC_ALL, locale.Mid(0,2));
      }
      if ( !retloc )
      {
--- 696,707 ----
      else
          locale = info->CanonicalName;
  
!     wxMB2WXbuf retloc = wxSetlocaleUtf(LC_ALL, locale);
  
      if ( !retloc )
      {
          // Some C libraries don't like xx_YY form and require xx only
!         retloc = wxSetlocaleUtf(LC_ALL, locale.Mid(0,2));
      }
      if ( !retloc )
      {
***************
*** 702,714 ****
          else if (mid == wxT("nn"))
              locale = wxT("no_NY");
  
!         retloc = wxSetlocale(LC_ALL, locale);
      }
      if ( !retloc )
      {
          // (This time, we changed locale in previous if-branch, so try again.)
          // Some C libraries don't like xx_YY form and require xx only
!         retloc = wxSetlocale(LC_ALL, locale.Mid(0,2));
      }
      if ( !retloc )
      {
--- 719,731 ----
          else if (mid == wxT("nn"))
              locale = wxT("no_NY");
  
!         retloc = wxSetlocaleUtf(LC_ALL, locale);
      }
      if ( !retloc )
      {
          // (This time, we changed locale in previous if-branch, so try again.)
          // Some C libraries don't like xx_YY form and require xx only
!         retloc = wxSetlocaleUtf(LC_ALL, locale.Mid(0,2));
      }
      if ( !retloc )
      {
***************
*** 764,770 ****
              }
              else
              {
!                 retloc = wxSetlocale(LC_ALL, locale);
  #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS
                  if (codepage == 0 && (const wxChar*)retloc == NULL)
                  {
--- 781,787 ----
              }
              else
              {
!                 retloc = wxSetlocaleUtf(LC_ALL, locale);
  #ifdef SETLOCALE_FAILS_ON_UNICODE_LANGS
                  if (codepage == 0 && (const wxChar*)retloc == NULL)
                  {
***************
*** 1512,1518 ****
  
      // restore old locale
      wxSetLocale(m_pOldLocale);
!     wxSetlocale(LC_ALL, m_pszOldLocale);
      free((wxChar *)m_pszOldLocale);     // const_cast
  }
  
--- 1529,1535 ----
  
      // restore old locale
      wxSetLocale(m_pOldLocale);
!     wxSetlocaleUtf(LC_ALL, m_pszOldLocale);
      free((wxChar *)m_pszOldLocale);     // const_cast
  }
  
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to