From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Internationalize Emacs's messages (swahili) Date: Sat, 26 Dec 2020 10:26:58 +0200 Message-ID: <83o8ihm0q5.fsf@gnu.org> References: <87o8ivumn5.fsf@telefonica.net> <87v9d3nkxk.fsf@gnus.org> <83sg7xrgr5.fsf@gnu.org> <83h7odrdwy.fsf@gnu.org> <86sg7w39fh.fsf@163.com> <83pn30pku5.fsf@gnu.org> <86wnx8otoj.fsf@163.com> <834kkbp9vr.fsf@gnu.org> <87czyxuxw6.fsf@db48x.net> <87y2hlt82w.fsf@db48x.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28849"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rms@gnu.org, bugs@gnu.support, dimech@gmx.com, abrochard@gmx.com, emacs-devel@gnu.org, all_but_last@163.com To: Daniel Brooks Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 26 09:28:29 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kt4w8-0007Oz-Bt for ged-emacs-devel@m.gmane-mx.org; Sat, 26 Dec 2020 09:28:28 +0100 Original-Received: from localhost ([::1]:55146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kt4w7-0002Y0-F1 for ged-emacs-devel@m.gmane-mx.org; Sat, 26 Dec 2020 03:28:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kt4vB-00027u-3I for emacs-devel@gnu.org; Sat, 26 Dec 2020 03:27:29 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:56909) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kt4v7-0007wI-4u; Sat, 26 Dec 2020 03:27:25 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3052 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kt4uw-0001Mq-De; Sat, 26 Dec 2020 03:27:15 -0500 In-Reply-To: <87y2hlt82w.fsf@db48x.net> (message from Daniel Brooks on Fri, 25 Dec 2020 22:06:15 -0800) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:261791 Archived-At: > From: Daniel Brooks > Cc: Zhu Zihao , bugs@gnu.support, dimech@gmx.com, > abrochard@gmx.com, emacs-devel@gnu.org, rms@gnu.org > Date: Fri, 25 Dec 2020 22:06:15 -0800 > > As a concrete example of what I see in my head when I talk about this, > here's some code that generates a moderately complex message, which I > have taken from todo-mode.el: > > (let ((pl (> (length deleted) 1)) > (names (mapconcat (lambda (f) (concat "\"" f "\"")) deleted ", "))) > (message (concat "File" (if pl "s" "") " %s ha" (if pl "ve" "s") > " been deleted and removed from\n" > "the list of category completion files") > names)) Thanks for pointing this out. I've now fixed this and other similar places in todo-mode.el on the master branch by using 'ngettext'. The diffs are below. commit cf1d7034445e7896c34f88256e5d7f2674a4f7ee Author: Eli Zaretskii AuthorDate: Sat Dec 26 10:23:04 2020 +0200 Commit: Eli Zaretskii CommitDate: Sat Dec 26 10:23:04 2020 +0200 Fix messages with plural forms in todo-mode.el * lisp/calendar/todo-mode.el (todo-move-item, todo-item-undone) (todo-category-completions): Use 'ngettext' instead of hard-coding plural forms by hand. diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 3975a9b..637df85 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el @@ -2745,9 +2745,10 @@ todo-move-item (setq ov (make-overlay (save-excursion (todo-item-start)) (save-excursion (todo-item-end)))) (overlay-put ov 'face 'todo-search)) - (let* ((pl (if (and marked (> (cdr marked) 1)) "s" "")) - (cat+file (todo-read-category (concat "Move item" pl - " to category: ") + (let* ((num (if (not marked) 1 (cdr marked))) + (cat+file (todo-read-category + (ngettext "Move item to category: " + "Move items to category: " num) nil file))) (while (and (equal (car cat+file) cat1) (equal (cdr cat+file) file1)) @@ -2974,7 +2975,7 @@ todo-item-undone (interactive) (let* ((cat (todo-current-category)) (marked (assoc cat todo-categories-with-marks)) - (pl (if (and marked (> (cdr marked) 1)) "s" ""))) + (num (if (not marked) 1 (cdr marked)))) (when (or marked (todo-done-item-p)) (let ((buffer-read-only) (opoint (point)) @@ -2982,6 +2983,9 @@ todo-item-undone (first 'first) (item-count 0) (diary-count 0) + (omit-prompt (ngettext "Omit comment from restored item? " + "Omit comments from restored items? " + num)) start end item ov npoint undone) (and marked (goto-char (point-min))) (catch 'done @@ -3013,10 +3017,7 @@ todo-item-undone (if (eq first 'first) (setq first (if (eq todo-undo-item-omit-comment 'ask) - (when (todo-y-or-n-p - (concat "Omit comment" pl - " from restored item" - pl "? ")) + (when (todo-y-or-n-p omit-prompt) 'omit) (when todo-undo-item-omit-comment 'omit))) t) @@ -5782,11 +5783,13 @@ todo-category-completions (delete f todo-category-completions-files)) (push f deleted))) (when deleted - (let ((pl (> (length deleted) 1)) + (let ((ndeleted (length deleted)) (names (mapconcat (lambda (f) (concat "\"" f "\"")) deleted ", "))) - (message (concat "File" (if pl "s" "") " %s ha" (if pl "ve" "s") - " been deleted and removed from\n" - "the list of category completion files") + (message (concat + (ngettext "File %s has been deleted and removed from\n" + "Files %s have been deleted and removed from\n" + ndeleted) + "the list of category completion files") names)) (put 'todo-category-completions-files 'custom-type `(set ,@(todo--files-type-list)))