Fedora Linux Support Community & Resources Center
  #1  
Old 11th February 2011, 01:34 PM
donfisico Offline
Registered User
 
Join Date: Mar 2010
Posts: 7
linuxfedorafirefox
How to change ONLY the locale numeric configuration

Hi, I have Fedora 12 on my laptop with locale settings set to spanish-argentina
Code:
 locale
LANG=es_AR.UTF-8
LC_CTYPE="es_AR.UTF-8"
LC_NUMERIC="es_AR.UTF-8"
LC_TIME="es_AR.UTF-8"
LC_COLLATE="es_AR.UTF-8"
LC_MONETARY="es_AR.UTF-8"
LC_MESSAGES="es_AR.UTF-8"
LC_PAPER="es_AR.UTF-8"
LC_NAME="es_AR.UTF-8"
LC_ADDRESS="es_AR.UTF-8"
LC_TELEPHONE="es_AR.UTF-8"
LC_MEASUREMENT="es_AR.UTF-8"
LC_IDENTIFICATION="es_AR.UTF-8"
LC_ALL=
This means that for numeric configuration decimal are expressed with commas instead of the dot. I want to change that because many programs complain about that, but mantaining language in spanish. Please tell me how to do it.
Reply With Quote
  #2  
Old 11th February 2011, 02:42 PM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 7,320
linuxfedorafirefox
Re: How to change ONLY the locale numeric configuration

to set just the numeric and monetary values, you can change the environment variables for LC_NUMERIC and LC_MONETARY to be en_US.UTF-8. This would change them so that the decimal places are dots, and the field separator is a comma.

Code:
setenv LC_MONETARY en_US.UTF-8
setenv LC_NUMERIC en_US.UTF-8
Reply With Quote
  #3  
Old 11th February 2011, 02:50 PM
gthill Offline
Registered User
 
Join Date: May 2005
Location: g-land, east java
Age: 50
Posts: 387
windows_xp_2003firefox
Re: How to change ONLY the locale numeric configuration

use

locale -a

to list the locales available on your system.
Reply With Quote
  #4  
Old 11th February 2011, 02:52 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,847
linuxfedorafirefox
Re: How to change ONLY the locale numeric configuration

I think all you have to do is:

LC_NUMERIC="en_US.utf8"
export LC_NUMERIC

And replace "en_US.utf8" value with something of your choice.

You can try this in a terminal window and then test your applications...

I don't know how to make it global though.

That would be to create your own locale definition... (see "localedef")

Last edited by jpollard; 11th February 2011 at 02:56 PM.
Reply With Quote
  #5  
Old 11th February 2011, 03:22 PM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 7,320
linuxfedorafirefox
Re: How to change ONLY the locale numeric configuration

would adding that to /etc/profile.d in script files be enough to make it seen in under X?

for example:

Code:
in /etc/profile.d/custom.sh

# initialization script to set number separator (sh)
LC_NUMERIC="en_US.utf-8"
LC_MONETARY="en_US.utf-8"
export LC_NUMERIC LC_MONETARY

and in /etc/profile.d/custom.csh

# initialization script to set number separator (csh)
setenv LC_NUMERIC en_US.utf-8
setenv LC_MONETARY en_US.utf-8
Reply With Quote
  #6  
Old 11th February 2011, 03:47 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,847
linuxfedorafirefox
Re: How to change ONLY the locale numeric configuration

No - /etc/profile is only invoked when the shell is invoked.

Most GUI do not startup with the shell - they start from gdm/kdm
which I believe do a fork/exec of the window manager..

But it really depends on how gdm/kdm acually invoke the window manager, and a lot of that is now done via some XML file instead
of the more convenient shell scripts.
Reply With Quote
  #7  
Old 11th February 2011, 05:25 PM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 7,320
linuxfedorafirefox
Re: How to change ONLY the locale numeric configuration

