Thread: Mac Language and _()

Mac Language and _()

From
Adam H.Pendleton
Date:
I've isolated the pgAdmin3 crash on Mac:

listViews->AddPage(properties, _("Properties"));        //
NBP_PROPERTIES

This fails, but this:

listViews->AddPage(properties, wxT("Properties"));        //
NBP_PROPERTIES

succeeds, so clearly there is something amiss with the
unicode/translation stuff.  It probably has something to do with the
fact that pgAdmin3 thinks I'm Chinese.  I'm not sure what to do
next...any ideas?

ahp


Re: Mac Language and _()

From
Andreas Pflug
Date:
Adam H.Pendleton wrote:
> I've isolated the pgAdmin3 crash on Mac:
>
> listViews->AddPage(properties, _("Properties"));        // NBP_PROPERTIES
>
> This fails, but this:
>
> listViews->AddPage(properties, wxT("Properties"));        // NBP_PROPERTIES
>
> succeeds, so clearly there is something amiss with the
> unicode/translation stuff.  It probably has something to do with the
> fact that pgAdmin3 thinks I'm Chinese.  I'm not sure what to do
> next...any ideas?

Maybe your mac detects the missing the slant eyes :-)

First you can remove language files, in that case it should fall back to
english.

Still, in any case a wrong/missing translation may not result in an
invalid string, apparently that's what's happening.

It might be quite hard to locate this with pgadmin sources. AFAIR
there's a locale sample in wx, can you try that?

Regards,
Andreas

Re: Mac Language and _()

From
Andreas Pflug
Date:
Adam H. Pendleton wrote:
>
> Okay, removing the language files did the trick,

Good for the start, so this is a separated issue. This is hopefully
reproducable using a wx sample.

> though I still get the
> assert.  Now the program runs but there are some minor problems.  For
> starters, the "Cancel" button on dialogs doesn't work,

That's because the event is registered on wxID_CANCEL, which is not the
same as XRCID("wxID_CANCEL") although it should be.

Please set a breakpoint at contrib/src/xrc/xmlres.cpp line 1218 or so.
This is XRCID_Lookup, which retrieves an id from a string. It's called
from c++ runtime initialization code, to set all that
EVT_xxx(XRCID("...") ) stuff. Apparently, there's some other source
calling this, because there's no occurrence of XRCID("wxID_CANCEL") in
pgadmin's sources.
This initializer code is called before some other code is executed,
which assigns those well-known id values to the id strings (this is done
in xmlres.cpp AddStdXRCID_Records). If this code is not called prior to
requesting an XRCID for a well-known id string, a new id is generated
(which we don't like for wxID***) and the assert mentioned will rise.

With that breakpoint set, you'll get >300 calls, which is too much to
trace. You can remove all EVT_*** in any ui/*.cpp between
BEGIN_EVENT_TABLE and END_EVENT_TABLE; after that, there should be no
more call to to XRCID_Lookup before AddStdXRCID_Records(). Apparently on
Mac there *is* an illegal call, you'll catch it hopefully like this.

  and the dialog
> sizes are messed up.  I have attached two screenshots to show what I mean.

Obviously wxNotebook is f***ed up on mac. Could you please test this on
a wx sample?

Regards,
Andreas

Re: Mac Language and _()

From
Adam H.Pendleton
Date:
On Sep 21, 2004, at 1:30 PM, Andreas Pflug wrote:

> Maybe your mac detects the missing the slant eyes :-)
>
> First you can remove language files, in that case it should fall back
> to english.
>
> Still, in any case a wrong/missing translation may not result in an
> invalid string, apparently that's what's happening.
>
> It might be quite hard to locate this with pgadmin sources. AFAIR
> there's a locale sample in wx, can you try that?

Sorry it's taken so long to get back to you on this.  The "internat"
wxWidgets sample works correctly on my Mac.  When I run it, I get the
language selection dialog, then I get French, English, German, etc.
menus depending on which language I select.  Looks like I'm probably
doing something wrong when I build pgAdmin3.

ahp