aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/international
diff options
context:
space:
mode:
authorJuri Linkov2019-03-24 23:55:07 +0200
committerJuri Linkov2019-03-24 23:55:07 +0200
commit5fdf4fc07df7dd897931efb5dbf5f26dfaff9274 (patch)
tree807fd09f411bd670cb0f7bc7834469366e514036 /lisp/international
parent36535caf9621f984f7f95d4def09bdb0ae2f1d2a (diff)
downloademacs-5fdf4fc07df7dd897931efb5dbf5f26dfaff9274.tar.gz
emacs-5fdf4fc07df7dd897931efb5dbf5f26dfaff9274.zip
i18n: Add function ngettext for pluralization.
* lisp/international/mule-cmds.el (ngettext): New function. https://lists.gnu.org/archive/html/emacs-devel/2019-03/msg00586.html * lisp/replace.el (flush-lines, how-many, occur-1, occur-engine) (perform-replace): Use ngettext. * lisp/progmodes/grep.el (grep-exit-message): Use ngettext. (grep-mode-font-lock-keywords): Match both singular and plural form of "matches".
Diffstat (limited to 'lisp/international')
-rw-r--r--lisp/international/mule-cmds.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 5f87d899415..035932e395d 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -2798,6 +2798,20 @@ See also `locale-charset-language-names', `locale-language-names',
2798 'a4))))))) 2798 'a4)))))))
2799 nil) 2799 nil)
2800 2800
2801;;; i18n (internationalization)
2802
2803(defun ngettext (msgid msgid_plural n)
2804 "Return the plural form of the translation of the string.
2805This function is similar to the `gettext' function as it finds the message
2806catalogs in the same way. But it takes two extra arguments. The MSGID
2807parameter must contain the singular form of the string to be converted.
2808It is also used as the key for the search in the catalog.
2809The MSGID_PLURAL parameter is the plural form. The parameter N is used
2810to determine the plural form. If no message catalog is found MSGID is
2811returned if N is equal to 1, otherwise MSGID_PLURAL."
2812 (if (= n 1) msgid msgid_plural))
2813
2814
2801;;; Character property 2815;;; Character property
2802 2816
2803(put 'char-code-property-table 'char-table-extra-slots 5) 2817(put 'char-code-property-table 'char-table-extra-slots 5)