I would think that the environment set in the /etc/profile and /etc/profile.d/* would be in effect in the shell that X is started from and still set.

Is there some place that specifically sets the environment for X?
Reply With Quote
  #8  
Old 11th February 2011, 06:22 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,847
linuxfedorafirefox
Re: How to change ONLY the locale numeric configuration

Used to be.

It still exists when using the xdm login. The script Xsession
(/etc/X11/xdm/Xsession) is used to start the user environment. This also means
it may include the /etc/profile script as well.

As far as I know, the /etc/X11/prefdm script is the last remaining shell
script for starting the GUI.

What I don't know is whether gdm/kdm will pass on any environment
configured. gdm/kdm are used to start the X server and the login
window. As such, it sets/creates the access keys. Second, after login
completes, the X server is restarted (or should be IMO, this prevents
information leaks from the privileged environment of gdm to the
non-privileged user environment) and the user window manager started.

It is this last step that has become opaque in that the steps done are
now invisible within the gdm/kdm applications.

NOTE: the prefdm script itself includes the definitions from /etc/sysconfig/i18n.

This would lead me to believe that IF the definitions are put in
/etc/sysconfig/i18n that they COULD become global. The file is just
a shell script that contains definitions for use.
Reply With Quote
  #9  
Old 11th February 2011, 06:36 PM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 7,320
linuxfedorafirefox
Re: How to change ONLY the locale numeric configuration

/etc/sysconfig/i18n is loaded in the /etc/profile.d/lang.csh and /etc/profile/lang.sh files. However that doesn't mean that is the only place that it is loaded from other than the /etc/X11/prefdm script you mentioned above.

I may do some experimenting around and try setting some environment variables in /etc/profile.d and /etc/X11/prefdm to see if they are carried over into X or not.
Reply With Quote
  #10  
Old 11th February 2011, 06:46 PM
donfisico Offline
Registered User
 
Join Date: Mar 2010
Posts: 7
linuxfedorafirefox
Exclamation Re: How to change ONLY the locale numeric configuration

Thanks for the numerous answers, I will give an answer to each, the problem is parcially solved but not completely as you will see from my answers (in order of publication date)

#1, DBelton(1)
-----------------
Quote:
setenv LC_MONETARY en_US.UTF-8
setenv LC_NUMERIC en_US.UTF-8
I can not modify the locale variables that way. "setenv" is not a command avaible (at least for me).

#2 gthill
---------
Quote:
use
locale -a

to list the locales available on your system.
Already done this, already knew the command to list the locale variables. This not change them. Thank you anyway.

#3 jpollard
------------
Quote:
I think all you have to do is:

LC_NUMERIC="en_US.utf8"
export LC_NUMERIC
The most usefull answer till now, although a bit incomplete. When I type in a shell:
Code:
LC_NUMERIC="en_US.utf8"
export LC_NUMERIC
I can then run applications that need decimal division as point instead commas, meaning I really get to change the LC_NUMERIC variable. THE PROBLEM IS THAT THIS CHANGE IS NOT PERMANT! AND AFFECTS ONLY THE SHELL WHERE I MODIFIED THE LOCALE VARIABLE.
Meaning, If I I have to do it again IF I OPEN OTHER SHELL.

OTHER PROBLEM IS THAT IT ONLY AFFECT THE CURRENT SHELL!!!!!!:
meaning that if instead of running the app by typing the name in the shell +enter, I choose to run it by double clicking the name in the file browser, then IT DOES NOT WORK! It complains again about the numeric local variable.
Please if you do not understand this problem, write to me, but I assure you this a annoying problem (I can not launch the application by double clicking, I can not make a launcher).

# 4 DBelton (2)
--------------------------
Quote:
would adding that to /etc/profile.d in script files be enough to make it seen in under X?

for example:
The file /etc/profile.d/custum.sh does not exists, instead the most interesting file in that directory is lang.sh:

Code:
# /etc/profile.d/lang.sh - set i18n stuff

sourced=0
if [ -n "$LANG" ]; then
    saved_lang="$LANG"
    [ -f "$HOME/.i18n" ] && . "$HOME/.i18n" && sourced=1
    LANG="$saved_lang"
    unset saved_lang
else
    for langfile in /etc/sysconfig/i18n "$HOME/.i18n" ; do
        [ -f $langfile ] && . $langfile && sourced=1
    done
fi

if [ "$sourced" = 1 ]; then
    [ -n "$LANG" ] && export LANG || unset LANG
    [ -n "$LC_ADDRESS" ] && export LC_ADDRESS || unset LC_ADDRESS
    [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
    [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
    [ -n "$LC_IDENTIFICATION" ] && export LC_IDENTIFICATION || unset LC_IDENTIFICATION
    [ -n "$LC_MEASUREMENT" ] && export LC_MEASUREMENT || unset LC_MEASUREMENT
    [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
    [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
    [ -n "$LC_NAME" ] && export LC_NAME || unset LC_NAME
    [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
    [ -n "$LC_PAPER" ] && export LC_PAPER || unset LC_PAPER
    [ -n "$LC_TELEPHONE" ] && export LC_TELEPHONE || unset LC_TELEPHONE
    [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
    if [ -n "$LC_ALL" ]; then
       if [ "$LC_ALL" != "$LANG" ]; then
         export LC_ALL
       else
         unset LC_ALL
       fi
    else
       unset LC_ALL
    fi
    [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
    [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
    [ -n "$_XKB_CHARSET" ] && export _XKB_CHARSET || unset _XKB_CHARSET
    
    consoletype=$CONSOLETYPE
    if [ -z "$consoletype" ]; then
      consoletype=$(/sbin/consoletype stdout)
    fi

    if [ -n "$LANG" ]; then
      case $LANG in
    	*.utf8*|*.UTF-8*)
    	if [ "$TERM" = "linux" ]; then
    	    if [ "$consoletype" = "vt" ]; then
    	    	case $LANG in 
    	    		ja*) LANG=en_US.UTF-8 ;;
    	    		ko*) LANG=en_US.UTF-8 ;;
			si*) LANG=en_US.UTF-8 ;;
    	    		zh*) LANG=en_US.UTF-8 ;;
    	    		ar*) LANG=en_US.UTF-8 ;;
    	    		fa*) LANG=en_US.UTF-8 ;;
    	    		he*) LANG=en_US.UTF-8 ;;
    	    		en_IN*) ;;
    	    		*_IN*) LANG=en_US.UTF-8 ;;
    	    	esac
            fi
        fi
	;;
	*)
	if [ "$TERM" = "linux" ]; then
	    if [ "$consoletype" = "vt" ]; then
    	    	case $LANG in 
    	    		ja*) LANG=en_US ;;
    	    		ko*) LANG=en_US ;;
			si*) LANG=en_US ;;
    	    		zh*) LANG=en_US ;;
    	    		ar*) LANG=en_US ;;
    	    		fa*) LANG=en_US ;;
    	    		he*) LANG=en_US ;;
    	    		en_IN*) ;;
    	    		*_IN*) LANG=en_US ;;
    	    	esac
	    fi
	fi
	;;
      esac
    fi

    unset SYSFONTACM SYSFONT consoletype
fi
unset sourced
unset langfile
Script i do not understand very much.

# jpollard (2)
---------------

Quote:
No - /etc/profile is only invoked when the shell is invoked.

Most GUI do not startup with the shell - they start from gdm/kdm
which I believe do a fork/exec of the window manager..
Ok, I agree, but then what to do???

# DBelton (3)
--------------------
HTML Code:
I would think that the environment set in the /etc/profile and /etc/profile.d/* would be in effect in the shell that X is started from and still set.

Is there some place that specifically sets the environment for X?
That is what I am talking about, not only affecting shells, but also the X also. For one time and for all times modify LC_NUMERIC for allways.
Reply With Quote
  #11  
Old 11th February 2011, 09:00 PM
jpollard Online
Registered User
 
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,847
linuxfedorafirefox
Re: How to change ONLY the locale numeric configuration

Try setting it in /etc/sysconfig/i18n and exporting it.

Then login via the GUI and see if it is set in the applications you want the
modified behavior.
Reply With Quote
  #12  
Old 12th February 2011, 04:16 AM
DBelton Offline
Administrator
 
Join Date: Aug 2009
Posts: 7,320
linuxfedorafirefox
Re: How to change ONLY the locale numeric configuration

I would try as jpollard suggested and see if it works.

and the /etc/profile.d/custom.sh and custom.csh files I mentioned above were NEW files, not editing existing files. However you could accomplish the same thing I mentioned above by adding those lines to the end of lang.sh and lang.csh. All of the *.sh and *.csh files in /etc/profile.d get run when you open a shell.
Reply With Quote
  #13  
Old 7th September 2011, 12:04 AM
pedrogfrancisco Offline
Registered User
 
Join Date: Aug 2010
Posts: 4
linuxfirefox
Re: How to change ONLY the locale numeric configuration

I tested now and you can set any of the locales user-wide instead of system-wide, like so:


$ cat $HOME/.i18n
Quote:
export LANG="en_US.utf8"
export LC_MESSAGES="en_US.utf8"

export LC_CTYPE="pt_PT.utf8"
export LC_NUMERIC="pt_PT.utf8"
export LC_TIME="pt_PT.utf8"
export LC_COLLATE="pt_PT.utf8"
export LC_MONETARY="pt_PT.utf8"
export LC_PAPER="pt_PT.utf8"
export LC_NAME="pt_PT.utf8"
export LC_ADDRESS="pt_PT.utf8"
export LC_TELEPHONE="pt_PT.utf8"
export LC_MEASUREMENT="pt_PT.utf8"
export LC_IDENTIFICATION="pt_PT.utf8"

The above code sets the language of the Gnome session to English and everything else to Portuguese.
Reply With Quote
  #14  
Old 7th September 2011, 12:49 AM
dd_wizard Offline
Registered User
 
Join Date: Sep 2009
Posts: 1,409
linuxfirefox
Re: How to change ONLY the locale numeric configuration

The file ~/.bash_profile is executed at login. I turn my touchpad off in it, and it's worked from F12 through F16. I also set and export LC_ALL=C and nautilus sorts as expected.

dd_wizard
Reply With Quote
Reply

Tags
change, configuration, locale, numeric

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
after-Installation errors. locale error. unsupported locale settings | Error 17 | etc LinuxNoobie Installation, Upgrades and Live Media 2 29th April 2008 07:35 AM
locale: Cannot set LC_CTYPE to default locale: No such file or directory bbshliu Using Fedora 0 12th March 2008 04:55 PM
HAL device configuration? How do I change it? davewithheld Hardware & Laptops 0 14th February 2006 07:28 AM
how to change locale to euckr? hanpedro Installation, Upgrades and Live Media 0 27th September 2005 01:37 PM
How to change monitor configuration ybh6336 Using Fedora 3 16th December 2004 02:31 AM


Current GMT-time: 18:00 (Saturday, 20-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat