From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/8757 Path: main.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.gnus.general Subject: Re: Internationalization Date: 12 Nov 1996 23:45:36 +0100 Sender: larsi@proletcult.ifi.uio.no Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1035148881 14207 80.91.224.250 (20 Oct 2002 21:21:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 21:21:21 +0000 (UTC) Return-Path: Original-Received: (qmail 7129 invoked from smtpd); 12 Nov 1996 23:34:42 -0000 Original-Received: from ifi.uio.no (0@129.240.64.2) by deanna.miranova.com with SMTP; 12 Nov 1996 23:34:41 -0000 Original-Received: from proletcult.ifi.uio.no (root@ppp19.larris.ifi.uio.no [129.240.68.119]) by ifi.uio.no with ESMTP (8.6.11/ifi2.4) id for ; Wed, 13 Nov 1996 00:00:39 +0100 Original-Received: (from larsi@localhost) by proletcult.ifi.uio.no (8.8.2/8.8.2) id XAA11858; Tue, 12 Nov 1996 23:45:42 +0100 Original-To: ding@ifi.uio.no In-Reply-To: David Moore's message of 11 Nov 1996 14:19:59 -0800 Original-Lines: 148 X-Mailer: Red Gnus v0.61/Emacs 19.34 X-Face: &w!^oO~dS|}-P0~ge{$c!h\ + #endif + #include "lisp.h" #include "buffer.h" #include "keyboard.h" *************** *** 335,341 **** doc = Fsubstitute_command_keys (doc); UNGCPRO; } ! return doc; } DEFUN ("documentation-property", Fdocumentation_property, Sdocumentation_property, 2, 3, 0, --- 340,346 ---- doc = Fsubstitute_command_keys (doc); UNGCPRO; } ! return Ftranslate_string (doc); } DEFUN ("documentation-property", Fdocumentation_property, Sdocumentation_property, 2, 3, 0, *************** *** 688,693 **** --- 693,779 ---- xfree (buf); RETURN_UNGCPRO (tem); } + + + + DEFUN ("translate-string", Ftranslate_string, Stranslate_string, 1, 1, "sTranslate string: ", + "Translate STRING using gettext.") + (string) + Lisp_Object string; + { + char *trans; + CHECK_STRING (string, 0); + + #ifdef USE_GETTEXT + trans = gettext (XSTRING (string)->data); + /* Check whether the translation returned a new string. If not, + just return the old string. This avoids creating garbage strings. */ + if (strcmp (XSTRING (string)->data, trans)) + return build_string (trans); + else + return string; + #else + return string; + #endif + } + + DEFUN ("set-translation-domain", Fset_translation_domain, Sset_translation_domain, 1, 1, 0, + "Set the current translation domain to STRING.") + (string) + Lisp_Object string; + { + CHECK_STRING (string, 0); + + #ifdef USE_GETTEXT + textdomain (XSTRING (string)->data); + return string; + #else + return Qnil; + #endif + } + + DEFUN ("get-translation-domain", Fget_translation_domain, Sget_translation_domain, 0, 0, 0, + "Return the current translation domain.") + () + { + #ifdef USE_GETTEXT + return build_string (textdomain (NULL)); + #else + return Qnil; + #endif + } + + DEFUN ("set-translation-directory", Fset_translation_directory, Sset_translation_directory, 1, 1, 0, + "Set the current translation directory to STRING.") + (string) + Lisp_Object string; + { + CHECK_STRING (string, 0); + + #ifdef USE_GETTEXT + bindtextdomain (textdomain (NULL), XSTRING (string)->data); + return string; + #else + return Qnil; + #endif + } + + DEFUN ("get-translation-directory", Fget_translation_directory, Sget_translation_directory, 0, 0, 0, + "Return the current translation directory.") + () + { + char *dir; + #ifdef USE_GETTEXT + if (dir = bindtextdomain (textdomain (NULL), NULL)) + return build_string (dir); + else + return Qnil; + #else + return Qnil; + #endif + } + + syms_of_doc () { *************** *** 699,702 **** --- 785,794 ---- defsubr (&Sdocumentation_property); defsubr (&Ssnarf_documentation); defsubr (&Ssubstitute_command_keys); + + defsubr (&Stranslate_string); + defsubr (&Sget_translation_domain); + defsubr (&Sset_translation_domain); + defsubr (&Sget_translation_directory); + defsubr (&Sset_translation_directory); } -- (domestic pets only, the antidote for overdose, milk.) larsi@ifi.uio.no * Lars Ingebrigtsen