From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Emacs i18n Date: Tue, 12 Mar 2019 23:45:07 +0200 Organization: LINKOV.NET Message-ID: <87d0mvu6wo.fsf@mail.linkov.net> References: <87o97aq6gz.fsf@jidanni.org> <87tvgoud56.fsf@mail.linkov.net> <83o96wk2mi.fsf@gnu.org> <87k1hjfvjd.fsf@mail.linkov.net> <871s3p0zdz.fsf@mail.linkov.net> <83h8ckezyt.fsf@gnu.org> <83o96qegv1.fsf@gnu.org> <32b1ab1b-bef4-629a-8830-b1dcc6915087@cs.ucla.edu> <83a7iae9va.fsf@gnu.org> <05ed2dec-2a84-f7dc-1af5-c9d923992785@cs.ucla.edu> <87bm2p56gu.fsf@mail.linkov.net> <838sxrdgco.fsf@gnu.org> <831s3jdbrk.fsf@gnu.org> <507BBC71-4E90-476A-9F1D-E0D7F0EB56C9@gmail.com> <87k1h5w08o.fsf@mail.linkov.net> <1b23d0ff-3998-b795-9895-7320e7028f70@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="128200"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: Jean-Christophe Helary , emacs-devel To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 12 23:02:33 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h3pTk-000XAr-Lj for ged-emacs-devel@m.gmane.org; Tue, 12 Mar 2019 23:02:33 +0100 Original-Received: from localhost ([127.0.0.1]:34169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3pTj-00046V-Jt for ged-emacs-devel@m.gmane.org; Tue, 12 Mar 2019 18:02:31 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:40063) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3pQQ-0001iH-Sl for emacs-devel@gnu.org; Tue, 12 Mar 2019 17:59:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3pEE-00055a-Oo for emacs-devel@gnu.org; Tue, 12 Mar 2019 17:46:31 -0400 Original-Received: from golden.birch.relay.mailchannels.net ([23.83.209.73]:1793) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h3pEE-00054T-AC for emacs-devel@gnu.org; Tue, 12 Mar 2019 17:46:30 -0400 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 1FF145E1BAC; Tue, 12 Mar 2019 21:46:28 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a5.g.dreamhost.com (100-96-6-19.trex.outbound.svc.cluster.local [100.96.6.19]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C46785E1B1F; Tue, 12 Mar 2019 21:46:27 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a5.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.3); Tue, 12 Mar 2019 21:46:28 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-White-Sponge: 489393a66d976e65_1552427187939_2471364167 X-MC-Loop-Signature: 1552427187939:4198619947 X-MC-Ingress-Time: 1552427187939 Original-Received: from pdx1-sub0-mail-a5.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a5.g.dreamhost.com (Postfix) with ESMTP id 5FDE87F830; Tue, 12 Mar 2019 14:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=linkov.net; bh=49oFS/ 4on7qJsunmtx3lPyptX2c=; b=VdfwN2cRU7XPUv5ocWwjdjVYsOzftwzaNVXx/o bYDYulpbChCn8WzpXH/ExsO1JV2UTh05GObgLkgcED/PW/Xa778x/eAzkSdwKiqU Iy1ZvRipBEY0WpNqDmxvxFLdWmnzbjkPjnSVMpLaqPE7UgMM7e0IWLg3HMkvuaSm Pgs8w= Original-Received: from mail.jurta.org (m91-129-104-138.cust.tele2.ee [91.129.104.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a5.g.dreamhost.com (Postfix) with ESMTPSA id 4F8027F77D; Tue, 12 Mar 2019 14:46:19 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a5 In-Reply-To: <1b23d0ff-3998-b795-9895-7320e7028f70@cs.ucla.edu> (Paul Eggert's message of "Mon, 11 Mar 2019 15:51:20 -0700") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrgeekgdduheekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgfgsehtkeertddtreejnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddtgedrudefkeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutdegrddufeekpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepvghgghgvrhhtsegtshdruhgtlhgrrdgvughunecuvehluhhsthgvrhfuihiivgeptd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 23.83.209.73 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234119 Archived-At: >> Please note that you have to handle not only format-strings of >> =E2=80=98message=E2=80=99, but also =E2=80=98error=E2=80=99 and even m= ore low-level =E2=80=98format=E2=80=99, i.e. all >> these (error STRING &rest ARGS) (message FORMAT-STRING &rest ARGS) >> (format-message STRING &rest OBJECTS) (format STRING &rest OBJECTS) >> > I expect that 'format' won't translate its first argument, whereas > 'error', 'message', and 'format-message' will. This will be for the sam= e > reason that 'format' does not translate quotes. Then it should be sufficient to add a gettext call to 'format-message' on= ly, because all other related functions 'message', 'error', 'tramp-message', 'tramp-error', etc. all they use 'format-message' directly or indirectly. If someone would create a new branch with all standard gettext prerequisi= tes like Makefiles, headers, textdomain bindings, locale settings, i.e. everything that is required to translate other GNU applications, then I could help with testing and finding more problematic places. Only then we could see how well gettext (designed for static translation) performs in more dynamic Emacs environment. >> there are many places that construct the string arguments of =E2=80=98= message=E2=80=99 >> using =E2=80=98format=E2=80=99 like in =E2=80=98perform-replace=E2=80=99= : >> > Yes, quite right. These places will need to be redone so that the > translation will work properly. Here's a first cut at how to redo the > perform-replace code that you mentioned (this could get fancier if need= ed): > > =C2=A0 (nmessage replace-count > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "Rep= laced %d occurrence%s" > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "Rep= laced %d occurrences%s" > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 repl= ace-count IIUC, using standard gettext functions this would rather correspond to (message (ngettext "Replaced %1$d occurrence%s" "Replaced %1$d occurrences%s" replace-count) replace-count (if (> (+ skip-read-only-count skip-filtered-count skip-invisible-count) 0) (format-message " (skipped %s)" (mapconcat #'identity (delq nil (list (if (> skip-read-only-count 0) (format-message "%s read-only" skip-read-only-count)) (if (> skip-invisible-count 0) (format-message "%s invisible" skip-invisible-count)) (if (> skip-filtered-count 0) (format-message "%s filtered out" skip-filtered-count)))) (gettext ", "))) ""))