Difference between revisions of "Talk:Locale"

From ArchWiki
Jump to: navigation, search
(locale.conf quotes: new section)
(Sourcing locale.sh: re)
 
(71 intermediate revisions by 13 users not shown)
Line 1: Line 1:
== .bashrc ==
+
== Create custom locale ==
  
.bashrc is only used by interactive bash sessions, right? So that if you login with KDM in KDE (or GDM gnome), the whole KDE session will inherit the locale set by init->KDM and will not use the one set in .bashrc!
+
:''[Moved from the main article. -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 23:15, 24 February 2016 (UTC)]''
  
I guess a "source ~/.bashrc" in ~/.xprofile would solve this.
+
Modified locales will not survive the upgrade of {{pkg|glibc}} because the relevant file is not in the [https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/glibc#n19 backup field] in the PKGBUILD. Custom locales should be ''created'' instead. -- [[User:Lahwaacz]] 08:59, 22 December 2014
  
--[[User:Luetti|Luetti]] 17:56, 8 July 2008 (EDT): I don't think so. I tried almost the whole day to set only LC_PAPER="de_DE.utf8". Trying this in almost every file possible (/etc/profile, .xprofile, .bashrc, /etc/rc.local) seemed to work, as I used "locale" in terminal to verify it. But this only worked for applications I started from terminal, but not for applications started from the gnome-menu. So I came to the conclusion it has something to do with gdm. After having a closer look to /etc/gdm/xsession the problem was clear. GDM probably always sets $GDM_LANG on login. When $GDM_LANG is set, xsession will unset all other LC-variables. Just commented out this part and now everything works as desired.
+
<hr>
If this is a common and/or important problem, I will add this to the article. What do you think?
+
=== Customizing locales ===
  
== LC_MESSAGES ==
+
Locales are defined in text files located in {{ic|/usr/share/i18n/locales/}} and can be edited to adapt to particular needs.
  
Setting LC_MESSAGES to "C" or "POSIX" (as opposed to "en_US.UTF-8" for example), can save tens of syscalls in a simple program without any loss (since all you need is plain English anyway). It's 29 less syscalls (on my system) for a simple "ls /no/such/dir".  Add this info inside?  --[[User:Philomath|Philomath]] ([[User talk:Philomath|talk]]) 07:55, 2 July 2012 (UTC)
+
After editing a locale file, do not forget to [[#Generating locales|re-generate]] the locales for the changes to take effect after reboot.
  
 +
==== Setting the first day of the week ====
  
== locale.sh ==
+
In many countries the first day of the week is Monday. To adjust this, change or add the following lines:
If setting locale.conf doesn't work (symptom: everything is set to POSIX no matter whats in locale.conf), reinstall filesystem.
+
(locale.sh somehow gets lost, see comment here https://plus.google.com/114015603831160344127/posts/2zKCcnTWDpa happens after the switch to systemd)
+
  
JKAbrams 01 December 2012
+
{{hc|/usr/share/i18n/locales/''chosen_locale''|
 +
LC_TIME
 +
[...]
 +
week            7;19971130;5
 +
first_weekday  2
 +
first_workday  2
 +
}}
  
== locale.conf quotes ==
+
==<s> LC_ALL section </s>==
  
Are the quotes mandatory in locale.conf?
+
Regarding [https://wiki.archlinux.org/index.php?title=Locale&diff=next&oldid=422096], the section was on its own because locale.conf doesn't support it (locale.conf(5)). If we want to keep LC_ALL there I think we should adapt the [[Locale#Supported variables]] heading or at least its few intro words. — [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 01:56, 25 February 2016 (UTC)
Im wondering because in the [[Beginners'_Guide#Locale|Beginners'_Guide]] there is no quote.
+
 
--[[User:Bikepunk|Bikepunk]] ([[User talk:Bikepunk|talk]]) 22:10, 26 December 2012 (UTC)
+
:Fixed with [https://wiki.archlinux.org/index.php?title=Locale&diff=440597&oldid=440587]. — [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 04:41, 9 July 2016 (UTC)
 +
 
 +
== Login manager missing ==
 +
 
 +
This article does not cover the login manager. I have my system in *German*, but my login manager is still using the *English* keyboard layout, and I don't know how to change it. [[Locale]] does not cover it, and I couldn't find anything in [[Display_manager#Set_the_language|Display manager]] neither - albeit there is a comment that it is missing and *should* be linked here.
 +
 
 +
So How do I change the locale in the display manager?
 +
 
 +
--[[User:Nerdoc|Nerdoc]] ([[User talk:Nerdoc|talk]]) 04:33, 10 March 2016 (UTC)
 +
 
 +
:"The" display manager, there's a few dozen of them. So which do you use? -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 14:37, 10 March 2016 (UTC)
 +
 
 +
== <s>Sourcing locale.sh</s> ==
 +
 
 +
[https://wiki.archlinux.org/index.php?title=Locale&diff=next&oldid=440346] removed the following (maybe it could have been split in more edits btw):
 +
 
 +
----
 +
 
 +
Once {{ic|locale.conf}} files have been created or edited, their new values will take effect for new sessions at login. To have the current environment use the new settings, do:
 +
 
 +
$ LANG= source /etc/profile.d/locale.sh
 +
 
 +
{{Note|The {{ic|LANG}} variable has to be unset first, otherwise {{ic|locale.sh}} will not update the values from {{ic|locale.conf}}. Only new and changed variables will be updated, variables removed from {{ic|locale.conf}} will still be set in the session.}}
 +
----
 +
 
 +
What was wrong with it?
 +
 
 +
— [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 04:25, 9 July 2016 (UTC)
 +
 
 +
:I replaced it with this:
 +
 
 +
:----
 +
 
 +
:To make the above change immediate do:
 +
 
 +
:{{bc|1=$ export LANG=''en_US.UTF-8''}}
 +
 
 +
:Otherwise, the change will not take affect until the system is rebooted.
 +
 
 +
:----
 +
:It seems more concise and doesn't require the note about unsetting LANG first to source locale.sh directly. But I see now that locale.sh sources all the configurations. I'll add this back.
 +
 
 +
:Okay, I've put it back in a new section. Feel free to make any changes to it. Thanks for pointing this out. I definitely should have done more smaller edits on this one. Closing unless you have further discussion. -- [[User:Rdeckard|Rdeckard]] ([[User_talk:Rdeckard|talk]]) 12:09, 9 July 2016 (UTC)
 +
 
 +
::I like it, thank you :) — [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 13:17, 9 July 2016 (UTC)
 +
 
 +
:::Also let me point out that you've done a great job on merging clarifications from the [[Beginners' guide]] and otherwise improve the structure of the article. -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 17:14, 12 July 2016 (UTC)

Latest revision as of 17:14, 12 July 2016

Create custom locale

[Moved from the main article. -- Alad (talk) 23:15, 24 February 2016 (UTC)]

Modified locales will not survive the upgrade of glibc because the relevant file is not in the backup field in the PKGBUILD. Custom locales should be created instead. -- User:Lahwaacz 08:59, 22 December 2014


Customizing locales

Locales are defined in text files located in /usr/share/i18n/locales/ and can be edited to adapt to particular needs.

After editing a locale file, do not forget to re-generate the locales for the changes to take effect after reboot.

Setting the first day of the week

In many countries the first day of the week is Monday. To adjust this, change or add the following lines:

/usr/share/i18n/locales/chosen_locale
LC_TIME
[...]
week            7;19971130;5
first_weekday   2
first_workday   2

LC_ALL section

Regarding [1], the section was on its own because locale.conf doesn't support it (locale.conf(5)). If we want to keep LC_ALL there I think we should adapt the Locale#Supported variables heading or at least its few intro words. — Kynikos (talk) 01:56, 25 February 2016 (UTC)

Fixed with [2]. — Kynikos (talk) 04:41, 9 July 2016 (UTC)

Login manager missing

This article does not cover the login manager. I have my system in *German*, but my login manager is still using the *English* keyboard layout, and I don't know how to change it. Locale does not cover it, and I couldn't find anything in Display manager neither - albeit there is a comment that it is missing and *should* be linked here.

So How do I change the locale in the display manager?

--Nerdoc (talk) 04:33, 10 March 2016 (UTC)

"The" display manager, there's a few dozen of them. So which do you use? -- Alad (talk) 14:37, 10 March 2016 (UTC)

Sourcing locale.sh

[3] removed the following (maybe it could have been split in more edits btw):


Once locale.conf files have been created or edited, their new values will take effect for new sessions at login. To have the current environment use the new settings, do:

$ LANG= source /etc/profile.d/locale.sh
Note: The LANG variable has to be unset first, otherwise locale.sh will not update the values from locale.conf. Only new and changed variables will be updated, variables removed from locale.conf will still be set in the session.

What was wrong with it?

Kynikos (talk) 04:25, 9 July 2016 (UTC)

I replaced it with this:
----
To make the above change immediate do:
$ export LANG=en_US.UTF-8
Otherwise, the change will not take affect until the system is rebooted.
----
It seems more concise and doesn't require the note about unsetting LANG first to source locale.sh directly. But I see now that locale.sh sources all the configurations. I'll add this back.
Okay, I've put it back in a new section. Feel free to make any changes to it. Thanks for pointing this out. I definitely should have done more smaller edits on this one. Closing unless you have further discussion. -- Rdeckard (talk) 12:09, 9 July 2016 (UTC)
I like it, thank you :) — Kynikos (talk) 13:17, 9 July 2016 (UTC)
Also let me point out that you've done a great job on merging clarifications from the Beginners' guide and otherwise improve the structure of the article. -- Alad (talk) 17:14, 12 July 2016 (UTC)