FedoraForum.org - Fedora Support Forums and Community
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2004
    Posts
    4,070

    How to set locale for user?

    On a FC 27 machine, how can I set the locale for a user ? (in particular, so that the clock displays the correct language).

    The system-wide language is en_US.utf8:

    Code:
    [cosmo@woodcomputer1 ~]$ su -
    Password: 
    [root@woodcomputer1 ~]# locale
    LANG=en_US.utf8
    LC_CTYPE="en_US.utf8"
    LC_NUMERIC="en_US.utf8"
    LC_TIME="en_US.utf8"
    LC_COLLATE="en_US.utf8"
    LC_MONETARY="en_US.utf8"
    LC_MESSAGES="en_US.utf8"
    LC_PAPER="en_US.utf8"
    LC_NAME="en_US.utf8"
    LC_ADDRESS="en_US.utf8"
    LC_TELEPHONE="en_US.utf8"
    LC_MEASUREMENT="en_US.utf8"
    LC_IDENTIFICATION="en_US.utf8"
    LC_ALL=
    [root@woodcomputer1 ~]# cat /etc/locale.conf
    LANG=en_US.utf8
    However, for a user cosmo, the locale is aa_DJ.utf8
    Code:
    [root@woodcomputer1 ~]# exit
    logout
    [cosmo@woodcomputer1 ~]$ whoami
    cosmo
    [cosmo@woodcomputer1 ~]$ locale
    LANG=aa_DJ.utf8
    LC_CTYPE="aa_DJ.utf8"
    LC_NUMERIC="aa_DJ.utf8"
    LC_TIME="aa_DJ.utf8"
    LC_COLLATE="aa_DJ.utf8"
    LC_MONETARY="aa_DJ.utf8"
    LC_MESSAGES="aa_DJ.utf8"
    LC_PAPER="aa_DJ.utf8"
    LC_NAME="aa_DJ.utf8"
    LC_ADDRESS="aa_DJ.utf8"
    LC_TELEPHONE="aa_DJ.utf8"
    LC_MEASUREMENT="aa_DJ.utf8"
    LC_IDENTIFICATION="aa_DJ.utf8"
    LC_ALL=
    even though the users .config/user-dirs.locale is en_US
    Code:
    [cosmo@woodcomputer1 ~]$ cat .config/user-dirs.locale
    en_US
    "Never let the task you are trying to accomplish distract you from the study of computers."

  2. #2
    Join Date
    Jan 2010
    Posts
    7,269

    Re: How to set locale for user?

    Have you tried .bash_profile or .bashrc? (Untested by me, but I do set LC_CTYPE there).

  3. #3
    Join Date
    Aug 2004
    Posts
    4,070

    Re: How to set locale for user?

    Quote Originally Posted by smr54
    Have you tried .bash_profile or .bashrc? (Untested by me, but I do set LC_CTYPE there).
    Thanks for the suggestion. I tried it and it does cause the clock/calendar to have the correct language.

    Code:
    [cosmo@woodcomputer1 ~]$ cat /home/cosmo/.bashrc
    
    # .bashrc
    
    # Source global definitions
    if [ -f /etc/bashrc ]; then
    	. /etc/bashrc
    fi
    
    # Uncomment the following line if you don't like systemctl's auto-paging feature:
    # export SYSTEMD_PAGER=
    
    # User specific aliases and functions
    
    export LANG=en_US.utf8
    export LC_CTYPE="en_US.utf8"
    export LC_NUMERIC="en_US.utf8"
    export LC_TIME="en_US.utf8"
    export LC_COLLATE="en_US.utf8"
    export LC_MONETARY="en_US.utf8"
    export LC_MESSAGES="en_US.utf8"
    export LC_PAPER="en_US.utf8"
    export LC_NAME="en_US.utf8"
    export LC_ADDRESS="en_US.utf8"
    export LC_TELEPHONE="en_US.utf8"
    export LC_MEASUREMENT="en_US.utf8"
    export LC_IDENTIFICATION="en_US.utf8"
    # LC_ALL=
    What I don't understand is the fact that I have 3 FC 27 machines. Two installed from the liveCD and one upgraded from FC 26. The machine which requires the above change to the .bashrc file is one of those installed from the liveCD. The other two machines get the clock/calendar language the way I want it without setting those variables in .bashrc. All 3 machines have identical /etc/locale.conf files.
    "Never let the task you are trying to accomplish distract you from the study of computers."

  4. #4
    Join Date
    Dec 2007
    Location
    Australia
    Posts
    1,725

    Re: How to set locale for user?

    Perhaps if all the machines were identical hardware, differences from identical software might not appear.

  5. #5
    Join Date
    Jun 2005
    Location
    Montreal, Que, Canada
    Posts
    4,982

    Re: How to set locale for user?

    Have you tried localectl

    man localectl is the software that use may use to do what you want

    DESCRIPTION
    localectl may be used to query and change the system locale and
    keyboard layout settings. It communicates with systemd-localed(8) to
    modify files such as /etc/locale.conf and /etc/vconsole.conf.

    The system locale controls the language settings of system services and
    of the UI before the user logs in, such as the display manager, as well
    as the default for users after login.

    The keyboard settings control the keyboard layout used on the text
    console and of the graphical UI before the user logs in, such as the
    display manager, as well as the default for users after login.

    Note that the changes performed using this tool might require the
    initramfs to be rebuilt to take effect during early system boot. The
    initramfs is not rebuilt automatically by localectl.

    Note that systemd-firstboot(1) may be used to initialize the system
    locale for mounted (but not booted) system images.
    Leslie in Montreal

    Interesting web sites list
    http://forums.fedoraforum.org/showth...40#post1697840

  6. #6
    Join Date
    Aug 2004
    Posts
    4,070

    Re: How to set locale for user?

    Quote Originally Posted by lsatenstein
    Have you tried localectl
    Yes.

    The system-wide locale was correct, but I tired localectl anyway. It didn't change the user's locale.
    "Never let the task you are trying to accomplish distract you from the study of computers."

Similar Threads

  1. US locale
    By jbkt23 in forum F-20 Development Forum
    Replies: 0
    Last Post: 14th December 2013, 04:13 AM
  2. how do I set user locale with Fedora 17?
    By dejvid in forum Using Fedora
    Replies: 7
    Last Post: 9th December 2012, 06:36 PM
  3. after-Installation errors. locale error. unsupported locale settings | Error 17 | etc
    By LinuxNoobie in forum Installation, Upgrades and Live Media
    Replies: 2
    Last Post: 29th April 2008, 07:35 AM
  4. Replies: 0
    Last Post: 12th March 2008, 04:55 PM
  5. How to set locale in XDM
    By alpha645 in forum Using Fedora
    Replies: 0
    Last Post: 20th May 2007, 07:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •