aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-03-25 15:20:20 -0700
committerPaul Eggert2019-03-25 15:20:59 -0700
commit7f967b1658114530a19d34d93151804452cc724f (patch)
tree5ff44174279e63e89e1575de974c53ea37cd6762 /src
parenta3c5530975e57f813ec0f52e16584aacaadc1d05 (diff)
downloademacs-7f967b1658114530a19d34d93151804452cc724f.tar.gz
emacs-7f967b1658114530a19d34d93151804452cc724f.zip
Port recent ngettext stub to non-glibc
* src/editfns.c: Don’t try to call glibc ngettext; we’re not ready for that yet. (Fngettext): Do not restrict integer arguments to fixnums. Improve doc string a bit.
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/src/editfns.c b/src/editfns.c
index ab48cdb6fd1..bfffadc733d 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -53,12 +53,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
53#include "window.h" 53#include "window.h"
54#include "blockinput.h" 54#include "blockinput.h"
55 55
56#ifdef _LIBC
57# include <libintl.h>
58#else
59# include "gettext.h"
60#endif
61
62static void update_buffer_properties (ptrdiff_t, ptrdiff_t); 56static void update_buffer_properties (ptrdiff_t, ptrdiff_t);
63static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool); 57static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool);
64 58
@@ -2845,30 +2839,20 @@ usage: (save-restriction &rest BODY) */)
2845/* i18n (internationalization). */ 2839/* i18n (internationalization). */
2846 2840
2847DEFUN ("ngettext", Fngettext, Sngettext, 3, 3, 0, 2841DEFUN ("ngettext", Fngettext, Sngettext, 3, 3, 0,
2848 doc: /* Return the plural form of the translation of the string. 2842 doc: /* Return the translation of MSGID (plural MSGID_PLURAL) depending on N.
2849This function is similar to the `gettext' function as it finds the message 2843MSGID is the singular form of the string to be converted;
2850catalogs in the same way. But it takes two extra arguments. The MSGID 2844use it as the key for the search in the translation catalog.
2851parameter must contain the singular form of the string to be converted. 2845MSGID_PLURAL is the plural form. Use N to select the proper translation.
2852It is also used as the key for the search in the catalog. 2846If no message catalog is found, MSGID is returned if N is equal to 1,
2853The MSGID_PLURAL parameter is the plural form. The parameter N is used 2847otherwise MSGID_PLURAL. */)
2854to determine the plural form. If no message catalog is found MSGID is
2855returned if N is equal to 1, otherwise MSGID_PLURAL. */)
2856 (Lisp_Object msgid, Lisp_Object msgid_plural, Lisp_Object n) 2848 (Lisp_Object msgid, Lisp_Object msgid_plural, Lisp_Object n)
2857{ 2849{
2858 CHECK_STRING (msgid); 2850 CHECK_STRING (msgid);
2859 CHECK_STRING (msgid_plural); 2851 CHECK_STRING (msgid_plural);
2860 CHECK_FIXNUM (n); 2852 CHECK_INTEGER (n);
2861 2853
2862#ifdef _LIBGETTEXT_H 2854 /* Placeholder implementation until we get our act together. */
2863 return build_string (ngettext (SSDATA (msgid), 2855 return EQ (n, make_fixnum (1)) ? msgid : msgid_plural;
2864 SSDATA (msgid_plural),
2865 XFIXNUM (n)));
2866#else
2867 if (XFIXNUM (n) == 1)
2868 return msgid;
2869 else
2870 return msgid_plural;
2871#endif
2872} 2856}
2873 2857
2874DEFUN ("message", Fmessage, Smessage, 1, MANY, 0, 2858DEFUN ("message", Fmessage, Smessage, 1, MANY, 0,