Saturday, February 7, 2009

Installing new languages and running applications in them

Awhile ago I promised to explain how to run applications in a different locale. This is quite useful as a developer, so that you can more robustly test your localization code. It can also be useful to translators who are translating to a locale which is not their default. Maybe you are learning a new language and want some extra practice in specific applications. Or, you may just want to see what your favorite application looks like in Russian or Hindi :)

There are basically only two steps to this rather simple process.

1. Install the desired languages. Go to System -> Administration -> Language Support. Scroll down the list, checking the "Support" box on the right for any language you want on your system. Once you are done click Apply and the necessary files will be downloaded for you. A logout and login is recommended by the application after this, and while not necessary, I recommend it as well (I've had a rare instance or so of segfaults when trying to use the locales before restarting the sesssion). If you want to follow along, ensure Russian is one of your choices.



2. Run the application under a different locale. You need to figure out the locale code that you want to run. In a terminal, run "locale -a" without the quotes, and you will see a list of all locales available on your system. If I want Russian, the one I am looking for in this list is "ru_RU.utf8". It is usually fairly obvious which one you want. Now, again in a terminal, just add "LC_ALL=ru_RU.utf8" before the application you want to run. If we want a Russian calculator for example, we would execute "LC_ALL=ru_RU.utf8 gcalctool". Ta-da!




This is a great way as a developer to make sure your applications are correctly detecting locales. I'd love to hear what you think and if there are any other reasons I missed that you may want to do this!

4 comments:

Livio said...

Русский? Such a beautiful language... It seems I'm not alone with my crazyness around this language :D .

Sébastien Giguère said...

Hi! I just remarked that your theme is very nice, can you tell where can i get it? Thanks very much!

Michael said...

Thanks Sébastien, it is the rather popular Dust theme: https://wiki.ubuntu.com/Artwork/Incoming/DustTheme . Don't forget to set your panel background, listed under "Other stuff to try". I also use the Firefox theme.

And if you aren't using gnome-colors as your icon set, I'd also recommend that :) https://wiki.ubuntu.com/Artwork/Incoming/Jaunty/gnome-colors and give it a vote if you like it.

sebastian-s said...

Hi!
thanks for the post, just two days ago I was messing around with Evolution and locals. I'm currently on en_AU and Evolution displays the time in 12h (am/pm) format in the email list view. Strangely in the email-detail view (or whatever it's called) the time is displayed in 24hrs.

I did some reading about this 'bug', which is not a bug for some. [launchpad bug 48128]

In the end I found out that setting the time local to say en_DK (LC_TIME=en_DK.UTF8) gives me 24hrs in Evolution.

Cheers,

seb