How to fix hook up of Mac OS X Locale?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to fix hook up of Mac OS X Locale?

Stew MacLean

I’m trying to fix the setting of Locale on the Mac OS X.

 

So far, I’ve overridden

 

Locale class>> preferredLocaleName

            "Locale preferredLocaleName.

            Override to get locale for MacOSX, as the primitive always answers the C locale. 23/03/07 SIM."

 

            ^self isMacOSX

                        ifFalse: [ByteString fromBytes: self getLocaleName]

                        ifTrue:

                                    [MacOSXSystemSupport current

                                                getVariable: 'AppleLocale' ifAbsent: ['en_NZ']]

 

as a result of a post in the archive – thanks to Todd Blanchard and Andre Schnoor.

 

The problem now appears to be that as

 

Locale class>> platformName

            "Return one of (#unix #mac #os2 #win32)"

 

            ^OSHandle currentOS

 

is answering #unix

 

the LocaleMap lookup is not finding a match.

 

 

eg

            LocaleMap

                        at: #('* hp *' #'en_GB.roman8') put: #'en_GB.HPRoman8';

                        at: #('* hp *' #'en_GB.iso88591') put: #'en_GB.ISO8859-1';

                        at: #('* sun *' #'en_GB') put: #'en_GB.ISO8859-1'…

 

So, am I correct in assuming that I need to amend the vast majority of locale declaration methods to include an entry for #unix, or is there some other way to fix this?

 

Thanks,

 

Stewart

Reply | Threaded
Open this post in threaded view
|

Re: How to fix hook up of Mac OS X Locale?

Andre Schnoor
Stewart,

I'm using this code to determine whether the image is running OSX:

isMac
    OSHandle currentOS ~~ #unix
        ifTrue:[ ^false ].
    ^Screen default platformName = 'MacOSX'

IMHO it definitely makes sense to add #osx to the known platform names (and have it imply #unix where appropriate). MacOS X is way different from other Unixes in many aspects. It uses Aqua by default while running X11 is only an option, for example. It looks like a lot of OS-related API was implemented in frameworks outside the standard Unix paradigm.

Andre



Stewart MacLean wrote:

I’m trying to fix the setting of Locale on the Mac OS X.

 

So far, I’ve overridden

 

Locale class>> preferredLocaleName

            "Locale preferredLocaleName.

            Override to get locale for MacOSX, as the primitive always answers the C locale. 23/03/07 SIM."

 

            ^self isMacOSX

                        ifFalse: [ByteString fromBytes: self getLocaleName]

                        ifTrue:

                                    [MacOSXSystemSupport current

                                                getVariable: 'AppleLocale' ifAbsent: ['en_NZ']]

 

as a result of a post in the archive – thanks to Todd Blanchard and Andre Schnoor.

 

The problem now appears to be that as

 

Locale class>> platformName

            "Return one of (#unix #mac #os2 #win32)"

 

            ^OSHandle currentOS

 

is answering #unix

 

the LocaleMap lookup is not finding a match.

 

 

eg

            LocaleMap

                        at: #('* hp *' #'en_GB.roman8') put: #'en_GB.HPRoman8';

                        at: #('* hp *' #'en_GB.iso88591') put: #'en_GB.ISO8859-1';

                        at: #('* sun *' #'en_GB') put: #'en_GB.ISO8859-1'…

 

So, am I correct in assuming that I need to amend the vast majority of locale declaration methods to include an entry for #unix, or is there some other way to fix this?

 

Thanks,

 

Stewart

Reply | Threaded
Open this post in threaded view
|

RE: How to fix hook up of Mac OS X Locale?

Stew MacLean
In reply to this post by Stew MacLean

Hi Andre,

 

Yes, from my initial impression, Mac OS X, although BSD based, diverges a lot from standard Unix (if there is such a thing!).

 

My immediate concern here however, is to get the Locale automatically hooked up by the underlying mechanism – in the Mac OS X environment – which seems broken at the moment (please correct me if I’m wrong).

 

Unfortunately, for a “business” application setting the Locale is critical (midi doesn’t care J).

 

I’m curious as to how/if others have encountered and solved this problem? (or if I’ve completely got the wrong end of the stick).

 

Sadly, this should not be an issue that VW developers have to deal with, given the “cross platform” nature of VW…

 

Cheers,

 

Stewart

 

 

 

 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: 23 March 2007 8:37 p.m.
To: Stewart MacLean
Cc: [hidden email]
Subject: Re: How to fix hook up of Mac OS X Locale?

 

Stewart,

I'm using this code to determine whether the image is running OSX:

isMac
    OSHandle currentOS ~~ #unix
        ifTrue:[ ^false ].
    ^Screen default platformName = 'MacOSX'

IMHO it definitely makes sense to add #osx to the known platform names (and have it imply #unix where appropriate). MacOS X is way different from other Unixes in many aspects. It uses Aqua by default while running X11 is only an option, for example. It looks like a lot of OS-related API was implemented in frameworks outside the standard Unix paradigm.

Andre



Stewart MacLean wrote:

I’m trying to fix the setting of Locale on the Mac OS X.

 

So far, I’ve overridden

 

Locale class>> preferredLocaleName

            "Locale preferredLocaleName.

            Override to get locale for MacOSX, as the primitive always answers the C locale. 23/03/07 SIM."

 

            ^self isMacOSX

                        ifFalse: [ByteString fromBytes: self getLocaleName]

                        ifTrue:

                                    [MacOSXSystemSupport current

                                                getVariable: 'AppleLocale' ifAbsent: ['en_NZ']]

 

as a result of a post in the archive – thanks to Todd Blanchard and Andre Schnoor.

 

The problem now appears to be that as

 

Locale class>> platformName

            "Return one of (#unix #mac #os2 #win32)"

 

            ^OSHandle currentOS

 

is answering #unix

 

the LocaleMap lookup is not finding a match.

 

 

eg

            LocaleMap

                        at: #('* hp *' #'en_GB.roman8') put: #'en_GB.HPRoman8';

                        at: #('* hp *' #'en_GB.iso88591') put: #'en_GB.ISO8859-1';

                        at: #('* sun *' #'en_GB') put: #'en_GB.ISO8859-1'…

 

So, am I correct in assuming that I need to amend the vast majority of locale declaration methods to include an entry for #unix, or is there some other way to fix this?

 

Thanks,

 

Stewart