New locales available for scripts

A customer pointed out that our servers didn’t have many “locales” installed. A “locale” is a set of rules that apply to a language, region or culture — things like the language’s words for “January” and “Monday”, the way that dates are displayed, and the currency symbol used.

Locales are useful, because when they’re available, a script can easily generate things like dates in different languages. For example, this script:

<?php
  echo strftime("%A %E %B %Y");
?>

… will normally print “Tuesday 8 January 2008”. But if the French locale is available, adding one line:

<?php
  setlocale(LC_ALL, 'fr_FR');
  echo strftime("%A %E %B %Y");
?>

… will print “mardi 8 janvier 2008” instead.

So having many locales available on a server makes it easy for scripts to show dates and other information in ways beyond the standard “US English” display.

As of today, we’ve installed many extra locales on our servers for English, French, German, Italian and Spanish languages. (All these languages have more than one actual locale, because the English language, for example, uses different currency symbols and date formats depending on which country you’re in.) We hope some customers find this useful.

For more information about changing locales in a script, see the “setlocale()” command in your favorite programming language. Advanced users can get a full list of the available locales on the server by making a shell connection and typing “locale -a”.