dtlslocale.src 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. XCOMM!KORNSHELL
  2. XCOMM $XConsortium: dtlslocale.src /main/6 1996/11/19 11:42:40 drk $
  3. XCOMM
  4. XCOMM Common Desktop Environment
  5. XCOMM
  6. XCOMM (c) Copyright 1996 Digital Equipment Corporation.
  7. XCOMM (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
  8. XCOMM (c) Copyright 1993,1994,1996 International Business Machines Corp.
  9. XCOMM (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
  10. XCOMM (c) Copyright 1996 Novell, Inc.
  11. XCOMM (c) Copyright 1996 FUJITSU LIMITED.
  12. XCOMM (c) Copyright 1996 Hitachi.
  13. XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
  14. XCOMM Novell, Inc.
  15. XCOMM
  16. XCOMM Generate list of installed locales and locale desciptive names
  17. XCOMM
  18. (
  19. echo "LOCALELIST" # indicate start of locale list
  20. /usr/bin/locale -a # generate locale list
  21. echo "LSMLELIST" # indicate start of locale information list
  22. /usr/lib/nls/lsmle -c # generate locale information list
  23. ) |
  24. /usr/bin/awk '
  25. /LOCALELIST/ {state=0; next} # start of installed locale list
  26. /LSMLELIST/ {state=1; next} # start of locale information list
  27. state==0 { # processing locale list item
  28. split($0, a, "\."); # split item on blank
  29. lang[a[1]]=" " a[1]; # first element is language name
  30. }
  31. state==1 { # item format is: codeset desc desc [locale]
  32. split($0, a, " "); # split item on blank
  33. name=a[NF]; # get locale name
  34. sub(/\[/, "", name); # strip [
  35. sub(/\]/, "", name); # strip ]
  36. if (name in lang) { # was locale returned by locale -a?
  37. a[NF]=a[1]; # move codeset from front to end of array
  38. delete a[1]; # delete old codeset element in array
  39. lang[name]=""; # blank description
  40. for (i in a) { # use resulting array as desciption
  41. lang[name]=lang[name] " " a[i];
  42. }
  43. }
  44. }
  45. END {
  46. for (i in lang) { # if locale returned by locale -a
  47. print i lang[i]; # print "locale description"
  48. }
  49. }'