Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 19 Nov 2017, 16:00
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
gMeasures not working in localized Puppies [almost solved]
Moderators: deshlab, Flash, GuestToo, Ian, JohnMurga, Lobster
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [29 Posts]   Goto page: Previous 1, 2
Author Message
Moat


Joined: 16 Jul 2013
Posts: 766
Location: Mid-mitten, USA

PostPosted: Fri 06 Mar 2015, 14:59    Post subject:  

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! Cool

Bob
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11158
Location: Gatineau (Qc), Canada

PostPosted: Fri 06 Mar 2015, 16:12    Post subject:  

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! Cool

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

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Moat


Joined: 16 Jul 2013
Posts: 766
Location: Mid-mitten, USA

PostPosted: Fri 06 Mar 2015, 16:41    Post subject:  

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... Laughing

Bob
Back to top
View user's profile Send private message 
Geoffrey


Joined: 30 May 2010
Posts: 2307
Location: Queensland

PostPosted: Fri 06 Mar 2015, 17:44    Post subject:  

From the few different languages I've tried with the wary repo version, it seems gMeasures is only correct in English.
_________________
Carolina: Recent Repository Additions

Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8312
Location: Perth, Western Australia

PostPosted: Fri 06 Mar 2015, 21:11    Post subject:  

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.

_________________
http://barryk.org/news/
Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 11158
Location: Gatineau (Qc), Canada

PostPosted: Fri 06 Mar 2015, 21:29    Post subject:  

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... Laughing

Bob


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

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11158
Location: Gatineau (Qc), Canada

PostPosted: Fri 06 Mar 2015, 22:00    Post subject:  

Hello, all.

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







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... Smile BFN.

musher0

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 11158
Location: Gatineau (Qc), Canada

PostPosted: Fri 06 Mar 2015, 23:08    Post subject:  

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:
#!/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:
[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!!!



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


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...) Wink

Thanks everyone! Very Happy

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

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8312
Location: Perth, Western Australia

PostPosted: Sat 07 Mar 2015, 04:22    Post subject:  

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.

_________________
http://barryk.org/news/
Back to top
View user's profile Send private message Visit poster's website 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8312
Location: Perth, Western Australia

PostPosted: Sat 07 Mar 2015, 05:03    Post subject:  

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.

_________________
http://barryk.org/news/
Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 11158
Location: Gatineau (Qc), Canada

PostPosted: Sat 07 Mar 2015, 10:29    Post subject:  

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&q=money+exchange&qo=serpSearchTopBox

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

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
BarryK
Puppy Master


Joined: 09 May 2005
Posts: 8312
Location: Perth, Western Australia

PostPosted: Sat 07 Mar 2015, 21:16    Post subject:  

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.

_________________
http://barryk.org/news/
Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 11158
Location: Gatineau (Qc), Canada

PostPosted: Sun 08 Mar 2015, 00:46    Post subject:  

Sorry, wrong thread.
_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1641

PostPosted: Sun 28 May 2017, 19:10    Post subject:  

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 Wink).
The relevant lines are 172 & 248.

Greetings!
gmeasures-kelvin.patch.tar.gz
Description 
gz

 Download 
Filename  gmeasures-kelvin.patch.tar.gz 
Filesize  3.81 KB 
Downloaded  27 Time(s) 

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [29 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0596s ][ Queries: 12 (0.0048s) ][ GZIP on ]