Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vnkAs-00B3lp-0k for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Feb 2026 21:12:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vnkAr-00DddZ-0i for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Feb 2026 21:12:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vnkAq-00Ddbe-0h for pgsql-hackers@lists.postgresql.org; Wed, 04 Feb 2026 21:12:32 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vnkAn-00000000aB9-3Ir4 for pgsql-hackers@postgresql.org; Wed, 04 Feb 2026 21:12:31 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9622F140006F; Wed, 4 Feb 2026 16:12:28 -0500 (EST) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-06.internal (MEProxy); Wed, 04 Feb 2026 16:12:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1770239548; x=1770325948; bh=crvAPEhM8315LCCsF7grUnysBJg7of2Kq62qNuYPNNA=; b= Ys/pbBsHhpB5+jYwRNnJhez5fixRGP8MaLjnZDuEcGPNVbPd0kQVc66Xo/r5Yls7 JWgPAFMfoNOCZb7fLI7s2HrfcKqfNdeJNOKJ2el+Iu7JZ2bz3iFoSHa++U8JNwu4 Jvt+aYjn/qRxe1eKwKAFGSwwpdt9ZDnvXvh7a087H5INZqzc7KjggKCrqnvvS13e o0K+8g3TnjihtSN7VSWzbr4V99GBZT4/D5hKQ313YO5T6bIPruzNJ4VeaeKjJWQB nC72irvPcNHxrOKKGMVijHIkr02zB/+BVx2tSKwjDTgYtgjCnCeBojFJbX2KLhf9 R2Hs7NOjs1MFbMGDsTq3mg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1770239548; x= 1770325948; bh=crvAPEhM8315LCCsF7grUnysBJg7of2Kq62qNuYPNNA=; b=s kADo4mKwooHgTcT+kr1nQotDghctS8dnToIWsqW/meTjTJz2pZ4DqvJZ1PFTcb+t S9PAMppO/3V1BmJe2zGdb8fn1FRjk7kR1cpziCMNiGSUHCoc90HbHqJ46npyLv+W 6WbNZaozZBIlNZG4QH1MamScG2gl/buVNlBT5BsXBOfE9t44Io1/6LA5IikM8a24 aduEm0NUF++JUbGmiOfN4pC/gRuzh3EgFTkqvEnOdKPQEsvr1BDHGYXoewhbgOmE J2QzHRQey/21Jxe+vhI/Uh9TuQJw3Wl9wHZg97SYEsP1c9l0giYfiv/+XQlt+NrV Szx/E71P7tvHrzMJKFN+A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddukeefgeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvfevkfgjfhfutgfgsehtjeertdertddtnecuhfhrohhmpedfgfhulhgv rhcuvfgrvhgvihhrrgdfuceovghulhgvrhesvghulhgvrhhtohdrtghomheqnecuggftrf grthhtvghrnhephfejheeuueeukeelheegvefgieeglefgteelkeejkeeltdffteduieej gfegudefnecuffhomhgrihhnpehgnhhurdhorhhgpdgvnhhtvghrphhrihhsvggusgdrtg homhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegv uhhlvghrsegvuhhlvghrthhordgtohhmpdhnsggprhgtphhtthhopeduvddpmhhouggvpe hsmhhtphhouhhtpdhrtghpthhtohepghhilhhlvghssegurghrohhlugdrnhgvthdprhgt phhtthhopegrnhgurhgvfiesughunhhslhgrnhgvrdhnvghtpdhrtghpthhtohepphgvth gvrhesvghishgvnhhtrhgruhhtrdhorhhgpdhrtghpthhtohepthhsihhnghhhuhgrlhhu tghkhieluddvsehfohigmhgrihhlrdgtohhmpdhrtghpthhtoheplhhiuhighhdriihjrd gtnhesghhmrghilhdrtghomhdprhgtphhtthhopehnrghthhgrnhgusghoshhsrghrthes ghhmrghilhdrtghomhdprhgtphhtthhopehnihhushhhihhjihesghhmrghilhdrtghomh dprhgtphhtthhopehshhhihihuvghfvghiuddttdegsehgmhgrihhlrdgtohhmpdhrtghp thhtohepjhgrphhinhhliheshhhothhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 7D80D182007A; Wed, 4 Feb 2026 16:12:27 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: ALvzPRv-w3yJ Date: Wed, 04 Feb 2026 18:12:07 -0300 From: "Euler Taveira" To: "Nathan Bossart" , "Peter Eisentraut" Cc: "Gilles Darold" , "Zsolt Parragi" , japin , "Yuefei Shi" , songjinzhou , pgsql-hackers , "Andrew Dunstan" , "Tom Lane" , "liu xiaohui" , "Steven Niu" Message-Id: <5798afb7-b10c-436f-987e-14fb625df7d0@app.fastmail.com> In-Reply-To: References: <197512e0-8116-4776-a600-822d29ee68a6@darold.net> <1f4d0b80-3fea-4f4d-8d33-a652ea23e90b@eisentraut.org> Subject: Re: Pasword expiration warning Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Feb 4, 2026, at 1:42 PM, Nathan Bossart wrote: > On Wed, Feb 04, 2026 at 03:44:05PM +0100, Peter Eisentraut wrote: >> On 03.02.26 16:28, Nathan Bossart wrote: >>> + detail = psprintf(_("The password for role \"%s\" will expire in " >>> + INT64_FORMAT " day(s), " INT64_FORMAT >>> + " hour(s), " INT64_FORMAT " minute(s)."), >>> + role, days, hours, minutes); >> >> You cannot use INT64_FORMAT inside translatable messages. But you can use >> PRId64. > > Ah, I didn't know that. Is this documented anywhere? I skimmed through > our message-writing guidelines [0] but didn't see any mention of this. > In the gettext documentation [1]. Maybe we should also add this information to the referred section. >> That said, I find writing plurals with "(s)" kind of lame. It's not a good >> look. >> >> It's a bit difficult to do this correctly when you have three separate >> values in one string. I would consider for example just showing the number >> of days if the value is larger than one day, number hours if it's larger >> than one hour, else minutes. I don't think you need minute-precision when >> the expiration time is several days out. > > I think we still have the problem with plurals if we go this route, and > IIUC there isn't a good way to do something like errmsg_plural() here since > we are just saving the message for later. I'm skeptical it's worth adding > new translatable-plural handling functionality for this. > That's correct. You should use ngettext(). Using the plural form means better translation. Looking at some messages in the catalog, the developers tend to ignore the fact that the sentence has a plural form too. Sometimes it is hard to write a message if multiple parts of the message have plural form. I completely understand your resistance. >> Alternatively, just print the actual expiration timestamp. > > That crossed my mind, but I worried about timezone/formatting questions, > and I haven't found any examples of putting a timestamp in an error message > like this. Is it acceptable to use pg_strftime() in a translated string? > Although we can add the expiration timestamp, I don't think that's a good UI because (a) there might be timezone difference and (b) you need to do the math of the remaining time. We can add it but when we are talking about time until a certain event, we are expecting a countdown format. If the user decides to change the password because of this message, we don't need inform the exact remaining time. I agree with Peter that just the largest unit is sufficient for the user to take some action. Let's say the remaining time is 1 day and 14 hours. If I just inform the 1 day, I know that I have at least 24 hours to change it and it is sufficient to postpone that action to tomorrow because your work day ends in a few minutes. [1] https://www.gnu.org/software/gettext/manual/html_node/No-string-concatenation.html#The-_003cinttypes_002eh_003e-macros [2] https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html -- Euler Taveira EDB https://www.enterprisedb.com/