locale Problem Solved!

Peter Haworth pete at mollysrevenge.com
Wed Mar 2 12:22:58 EST 2011


I just got a response to the bug report I posted on the QC yesterday, as follows.

Hi Peter,

Thanks for the report.

The 'locale' command uses the value of the LANG environment variable to
determine what locale should be used to return its results. It would appear
that the OS is *not* setting this for applications launched from the Desktop,
hence when you use 'shell' in LiveCode (which uses the same environment
variables passed to LiveCode) the locale function defaults to the empty locale
(which has no monetary settings).

To make the shell function work as you need, try this:
 put line 1 of shell("defaults read .GlobalPreferences AppleLocale") into $LANG
 put uniDecode(uniEncode(shell("locale -k LC_MONETARY"), "utf8")) into tLocale

Hope this helps,

Warmest Regards,

Mark.

I have tested this and it does indeed produce the correct results.  Now I can get on with my life!  Thanks to everyone who tried helping me out with this.

Pete Haworth





More information about the Use-livecode mailing list