diff options
| author | Paul Eggert | 2019-03-25 15:20:20 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-03-25 15:20:59 -0700 |
| commit | 7f967b1658114530a19d34d93151804452cc724f (patch) | |
| tree | 5ff44174279e63e89e1575de974c53ea37cd6762 /src | |
| parent | a3c5530975e57f813ec0f52e16584aacaadc1d05 (diff) | |
| download | emacs-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.c | 34 |
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 | |||
| 62 | static void update_buffer_properties (ptrdiff_t, ptrdiff_t); | 56 | static void update_buffer_properties (ptrdiff_t, ptrdiff_t); |
| 63 | static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool); | 57 | static 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 | ||
| 2847 | DEFUN ("ngettext", Fngettext, Sngettext, 3, 3, 0, | 2841 | DEFUN ("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. |
| 2849 | This function is similar to the `gettext' function as it finds the message | 2843 | MSGID is the singular form of the string to be converted; |
| 2850 | catalogs in the same way. But it takes two extra arguments. The MSGID | 2844 | use it as the key for the search in the translation catalog. |
| 2851 | parameter must contain the singular form of the string to be converted. | 2845 | MSGID_PLURAL is the plural form. Use N to select the proper translation. |
| 2852 | It is also used as the key for the search in the catalog. | 2846 | If no message catalog is found, MSGID is returned if N is equal to 1, |
| 2853 | The MSGID_PLURAL parameter is the plural form. The parameter N is used | 2847 | otherwise MSGID_PLURAL. */) |
| 2854 | to determine the plural form. If no message catalog is found MSGID is | ||
| 2855 | returned 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 | ||
| 2874 | DEFUN ("message", Fmessage, Smessage, 1, MANY, 0, | 2858 | DEFUN ("message", Fmessage, Smessage, 1, MANY, 0, |