Changeset 6ebb3b9
- Timestamp:
- 01/28/2024 12:43:40 PM (3 months ago)
- Branches:
- 12.1, 12.1-rc1, multilib, trunk, xry111/arm64, xry111/clfs-ng, xry111/loongarch, xry111/loongarch-12.1, xry111/mips64el, xry111/update-glibc
- Children:
- ee950a5e
- Parents:
- 8497448
- git-author:
- Xi Ruoyao <xry111@…> (01/28/2024 12:41:00 PM)
- git-committer:
- Xi Ruoyao <xry111@…> (01/28/2024 12:43:40 PM)
- Location:
- chapter09
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter09/chapter09.xml
r8497448 r6ebb3b9 27 27 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/> 28 28 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/> 29 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/>30 29 31 30 <!-- systemd --> 32 31 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="clock.xml"/> 33 32 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="consoled.xml"/> 34 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="locale.xml"/>35 33 36 34 <!-- common --> 35 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="locale.xml"/> 37 36 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/> 38 37 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="etcshells.xml"/> -
chapter09/locale.xml
r8497448 r6ebb3b9 6 6 ]> 7 7 8 <sect1 id="ch-config-locale" revision="systemd">8 <sect1 id="ch-config-locale"> 9 9 <?dbhtml filename="locale.html"?> 10 10 … … 12 12 13 13 <indexterm zone="ch-config-locale"> 14 <primary sortas="e- etc-locale-conf">/etc/locale.conf</primary>14 <primary sortas="e-/etc/profile">/etc/profile</primary> 15 15 </indexterm> 16 16 17 <para>The <filename>/etc/locale.conf</filename> file below sets some 18 environment variables necessary for native language support. Setting 19 them properly results in:</para> 17 <indexterm zone="ch-config-locale" revision='systemd'> 18 <primary sortas="e-/etc/profile">/etc/locale.conf</primary> 19 </indexterm> 20 21 <para revision='systemd'>The <filename>/etc/locale.conf</filename> file 22 below sets some environment variables necessary for native language 23 support. Setting them properly results in:</para> 24 25 <para>Some environment variables are necessary for native language 26 support. Setting them properly results in:</para> 20 27 21 28 <itemizedlist> … … 98 105 might provide some useful information.</para> 99 106 100 <para >Once the proper locale settings have been determined, create the101 <filename>/etc/locale.conf</filename> file:</para>102 103 <screen ><userinput>cat > /etc/locale.conf << "EOF"107 <para revision='systemd'>Once the proper locale settings have been 108 determined, create the <filename>/etc/locale.conf</filename> file:</para> 109 110 <screen revision='systemd'><userinput>cat > /etc/locale.conf << "EOF" 104 111 <literal>LANG=<replaceable><ll>_<CC>.<charmap><@modifiers></replaceable></literal> 105 112 EOF</userinput></screen> 106 113 107 <para>Note that you can modify <filename>/etc/locale.conf</filename> with the 114 <para>The shell program <command>/bin/bash</command> (here after referred 115 as <quote>the shell</quote>) uses a collection of startup files to help 116 create the environment to run in. Each file has a specific use and may 117 affect login and interactive environments differently. The files in the 118 <filename class="directory">/etc</filename> directory provide global 119 settings. If equivalent files exist in the home directory, they 120 may override the global settings.</para> 121 122 <para>An interactive login shell is started after a successful login, 123 using <command>/bin/login</command>, by reading the 124 <filename>/etc/passwd</filename> file. An interactive non-login shell is 125 started at the command-line (e.g. 126 <prompt>[prompt]$</prompt><command>/bin/bash</command>). A 127 non-interactive shell is usually present when a shell script is running. 128 It is non-interactive because it is processing a script and not waiting 129 for user input between commands.</para> 130 131 <para><phrase revision='systemd'>The login shells are often unaffected by 132 the settings in <filename>/etc/locale.conf</filename>. </phrase>Create the 133 <filename>/etc/profile</filename> 134 <phrase revision='sysv'>once the proper locale settings have been 135 determined to set the desired locale</phrase><phrase 136 revision='systemd'>to read the locale settings from 137 <filename>/etc/locale.conf</filename> and export them</phrase>, 138 but set the <literal>C</literal> locale instead if running in the Linux 139 console (to prevent programs from outputting characters that the Linux 140 console is unable to render):</para> 141 142 <screen revision="systemd"><userinput>cat > /etc/profile << "EOF" 143 <literal># Begin /etc/profile 144 145 for i in $(locale); do 146 unset ${i%=*} 147 done 148 149 if [[ "$TERM" = linux ]]; then 150 export LANG=C 151 else 152 source /etc/locale.conf 153 154 for i in $(locale); do 155 key=${i%=*} 156 if [[ -v $key ]]; then 157 export $key 158 fi 159 done 160 fi 161 162 # End /etc/profile</literal> 163 EOF</userinput></screen> 164 165 <screen revision="sysv"><userinput>cat > /etc/profile << "EOF" 166 <literal># Begin /etc/profile 167 168 for i in $(locale); do 169 unset ${i%=*} 170 done 171 172 if [[ "$TERM" = linux ]]; then 173 for i in $(locale); do 174 unset ${i%=*} 175 done 176 177 export LANG=C 178 else 179 export LANG=<replaceable><ll>_<CC>.<charmap><@modifiers></replaceable> 180 fi 181 182 # End /etc/profile</literal> 183 EOF</userinput></screen> 184 185 <para revision='systemd'>Note that you can modify <filename>/etc/locale.conf</filename> with the 108 186 systemd <command>localectl</command> utility. To use 109 187 <command>localectl</command> for the example above, run:</para> 110 188 111 <screen role="nodump"><userinput>localectl set-locale LANG="<replaceable><ll>_<CC>.<charmap><@modifiers></replaceable>"</userinput></screen> 112 113 <para>You can also specify other language specific environment variables such 114 as <envar>LANG</envar>, <envar>LC_CTYPE</envar>, <envar>LC_NUMERIC</envar> or 115 any other environment variable from <command>locale</command> output. Just 116 separate them with a space. An example where <envar>LANG</envar> is set as 189 <screen revision='systemd' role="nodump"><userinput>localectl set-locale LANG="<replaceable><ll>_<CC>.<charmap><@modifiers></replaceable>"</userinput></screen> 190 191 <para revision='systemd'>You can also specify other language specific 192 environment variables such as <envar>LANG</envar>, 193 <envar>LC_CTYPE</envar>, <envar>LC_NUMERIC</envar> or any other 194 environment variable from <command>locale</command> output. Just separate 195 them with a space. An example where <envar>LANG</envar> is set as 117 196 en_US.UTF-8 but <envar>LC_CTYPE</envar> is set as just en_US is:</para> 118 197 119 <screen role="nodump"><userinput>localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US"</userinput></screen> 120 121 <note><para>Please note that the <command>localectl</command> command 122 doesn't work in the chroot environment. It can only 123 be used after the LFS system is booted with systemd.</para></note> 198 <screen revision='systemd' role="nodump"><userinput>localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US"</userinput></screen> 199 200 <note revision='systemd'><para>Please note that the 201 <command>localectl</command> command doesn't work in the chroot 202 environment. It can only be used after the LFS system is booted with 203 systemd.</para></note> 124 204 125 205 <para>The <literal>C</literal> (default) and <literal>en_US</literal> … … 135 215 if you are certain that you will never need 8-bit characters.</para> 136 216 137 <!--138 <para>UTF-8 based locales are not supported well by many programs.139 Work is in progress to document and, if possible, fix such problems, see140 <ulink url="&blfs-book;introduction/locale-issues.html"/>.</para>141 -->142 143 217 </sect1>
Note:
See TracChangeset
for help on using the changeset viewer.