home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / std_unix / volume.20 / text0091.txt < prev    next >
Encoding:
Internet Message Format  |  1990-08-02  |  3.0 KB

  1. From:  nazgul@alphalpha.com (Kee Hinckley)
  2.  
  3. In article <387@usenix.ORG> From: <jsh@usenix.org>
  4. >To help you think about the problem, here's the way you'll have to
  5. >write the "hello, world" koan using the X/OPEN interfaces:
  6. ....
  7. >          (void)setlocale(LC_ALL, "");
  8. >          catd = catopen("hello", 0); /* error checking omitted for brevity */
  9. >          printf(catgets(catd, 1, 1,"hello, world\n"));
  10. ....
  11. >and using the alternative, proposed UniForum interfaces:
  12. ....
  13. >          (void)setlocale(LC_ALL, "");
  14. >          (void)textdomain("hello");
  15. >          printf(gettext("hello, world\n"));
  16. ....
  17. >I suppose if I had my druthers, I'd like to see a standard interface
  18. >that goes even farther than the UniForum proposal: one that adds a
  19. ....
  20. >          (void)setlocale(LC_ALL, ""); /* inescapable, required by ANSI C */
  21. >          printf("hello, world\n");
  22. ....
  23. >but that would still be untested innovation.
  24.  
  25. First of all, I don't think that either of these add enough of value to the
  26. X/Open standard to make it worthwhile for those of using it to switch.
  27. The use of strings as an index into the catalog though is definitely a BAD IDA.
  28.  
  29. Why?  A number of reasons.  First of all it's ethnocentric.  You've just told
  30. every Easterner/MiddleEasterner that the default language is English.  Secondly
  31. it's inefficent to and a pain to implement.  Thirdly it can produce results
  32. which are just plain wrong.  I have different places in my application where
  33. the English string is currently the same.  Using these schemes it would always
  34. look up the same item in the catalog.  However in a different language the
  35. string might well be different, but there would be no way of changing it one place
  36. and not the other.
  37.  
  38. BTW.  Where can I get a specification of the Uniforum proposal (and comment
  39. on it)?
  40.  
  41. The complexity of the X/Open stuff is easily hidden on a per application basis.
  42. Anytime I want to reference a string in my application all I have to say
  43. is MC(foo), where foo is #defined appropriately.
  44.  
  45. Where I *do* see room for improvement is in the definition of the catalog
  46. file itself.  There is currently no specification for generating include
  47. files or anything else, and hand numbering the strings is a royal pain.
  48.  
  49. If you consider the X/Open form:
  50.  
  51. $set 1 OmUA
  52. $ #To
  53. 1 To:
  54. $ #From
  55. 2 From:
  56. $ #Subject
  57. 3 Subject:
  58.  
  59. (where '$ ' is a comment).  I've written a parser that
  60. treats comments beginning with '#' as special and allows
  61. '#' instead of the number.  Thus
  62.  
  63. $set 1 OmUA
  64. $ #To
  65. # To:
  66. $ #From
  67. # From:
  68. $ #Subject
  69. # Subject:
  70.  
  71. generates
  72.  
  73. #ifndef __msgsH
  74. #define __msgsH
  75.  
  76. #define SETOmUA    1
  77. #define OmUATo    1
  78. #define OmUAFrom    2
  79. #define OmUASubject    3
  80.  
  81. #endif
  82.  
  83. It would be nice to be able to rely on this kind of functionality.
  84.  
  85. -- 
  86. Alphalpha Software, Inc.    |    motif-request@alphalpha.com
  87. nazgul@alphalpha.com        |-----------------------------------
  88. 617/646-7703 (voice/fax)    |    Proline BBS: 617/641-3722
  89.  
  90. I'm not sure which upsets me more; that people are so unwilling to accept
  91. responsibility for their own actions, or that they are so eager to regulate
  92. everyone else's.
  93.  
  94. Volume-Number: Volume 20, Number 90
  95.  
  96.