Operational Dynamics
Research and Development   |   Projects   |   Blogs   |   Source Code   |   Linux
September
Mon Tue Wed Thu Fri Sat Sun
29          

hackergotchi
This section:

Blog postings by Andrew Cowie about Open Source and Software Development

The syndication links at top left will give you a feed for the blog as a whole. If you'd like a feed specific to this sub-category, see bottom of page.

RSS 2.0 Atom 0.3 blogs > andrew > software > gentoo-linux > wine-locale

Mon, 29 Sep 2008

Wine your own business

The things that drive you crazy…

There’s one (and only one) legacy Windows application that we have. We used to run it in VMware, which worked, but that was a pain, looked terrible, and of course was required us to have our copy of Windows 2000 installed there. Decrepit. But far worse, meant we had to use Windows. Yuk. And worst of all to have to keep switching in and out of it. Bah.

Life would be far better if we could run it on Linux under Wine — then it’d just be another app on running on the GNOME desktop and under the control of the window manager. We’d tried seeing if we could get this application to run in Wine a few times over the years; no joy. But somewhere along the line it started noticing list posts from other people reporting positive experiences. So {shrug} I gave it another try this month, and to my intense pleasure it installed cleanly and is running fine. Terrific! The people who hack on Wine are amazing.

So I started working away, only to suddenly realize that the dates were in American mm/dd/yy format. Gah. More searching, but none of the workarounds suggested (mostly to do with manually changing things with Wine’s regedit) seemed to work. Quote a pain.

I had come across a number of references saying that Wine and in turn the program in question would pick up the locale settings provided by your environment. I’d checked that, and tried various combinations. Nothing seemed to work.

I mostly run in en_CA, ie:

$ echo $LANG
en_CA.UTF-8
$

the impact of which you can see by running the locale command:

$ locale
LANG=en_CA.UTF-8
LC_CTYPE="en_CA.UTF-8"
LC_NUMERIC="en_CA.UTF-8"
LC_TIME=en_DK.UTF-8
LC_COLLATE="en_CA.UTF-8"
LC_MONETARY="en_CA.UTF-8"
LC_MESSAGES="en_CA.UTF-8"
LC_PAPER=en_AU.UTF-8
LC_NAME="en_CA.UTF-8"
LC_ADDRESS="en_CA.UTF-8"
LC_TELEPHONE="en_CA.UTF-8"
LC_MEASUREMENT="en_CA.UTF-8"
LC_IDENTIFICATION="en_CA.UTF-8"
LC_ALL=
$

all as one would expect And yet it had no impact on running the program running under Wine [Setting LC_TIME to en_DK is an old trick for people in en locales to get proper 24-hour time formatting; yes, I tried unsetting LC_TIME; I tried dropping the UTF-8 settings; I tried LANG=en_AU. Nothing made any difference].

After a lot more frustration searching around, I finally came across a support article on CodeWeaver’s website that mentioned setting the locale environment variables. Yes yes, I thought, but then I looked more closely. They were setting LC_ALL. Wait a minute. LC_ALL is a special variable that “if set to a non-empty string value, override the values of all the other internationalization variables.” You’re not supposed to set that… certainly one doesn’t set that at login — that’s what LANG is for. I didn’t really expect anything to come of it, but I tried it anyway:

$ env LC_ALL=en_CA.UTF-8 WINEPREFIX="/home/andrew/.wine" wine "C:\Premier12\Myobp.exe"

and ta-da everything worked: I had dd/mm/yy date formatting just like we wanted. Yeay!

I immediately closed everything down and went out for a beer. Sometimes we forget to celebrate those brief moments when things actually work.

But talk about bitterness. I’m not sure if this was a Wine behaviour, a Windows behaviour, or just nonsense code in MYOB. I suspect the latter. But either way, I saw so many posts asking “how can I get the date format to behave under Wine” that I thought I should write about the workaround that did it for us.

AfC


RSS 2.0 Atom 0.3 Category Specific Feeds. Use these links for an RSS or ATOM feed limited to this category and its descendants. Technorati Profile


Material on this site copyright © 2005-2008 Operational Dynamics Consulting Pty Ltd, unless otherwise noted. All rights reserved. Not for redistribution or attribution without permission in writing.

We make this service available to our staff in order to promote the discourse of ideas especially as relates to the development of Open Source worldwide. Blog entries on this site, however, are the musings of the authors as individuals and do not represent the views of Operational Dynamics. All times UTC.