summaryrefslogtreecommitdiff
path: root/lisp/international
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2019-03-24 23:55:07 +0200
committerJuri Linkov <juri@linkov.net>2019-03-24 23:55:07 +0200
commit5fdf4fc07df7dd897931efb5dbf5f26dfaff9274 (patch)
tree807fd09f411bd670cb0f7bc7834469366e514036 /lisp/international
parent36535caf9621f984f7f95d4def09bdb0ae2f1d2a (diff)
downloademacs-5fdf4fc07df7dd897931efb5dbf5f26dfaff9274.tar.gz
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',
'a4)))))))
nil)
+;;; i18n (internationalization)
+
+(defun ngettext (msgid msgid_plural n)
+ "Return the plural form of the translation of the string.
+This function is similar to the `gettext' function as it finds the message
+catalogs in the same way. But it takes two extra arguments. The MSGID
+parameter must contain the singular form of the string to be converted.
+It is also used as the key for the search in the catalog.
+The MSGID_PLURAL parameter is the plural form. The parameter N is used
+to determine the plural form. If no message catalog is found MSGID is
+returned if N is equal to 1, otherwise MSGID_PLURAL."
+ (if (= n 1) msgid msgid_plural))
+
+
;;; Character property
(put 'char-code-property-table 'char-table-extra-slots 5)