As we are talking about en_US.UTF-8:

General warning: Please do not use the locale name en_US.UTF-8 anywhere
outside North America. Some older Solaris documentation suggested that
this is the only UTF-8 locale you'll ever need, as locales don't change
much sensible beyond the encoding anyway. This is not the case any more
today!

An increasing number of programs of US origin finally start to abandon
the annoying old habit of assuming Legal paper and non-metric units as
default conventions everywhere, requiring 95% of the world population to
figure out how to reconfigure to the standard conventions.

More recent software releases instead determine the default setting for
conventions such as paper format and units of measurement with code
similar to the following (feel free to copy it into your software as
well):


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* LC_PAPER and LC_MEASUREMENT were introduced in ISO/IEC TR 14652 */

int main()
{
  char *units = "mm";
  char *paper = "A4";
  char *s;

  if (((s = getenv("LC_ALL"))   && *s) ||
      ((s = getenv("LC_PAPER")) && *s) ||
      ((s = getenv("LANG"))     && *s))
    if (strstr(s, "_US") || strstr(s, "_CA"))
      paper = "Letter";
  if (((s = getenv("LC_ALL"))   && *s) ||
      ((s = getenv("LC_MEASUREMENT")) && *s) ||
      ((s = getenv("LANG"))     && *s))
    if (strstr(s, "_US"))
      units = "inches";

  printf("Paper: %s\nUnits: %s\n", paper, units);
  
  return 0;
}


This leads to portable and agreeable default settings, using the
standard values UNLESS you are in a locale that explicitely says that
you are in North America. I think that's a very good implementation
practice, but it requires that if you explain to an international
audience how to activate UTF-8 locales, you should better use a non-US/
CA locale. (en_GB.UTF-8 for instance seems like an excellent choice ... :)

Markus

-- 
Markus G. Kuhn, Computer Laboratory, University of Cambridge, UK
Email: mkuhn at acm.org,  WWW: <http://www.cl.cam.ac.uk/~mgk25/>

_______________________________________________
I18n mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/i18n

Reply via email to