Locale (Español)

From ArchWiki
Revision as of 22:44, 5 August 2008 by Starchox (Talk | contribs) (Locales (Españo): iniciado)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Locale (Español)#)
Template:I18n links start

Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

Introducción

Los locales son utilizados en Linux para definir cual lenguaje utiliza el usuario. Como los locales definene también el mapa de carácteres que utiliza el usuario, ajustar el locale correcto es especialmente importante si el lenguaje contiene carácteres fuera del ASCII.

El Nombrado Locale esta definido como sigue:

<lang>_<territory>.<codeset>[@<modifiers>]

En está guia configuramos un sistema que utiliza el locale es_MX.UTF-8, pero puede seguirse este artículo facilmente si se desea configurar otro locale diferente.

Habilitando el locale necesario

Primero es necesario que se habiliten los locales que se quieren soportar en el sistema. Para habilitar o deshabilirarlos, se utiliza el archivo /etc/locale.gen. Este contiene todos los locale que se pueden habilitar, y sólo se tiene que descomentar las lineas que se desean.

Como se quiere una configuración UTF-8 en español para el sistema, habilitamos es_MX.UTF-8. Pero por compatibilidad con los programas que no soportan UTF-8 aún, es recomendable dar soporte a cualquier otro locale, también con el prefijo es_MX. Teniendo esto en mente, habilitamos este conjuno de locales:

es_MX.UTF-8     UTF-8
es_MX   ISO-8859-1

Después de haber habilitado los locales necesarios, se tendra que ejecutar el comando locale-gen como usuario root para actualizarlos:

# locale-gen
Generating locales...
  es_MX.UTF-8... done
  es_MX.ISO-8859-1... done
Generation complete.

Template:Box Note

Setting system wide locale

To define which locale should be used by the system, you can easily add your locale to your /etc/rc.conf file. As we've just added ISO-8859 support just for (backward-)compability, we add en_US.utf-8 here:

LOCALE="en_US.utf8"

The system wide locale will be updated after rebooting your computer.

Important: You need to type the name of the locale exactly as shown in the output of `locale -a`. E.g. LOCALE="en_US.utf8" is valid, while LOCALE="en_US.UTF-8" is not.

Setting per user locale

As we discussed earlier, some users might want to define a different locale than the system-wide locale. In this case, you can export LC_ALL in your ~/.bashrc. For example you can use the en_US.iso8859 locale, though there is no advantage of using it.

export LC_ALL=en_US.iso8859

Your locales will be updated as soon as you re-source your ~/.bashrc. This happens on login or alternatively you can type:

$ source ~/.bashrc

Setting language

The language in which the system interacts with the user is also determined by the locales, namely the locale LC_LANG. To set the preferred language, you have to export the LC_LANG variable in your ~/.bashrc.

export LC_LANG=en_EN.utf8

After sourcing your ~/.bashrc, programs ought to use the defined language, at least they do if they're using proper internationalization.

Setting starting weekday

In a lot of countries the first day of the week is Monday. To do change or add the following lines under the LC_TIME section in /usr/share/i18n/locales/<your_locale>

week            7;19971130;5
first_weekday   2
first_workday   2

And then run

# locale-gen

and restart X.

Troubleshooting

How can I obtain the available locale names?

You can get the correct names of all available locales with this command:

$ locale -a

How can I see which locale I am using?

Which locale is currently in use is viewable simply by typing:

$ locale

My terminal doesn't support UTF-8 characters

Unfortunately some terminals don't support UTF-8. In this case, you have to use a different terminal.

List of terminals that support UTF-8:

  • gnome-terminal
  • gnustep-terminal
  • konsole
  • mlterm
  • urxvt (rxvt-unicode)
  • xfce-terminal
  • xterm

Note: This list may be incomplete.

xterm doesn't support UTF-8 characters for me

xterm only supports UTF-8 if you run it as uxterm or xterm -u8.

Links

GentooWiki: Localdef