Currency Formatting wrap up.

Peter Haworth pete at mollysrevenge.com
Sat Mar 5 22:38:09 EST 2011


I have to break this down into more than one message since my original post was apparently too big!

I got the scripts I needed to do the currency formatting I was looking for.  Thanks to Chris and Alex for providing them.  I couldn't tell which one was the best so I'm sending both of them a CD!

I'll include both the scripts in a separate message for those who are interested, but wanted to update everyone on what I needed to do to get hold of the information I needed from OSX to pass in to the scripts.

You probably saw my posts about the problems I was having with trying to execute the locale command from LC.  They were eventually solved by Mark at the QC and the solution is:

put line 1 of shell("defaults read .GlobalPreferences AppleLocale") into $LANG
put uniDecode(uniEncode(shell("locale -k LC_MONETARY"), "utf8")) into tLocale

Please don't ask me to explain it!  All I know is, it worked!

So now I was able to get hold of all the locale information but then discovered that wasn't enough.  Turns out that if the user customises any of these settings in System Settings/Languages and Text/Formats, those changes do not make it to the locale information.  They are stored in the user's Library/Preferences folder in a file named com.apple.systempreferences.plist.

I had thought that plist files were in XML format but apparently Apple changed that while back to some derivative of XML that is stored as a binary file, so I could not just open the file and read it with Livecode.  As an aside, if you right click on any of Apple's plist files and select the Quick Look option, it will display it in readable form - looks just like XML.

I ended up writing an Applescript to get the info I needed and executing it from LiveCode.  That too will be in the follow up posting.

Thanks to everyone for their help.

Pete Haworth







More information about the use-livecode mailing list