comparison src/intl.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 9ee227acff29
children e04119814345
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
166 166
167 167
168 Lisp_Object Qdomain; 168 Lisp_Object Qdomain;
169 Lisp_Object Qdefer_gettext; 169 Lisp_Object Qdefer_gettext;
170 170
171 DEFUN ("ignore-defer-gettext", Fignore_defer_gettext, Signore_defer_gettext, 171 DEFUN ("ignore-defer-gettext", Fignore_defer_gettext, 1, 1, 0, /*
172 1, 1, 0 /*
173 If OBJ is of the form (defer-gettext \"string\"), return the string. 172 If OBJ is of the form (defer-gettext \"string\"), return the string.
174 The purpose of the defer-gettext symbol is to identify strings which 173 The purpose of the defer-gettext symbol is to identify strings which
175 are translated when they are referenced instead of when they are defined. 174 are translated when they are referenced instead of when they are defined.
176 */ ) 175 */
177 (obj) 176 (obj))
178 Lisp_Object obj;
179 { 177 {
180 if (CONSP (obj) && SYMBOLP (Fcar (obj)) && EQ (Fcar (obj), Qdefer_gettext)) 178 if (CONSP (obj) && SYMBOLP (Fcar (obj)) && EQ (Fcar (obj), Qdefer_gettext))
181 return Fcar (Fcdr (obj)); 179 return Fcar (Fcdr (obj));
182 else 180 else
183 return obj; 181 return obj;
184 } 182 }
185 183
186 DEFUN ("gettext", Fgettext, Sgettext, 1, 1, 0 /* 184 DEFUN ("gettext", Fgettext, 1, 1, 0, /*
187 Look up STRING in the default message domain and return its translation. 185 Look up STRING in the default message domain and return its translation.
188 This function does nothing if I18N3 was not enabled when Emacs was compiled. 186 This function does nothing if I18N3 was not enabled when Emacs was compiled.
189 */ ) 187 */
190 (string) 188 (string))
191 Lisp_Object string;
192 { 189 {
193 #ifdef I18N3 190 #ifdef I18N3
194 /* #### What should happen here is: 191 /* #### What should happen here is:
195 192
196 1) If the string has no `string-translatable' property or its value 193 1) If the string has no `string-translatable' property or its value
226 on the string. Add the functions `set-string-translatable' and 223 on the string. Add the functions `set-string-translatable' and
227 `set-stream-translating'. */ 224 `set-stream-translating'. */
228 225
229 #endif 226 #endif
230 227
231 DEFUN ("dgettext", Fdgettext, Sdgettext, 2, 2, 0 /* 228 DEFUN ("dgettext", Fdgettext, 2, 2, 0, /*
232 Look up STRING in the specified message domain and return its translation. 229 Look up STRING in the specified message domain and return its translation.
233 This function does nothing if I18N3 was not enabled when Emacs was compiled. 230 This function does nothing if I18N3 was not enabled when Emacs was compiled.
234 */ ) 231 */
235 (domain, string) 232 (domain, string))
236 Lisp_Object domain, string;
237 { 233 {
238 CHECK_STRING (domain); 234 CHECK_STRING (domain);
239 CHECK_STRING (string); 235 CHECK_STRING (string);
240 #ifdef I18N3 236 #ifdef I18N3
241 return build_string (dgettext ((char *) XSTRING_DATA (domain), 237 return build_string (dgettext ((char *) XSTRING_DATA (domain),
243 #else 239 #else
244 return string; 240 return string;
245 #endif 241 #endif
246 } 242 }
247 243
248 DEFUN ("bind-text-domain", Fbind_text_domain, Sbind_text_domain, 2, 2, 0 /* 244 DEFUN ("bind-text-domain", Fbind_text_domain, 2, 2, 0, /*
249 Associate a pathname with a message domain. 245 Associate a pathname with a message domain.
250 Here's how the path to message files is constructed under SunOS 5.0: 246 Here's how the path to message files is constructed under SunOS 5.0:
251 {pathname}/{LANG}/LC_MESSAGES/{domain}.mo 247 {pathname}/{LANG}/LC_MESSAGES/{domain}.mo
252 This function does nothing if I18N3 was not enabled when Emacs was compiled. 248 This function does nothing if I18N3 was not enabled when Emacs was compiled.
253 */ ) 249 */
254 (domain, pathname) 250 (domain, pathname))
255 Lisp_Object domain, pathname;
256 { 251 {
257 CHECK_STRING (domain); 252 CHECK_STRING (domain);
258 CHECK_STRING (pathname); 253 CHECK_STRING (pathname);
259 #ifdef I18N3 254 #ifdef I18N3
260 return build_string (bindtextdomain ((char *) XSTRING_DATA (domain), 255 return build_string (bindtextdomain ((char *) XSTRING_DATA (domain),
264 #endif 259 #endif
265 } 260 }
266 261
267 extern int load_in_progress; 262 extern int load_in_progress;
268 263
269 DEFUN ("set-domain", Fset_domain, Sset_domain, 1, 1, 0 /* 264 DEFUN ("set-domain", Fset_domain, 1, 1, 0, /*
270 Specify the domain used for translating messages in this source file. 265 Specify the domain used for translating messages in this source file.
271 The domain declaration may only appear at top-level, and should preceed 266 The domain declaration may only appear at top-level, and should preceed
272 all function and variable definitions. 267 all function and variable definitions.
273 268
274 The presence of this declaration in a compiled file effectively sets the 269 The presence of this declaration in a compiled file effectively sets the
275 domain of all functions and variables which are defined in that file. 270 domain of all functions and variables which are defined in that file.
276 Bug: it has no effect on source (.el) files, only compiled (.elc) files. 271 Bug: it has no effect on source (.el) files, only compiled (.elc) files.
277 */ ) 272 */
278 (domain_name) 273 (domain_name))
279 Lisp_Object domain_name;
280 { 274 {
281 CHECK_STRING (domain_name); 275 CHECK_STRING (domain_name);
282 if (load_in_progress) 276 if (load_in_progress)
283 { 277 {
284 #ifdef I18N3 278 #ifdef I18N3
317 /* defer-gettext is defined as a symbol because when it is used in menu 311 /* defer-gettext is defined as a symbol because when it is used in menu
318 specification strings, it is not evaluated as a function by 312 specification strings, it is not evaluated as a function by
319 menu_item_descriptor_to_widget_value(). */ 313 menu_item_descriptor_to_widget_value(). */
320 defsymbol (&Qdefer_gettext, "defer-gettext"); 314 defsymbol (&Qdefer_gettext, "defer-gettext");
321 315
322 defsubr (&Signore_defer_gettext); 316 DEFSUBR (Fignore_defer_gettext);
323 defsubr (&Sgettext); 317 DEFSUBR (Fgettext);
324 defsubr (&Sdgettext); 318 DEFSUBR (Fdgettext);
325 defsubr (&Sbind_text_domain); 319 DEFSUBR (Fbind_text_domain);
326 defsubr (&Sset_domain); 320 DEFSUBR (Fset_domain);
327 } 321 }
328 322
329 void 323 void
330 vars_of_intl (void) 324 vars_of_intl (void)
331 { 325 {