msgs.c 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: msgs.c /main/4 1995/11/01 15:56:14 rswiston $ */
  24. #include "stdio.h"
  25. #include <sys/param.h>
  26. #include <string.h>
  27. #ifndef _SUN_OS
  28. #include <nl_types.h>
  29. #endif
  30. #include "msgs.h"
  31. #include "error.h"
  32. char *_DtGetMessage(char *filename, char *s)
  33. {
  34. char * loc = getenv("LANG");
  35. return(ERROR_translate(loc, 0, _CLIENT_CAT_NAME, s));
  36. }
  37. char *
  38. GetSharedMsg(
  39. int msgId )
  40. {
  41. char * msg;
  42. switch (msgId)
  43. {
  44. case DT_BAD_FIELD_NAME:
  45. msg = GETMESSAGE("Cannot find a field named '%s' in the structure '%s'");
  46. break;
  47. case DT_CONV_BUF_OVFL:
  48. msg = GETMESSAGE("DtkshCvtCallbackToString: An internal conversion buffer overflowed");
  49. break;
  50. case DT_HASHING_FAILURE:
  51. msg = GETMESSAGE("Hashing failure for resource '%s' in widget class '%s'");
  52. break;
  53. case DT_NO_FUNC_NAME:
  54. msg = GETMESSAGE("No function name was supplied");
  55. break;
  56. case DT_TK_NOT_INIT:
  57. msg = GETMESSAGE("The command cannot be executed; the toolkit has not been initialized");
  58. break;
  59. case DT_WIDGET_CREATE_FAILED:
  60. msg = GETMESSAGE("The creation of widget '%s' failed");
  61. break;
  62. case DT_BAD_DISPLAY:
  63. msg = GETMESSAGE("The display parameter is invalid: %s");
  64. break;
  65. case DT_BAD_ATOM:
  66. msg = GETMESSAGE("The following property atom is invalid: %s");
  67. break;
  68. case DT_UNDEF_RESOURCE:
  69. msg = GETMESSAGE("The following resource is not defined for widget '%s': %s");
  70. break;
  71. case DT_BAD_POSITION:
  72. msg = GETMESSAGE("The position specified is invalid: %s");
  73. break;
  74. case DT_BAD_FONT:
  75. msg = GETMESSAGE("The specified font is invalid: %s");
  76. break;
  77. case DT_BAD_WIDGET_HANDLE:
  78. msg = GETMESSAGE("The widget handle '%s' does not refer to an existing widget");
  79. break;
  80. case DT_CMD_WIDGET:
  81. msg = GETMESSAGE("The widget must be a 'command' widget");
  82. break;
  83. case DT_MAIN_WIN_WIDGET:
  84. msg = GETMESSAGE("The widget must be a 'mainWindow' widget");
  85. break;
  86. case DT_SCALE_WIDGET:
  87. msg = GETMESSAGE("The widget must be a 'scale' widget");
  88. break;
  89. case DT_SCROLLBAR_WIDGET:
  90. msg = GETMESSAGE("The widget must be a 'scrollBar' widget");
  91. break;
  92. case DT_TOGGLE_WIDGET:
  93. msg = GETMESSAGE("The widget must be a 'toggleButton' widget or gadget");
  94. break;
  95. case DT_BAD_WINDOW:
  96. msg = GETMESSAGE("The window parameter is invalid: %s");
  97. break;
  98. case DT_ALLOC_FAILURE:
  99. msg = GETMESSAGE("Unable to allocate required memory; exiting");
  100. break;
  101. case DT_NO_PARENT:
  102. msg = GETMESSAGE("Unable to find the parent widget");
  103. break;
  104. case DT_UNDEF_SYMBOL:
  105. msg = GETMESSAGE("Unable to locate the symbol '%s'");
  106. break;
  107. case DT_UNDEF_TYPE:
  108. msg = GETMESSAGE("Unable to locate the type '%s'");
  109. break;
  110. case DT_BAD_DECL:
  111. msg = GETMESSAGE("Unable to parse the declaration '%s'; using 'unsigned long'");
  112. break;
  113. case DT_UNKNOWN_CHILD_TYPE:
  114. msg = GETMESSAGE("Unknown child type: %s");
  115. break;
  116. case DT_UNKNOWN_OPTION:
  117. msg = GETMESSAGE("Unrecognized option flag: %s");
  118. break;
  119. case DT_USAGE_WIDGET_POS:
  120. msg = GETMESSAGE("Usage: %s widget position");
  121. break;
  122. case DT_USAGE_WIDGET_TIME:
  123. msg = GETMESSAGE("Usage: %s widget time");
  124. break;
  125. case DT_USAGE_WIDGET:
  126. msg = GETMESSAGE("Usage: %s widget");
  127. break;
  128. case DTKSH_ERROR:
  129. msg = GETMESSAGE("dtksh error");
  130. break;
  131. case DT_WARNING:
  132. msg = GETMESSAGE("dtksh warning");
  133. break;
  134. case DT_USAGE_DISPLAY_WINDOW:
  135. msg = GETMESSAGE("Usage: %s display window");
  136. break;
  137. case DT_USAGE_DISPLAY_WINDOW_VAR:
  138. msg = GETMESSAGE("Usage: %s display window variable");
  139. break;
  140. case DT_USAGE_DISPLAY_ROOT_VAR:
  141. msg = GETMESSAGE("Usage: %s display rootWindow variable");
  142. break;
  143. case DT_BAD_TIMEOUT:
  144. msg = GETMESSAGE("The timeout parameter is invalid: %s");
  145. break;
  146. case DT_BAD_MESSAGE:
  147. msg = GETMESSAGE("The msg parameter is invalid: %s");
  148. break;
  149. case DT_BAD_PATTERN:
  150. msg = GETMESSAGE("The patterns parameter is invalid: %s");
  151. break;
  152. }
  153. return(msg);
  154. }