diff options
| author | Juri Linkov | 2019-03-24 23:55:07 +0200 |
|---|---|---|
| committer | Juri Linkov | 2019-03-24 23:55:07 +0200 |
| commit | 5fdf4fc07df7dd897931efb5dbf5f26dfaff9274 (patch) | |
| tree | 807fd09f411bd670cb0f7bc7834469366e514036 /lisp/international | |
| parent | 36535caf9621f984f7f95d4def09bdb0ae2f1d2a (diff) | |
| download | emacs-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.el | 14 |
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. | ||
| 2805 | This function is similar to the `gettext' function as it finds the message | ||
| 2806 | catalogs in the same way. But it takes two extra arguments. The MSGID | ||
| 2807 | parameter must contain the singular form of the string to be converted. | ||
| 2808 | It is also used as the key for the search in the catalog. | ||
| 2809 | The MSGID_PLURAL parameter is the plural form. The parameter N is used | ||
| 2810 | to determine the plural form. If no message catalog is found MSGID is | ||
| 2811 | returned 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) |