Page 1 of 2

Posted: Fri 06 Mar 2015, 18:59
by Moat
musher0 wrote:What's your LANG parameter ? en_SOMETHING ?
Yes - en_US. But wouldn't the fix be as easy as re-compiling the internationalized source from robwoj44, as Barry linked to above? Might be interesting to see if that resolves these issues or not.

I'll have to give one of the alternates you posted a look-see, though! 8)

Bob

Posted: Fri 06 Mar 2015, 20:12
by musher0
Moat wrote:
musher0 wrote:What's your LANG parameter ? en_SOMETHING ?
Yes - en_US. But wouldn't the fix be as easy as re-compiling the internationalized source from robwoj44, as Barry linked to above? Might be interesting to see if that resolves these issues or not.

I'll have to give one of the alternates you posted a look-see, though! 8)

Bob
Hello again, bob.

Nope. I don't know what it is, but the "internationalized" version that I just
compiled from that source still says a kilo weighs only two pounds...

I didn't test every conversion, but this version still offers only guilders as
a conversion from euros.

I've finished banging my head on this one. BFN.

musher0

Posted: Fri 06 Mar 2015, 20:41
by Moat
musher0 wrote:... but this version still offers only guilders as
a conversion from euros.
Ha - same here. I'm not even sure what a "guilder" is... :lol:

Bob

Posted: Fri 06 Mar 2015, 21:44
by Geoffrey
From the few different languages I've tried with the wary repo version, it seems gMeasures is only correct in English.

Posted: Sat 07 Mar 2015, 01:11
by BarryK
I am testing robwoj44's gmeasures

This converts kilograms to pounds correctly;
# LANG=C ./gmeasures

Interesting this also correct (German uses the comma):
# LANG=de_DE ./gmeasures

But this gives the error reported by musher0:
# LANG=de_DE.UTF-8 ./gmeasures
also:
# LANG=de_DE.utf8 ./gmeasures

I will ask robwoj44 about it.

Posted: Sat 07 Mar 2015, 01:29
by musher0
Moat wrote:
musher0 wrote:... but this version still offers only guilders as
a conversion from euros.
Ha - same here. I'm not even sure what a "guilder" is... :lol:

Bob
From http://dictionary.reference.com/browse/Guilder :
"a silver or nickel coin and monetary unit of the Netherlands until
the euro was adopted, equal to 100 cents"

Posted: Sat 07 Mar 2015, 02:00
by musher0
Hello, all.

As Mr. Kauler mentioned, gmeasures seems to be allergic to utf8...

Image

Image

Image

It doesn't care if LANG=en_CA or LANG=fr_CA, but it can't tolerate utf8!!!

Maybe the gtk-spin-button is making it dizzy!!!

All in the interest of science... :) BFN.

musher0

Posted: Sat 07 Mar 2015, 03:08
by musher0
Hello, all.

Eureka! This is how to get gmeasures to show proper decimals in a
localized UTF-8 environment !

Create a new file gmeasures.sh in /usr/bin and make it executable.
Copy the following code from here and paste it in the new script. Save.

Code: Select all

#!/bin/ash
# /usr/bin/gmeasures.sh
# To get gmeasures to use decimals properly in a localized environment.
# musher0, March 6, 2015. 
# Thanks to BK for help in testing and for the hints.
# Discussion reference : http://murga-linux.com/puppy/viewtopic.php?t=98030
####
if [ "${LANG:6:5}" = "UTF-8" -o "${LANG:6:4}" = "utf8" ];then
	LANG="${LANG:0:5}"
	LANG="$LANG" gmeasures
	LANG="`awk -F"=" '$1=="LANG" { print $2 }' /etc/profile`"
	# We restore the original linguistic environment afterwards.
	# See /etc/profile, lines 99-104, if in doubt.
else
	gmeasures
fi
You'll also have to modify your gmeasures.desktop file at
/usr/share/applications, like so:

Code: Select all

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Gmeasures
Comment=Gmeasures weights and measures converter
Comment[fr]=Convertisseur de poids et mesures Gmeasures
Exec=gmeasures.sh
Icon=gmeasures.xpm
Terminal=false
Type=Application
Categories=Calculator
StartupNotify=true
GenericName=Units converter
If you prefer, you may manually change only the "Exec=" line,
from gmeasures to gmeasures.sh.

