Fixing locales: Difference between revisions

tagged
No edit summary
Line 1: Line 1:
I was having locale problems. Why?  I don't know.  But all of a sudden, applications like K3B would complain about locales not being properly set.
== Intro ==
I was having locale problems. Why?  I don't know.  But all of a sudden, applications like K3B ('''see the hack at the end of this article''') would complain about locales not being properly set.


For example, viewing a man page in Konsole would generate a warning about "LC_ALL" not being set
For example, viewing a man page in Konsole would generate a warning about "LC_ALL" not being set
Line 25: Line 26:
</pre>
</pre>


then I did a  
then I did a
<source lang="bash">
<source lang="bash">
sudo dpkg-reconfigure locales
sudo dpkg-reconfigure locales
Line 33: Line 34:
That command seems to regenerate all the locales in  <code>/usr/lib/locale/</code>
That command seems to regenerate all the locales in  <code>/usr/lib/locale/</code>


 
== Documentation ==
There are a dizzying number of files, programs and settings involved in locale; and worse -- there are differences between distributions on what commands work, how they work; and where the configurations are stored.
There are a dizzying number of files, programs and settings involved in locale; and worse -- there are differences between distributions on what commands work, how they work; and where the configurations are stored.
I suggest that you start off with  
I suggest that you start off with
<source lang="bash">
<source lang="bash">
man:/locale-gen
man:/locale-gen
Line 45: Line 46:


All the files in <code>/var/lib/belocs</code>
All the files in <code>/var/lib/belocs</code>
will get updated when you run  
will get updated when you run
<source lang="bash">
<source lang="bash">
sudo dpkg-reconfigure locales
sudo dpkg-reconfigure locales
Line 57: Line 58:
locale
locale
locale -a
locale -a
locale -m  
locale -m
</pre>
</pre>
are
are


in  
in
<code>/etc/default/locale</code>
<code>/etc/default/locale</code>
I have these two lines:
I have these two lines:
Line 68: Line 69:
LANGUAGE="en_US:en"
LANGUAGE="en_US:en"
</pre>
</pre>
in  
in
<code>/etc/environment</code>
<code>/etc/environment</code>
I have
I have
Line 76: Line 77:
LANG="en_US.UTF-8"
LANG="en_US.UTF-8"
</pre>
</pre>
in  
in
<code>/usr/share/i18n/SUPPORTED</code>
<code>/usr/share/i18n/SUPPORTED</code>
there is a very long list of the supported locales.  You can take any number of them and add them to your  
there is a very long list of the supported locales.  You can take any number of them and add them to your
<code>/var/lib/locales/supported.d/local</code>
<code>/var/lib/locales/supported.d/local</code>
{{ambox  
{{ambox
|text= Caution: each supported locale on your system will take up something like 50MB of space -- so don't choose them all.
|text= Caution: each supported locale on your system will take up something like 50MB of space -- so don't choose them all.
}}
}}


== Workaround ==
== Hack ==
Setting environment variables prior to launching an application is one way to work around this problem, but obviously does not solve it on a system-wise basis.  I used this command in KMenu to get around the fact that the variable ''was'' set system-wide, but didn't get picked up in the application environment:
Setting environment variables prior to launching an application is one way to work around this problem, but obviously does not solve it on a system-wise basis.  I used this command in KMenu to get around the fact that the variable ''was'' set system-wide, but didn't get picked up in the application environment:
<code>
<source lang="bash">
env LC_ALL='en_US.UTF-8' && k3b %U
env LC_ALL='en_US.UTF-8' && k3b %U
</code>
# or the simpler
LC_ALL=en_US.UTF-8 k3b %U
</source>
and appended to an existing bug report with the workaround information
and appended to an existing bug report with the workaround information
(note that double quotes do not work in the KMenu environment.)
(note that double quotes do not work in the KMenu environment.)


[[Category:Howto]]
[[Category:Howto]]
[[Category:System Administration]]