<< there's no place like 127.0.0.1

When you get a new VPS, you’ve got a powerful new system that is a server all unto yours. There is quite a bit of customization you can do to make it suite your needs. Today, I am going to show you how to change the language of your SSH terminal.

Changing your VPS language setting allows you to type and sort by special characters not available in English. But more than that, it is language localization. You pick not only your language, but your country as well. This allows the server to reset date formats, use of commas and points in numbering systems, display options, etc. Bear in mind that changing VPS language settings won’t translate things such as file names or contents of files.

In addition, most GNU programs on your server use localization, wherein they customize their interface based on the VPS language localization settings. Intelligent applications using internationalization can greatly reduce the difficulty of interfacing with a server for non-English speakers.

While logged into your server via SSH, you can see what the current language setting is by running the following command:

    locale

The output of the command will be something like this:

    LANG=en_US.UTF-8
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=  

en_US is the language code (English) followed by the country code (United States).

To change the language of your system, as well as all the other parameters above, you will modify the LANG. To see list of all the supported locales, run:

    locale -a

You’ll notice that names on the list are named with the format: Language_Country. Simply looks for the two letter code for language and country that you want. For example, if you want to set it to Spanish/Puerto Rico, you would select: es_PR. If you want to set it to Farsi, you would use: fa_IR

Check out this handy guide to look up the right code for your language and location: http://lh.2xlibre.net/locales/

Once you have picked out the language and location you want to use, you will need to edit the following file:

    /etc/sysconfig/i18n  

And then simply modify the line the reads something like this:

    LANG="en_US.UTF-8"  

You will need to close your SSH session and restart a new session for the changes to take effect.

Note: If you are using Terminal on a Mac, you may need to also type the following for your session to load the updated configuration:

    su -  

If you are having trouble getting these changes to take effect and show up when you initiate another locale command, then check that the default language is not set. In Nano, look at the entire file. Which lines are preceded by hash marks (#)? Those lines are designated as “comments” and not read by programs accessing the file. For example:

    #LANG="en_US.utf8"  
    #SUPPORTED="en_US.UTF-8:en_US:en"  
    #SYSFONT="latarcyrheb-sun16"  
    LANG="C"  

In this example, the LANG will always be the default (C). To change this, switch the line that is read by erasing and creating hash marks:

    #LANG="en_US.utf8"  
    #SUPPORTED="en_US.UTF-8:en_US:en"  
    #SYSFONT="latarcyrheb-sun16"  
    LANG="C"  

Now the session configuration will be based on the first line (not the fourth), and you can replace the language/location information as desired.

Example

Here is a ‘Before’ language change:

SSH-English

Here is an ‘After’ language change (to Farsi):

SSH-Farsi

Note about this article

This article is one I had written and shared with the ServInt blog as part of the ‘Tech bench’ series. You can view it on the ServInt blog here. They are using my article with my permission.

Change Log

This post has been updated since it’s original publishing. Here is a list of changes:

  • 06/26/13: More verbage changes
  • 06/20/12: Revised for more details

Running Gitit Wiki with Upstart

I know I've been rather quiet lately. I've been busy travelling for a little bit and found myself at a new job. Well, now I'm getting bac...… Continue reading

Installing ImageMagick & PHP Imagick

Published on March 26, 2015