Result : we have proper decimals!!!

Image

Below, proof that UTF-8 has been restored: we can type fancy accented
vowels and characters in the last line after running gmeasures.
Image

I believe the above script should work with all UTF-8 locales? Please tell
me. Thanks in advance.

As to the euros to guilders conversion, I'll throw out there that someone
on the development team really loved his guilders -- more than euros--,
and was nostalgic? (Now where's that tongue-in-cheek icon...) ;)

Thanks everyone! :D

musher0
~~~~~~~~~
P.S. I'll wait for confirmation feedback before uploading a little *.pet
archive of this. Thanks in advance.

Posted: Sat 07 Mar 2015, 08:22
by BarryK
musher0,
No, that does not fix it.

I realised, soon after my last post, that I had made a mistake.

The problem is not UTF-8.

earlier I reported that this works, running robwoj44's binary:

# LANG=de_DE ./gmeasures

However, it doesn't. If there is no folder /usr/lib/locale/de_DE, then gmeasures falls back to using C locale.

So, it seems to have worked, but not really.

If you run quicksetup and choose de_DE, and untick the UTF-8 checkbox, then /usr/lib/locale/de_DE gets created.

Now run "LANG=de_DE ./gmeasures" and it doesn't work.

The C code needs to be fixed. Maybe robwoj44 will do that, I have informed him of the problem.

Posted: Sat 07 Mar 2015, 09:03
by BarryK
OK, I think that I have the solution.

The "gmeasureswrapper" script just needs this:

#!/bin/sh
LC_NUMERIC=C gmeasures

I am using robwoj44's binary.

I tried to put this into the C code, using setlocale(), but it doesn't work. So resorted to the above wrapper.

Posted: Sat 07 Mar 2015, 14:29
by musher0
Thanks for sharing your thoughts and solutions about this problem, Barry.

It is true that the problem is not really one of localization by language,
but rather of the use of global standards: ISO vs "Imperial", for ex.
It's independent of linguistic maps.

I have some trouble understanding your argument on the impact of
existent or non-existent locale folders on decimals in the gmeasures
application. I'm sure I'll get there. The important thing is that a couple of
workarounds can now be offered to the user.

Perhaps robwoj44 could drop the euro<>guilder conversion altogether.
Currency rates change daily and perhaps should not be confused with
units conversions that are based on scientific constants. Just a thought.

The web is really well adapted to currency activity:
http://www.ask.com/web?qsrc=1&o=0&l=dir ... archTopBox

As I said earlier, I don't want to bang my head on this gmeasures any
longer. I have opted to use Puppy's good old pConvert for units, and
XE.com or a similar site if I ever need to know a daily exchange rate.

Best regards.

musher0

Posted: Sun 08 Mar 2015, 01:16
by BarryK
BarryK wrote:OK, I think that I have the solution.

The "gmeasureswrapper" script just needs this:

#!/bin/sh
LC_NUMERIC=C gmeasures

I am using robwoj44's binary.
robwoj44 has confirmed that this works, so this is the fix I will use in Quirky.

Posted: Sun 08 Mar 2015, 04:46
by musher0
Sorry, wrong thread.

Posted: Sun 28 May 2017, 23:10
by SFR
BarryK wrote:OK, I think that I have the solution.

The "gmeasureswrapper" script just needs this:

#!/bin/sh
LC_NUMERIC=C gmeasures

I am using robwoj44's binary.

I tried to put this into the C code, using setlocale(), but it doesn't work. So resorted to the above wrapper.
Hey Barry & guys.

I was working on adding support for Kelvin degrees to gMeasures and stumbled across this thread.
Just letting you know that the 'setlocale()' hack works for me.
Well, it wasn't at first, when it was placed at the very beginning of main(), but I moved it below gtk_init(&argc, &argv); and it just started to work, dunno why actually.

The attached is the Kelvin patch (it's for the original sources, not Robwoj44's) that also contains the above fix (I'm too lazy to split it into 2 patches ;)).
The relevant lines are 172 & 248.

Greetings!