Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyBUO-0007lZ-8z for pgadmin-hackers@arkaria.postgresql.org; Tue, 29 Jun 2021 11:01:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lyBUM-0005th-74 for pgadmin-hackers@arkaria.postgresql.org; Tue, 29 Jun 2021 11:01:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyBUL-0005tZ-Sz for pgadmin-hackers@lists.postgresql.org; Tue, 29 Jun 2021 11:01:10 +0000 Received: from mail-ua1-x929.google.com ([2607:f8b0:4864:20::929]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lyBUH-00077Y-97 for pgadmin-hackers@postgresql.org; Tue, 29 Jun 2021 11:01:09 +0000 Received: by mail-ua1-x929.google.com with SMTP id e7so8199750uaj.11 for ; Tue, 29 Jun 2021 04:01:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=c/evTg1PCU8fV9+m1ijPrIIqKwIlPAN+FNcS2k5nBsA=; b=0KRcbD4aeT+ob46dlHFPobBOFkp8drZ4apb+uo/Z5fCLhDV2ts8PP9hJpBrrgqW0+3 auqNFOHm/vb2Lr8vJBMuLWinJfSg0OS/KvC1a9mFtRssXMjOTNZ1uZklOGOuWLcNnO1o xsG188Yxxp4HmJjloJmGK8no/T8h169j4mYUgtF88Nichk4wCcFuUiZNvzwUUlqTC42B veRAM/X3NAuNuEM1RDdJM2gYYvy4IWgS2RaO7wwk8IeLN2t4U7TGLAYC50s5/lg/rWjc EFvjAoVVUaLv+jng60//ehuLsp6RN7nAWEb1t5Jp1It0dzIvNSXqagazN3K8C4MVITv5 ubKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=c/evTg1PCU8fV9+m1ijPrIIqKwIlPAN+FNcS2k5nBsA=; b=b1qJs4sNCj7lWg3FlJB9AbUNwZpJpxJQ1Jh+LE8N1drzeiN4Z5NK1WOAs9pBrd1vA9 gIlSkT95SGyH0YzRCm8SZGG+y0u1ZbZKFUXBP7radjKLafhOLJ/sLsDeJmt4KHAA7M8c 97MdLxZQ24759bbJznjPtkeL4YYMeNCdXeH7rj+F+1FZWp7WVzZCwu7l3lNnnvW1rVlZ fa0S3EHmFPTaKfpNbtd7LB2763b6ogWyoJUt9+T0AZCkJpnmknPvbwuLjYr4OlfOBHSX Kv9RHvoeDISkaEVIOicfpqEStuuU/+B+ZbF6OoJDzoRcwg27GUyK62WACt+0NT2SxPN4 1eow== X-Gm-Message-State: AOAM532dl2O4PqzjVMg9gt5WNHBd1bTTG7CEl/sB2QbQBIFw3/clmqqe xeuiLVVXw8vpbvkqyx96CZWQQCuo3cODpNF0uuYeSIWw7GEuwD17IK8TULYi4xb+tCw0QcKDQTK Zy5m17jShlmVVulDhdUlZ2p8pSVoMMzgoX3+qPYq7OcKt5nLka40GHG/edDwXsoCp69EcFYGZ+r T1rRDsiYQm01G19rz6M310EvsD7ifKCxFqhwfVN+DxKh3nD3ZiIrzoFnhzqw== X-Google-Smtp-Source: ABdhPJy45kj0YQOIsABCYpt0wKqmztzil9Xq3C8bNnbiuc6bnh6gvtx/OhNndJMsuLCA7BifH0CbO2hEg/SvpvOMHYM= X-Received: by 2002:ab0:6392:: with SMTP id y18mr26157323uao.139.1624964463326; Tue, 29 Jun 2021 04:01:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Aditya Toshniwal Date: Tue, 29 Jun 2021 16:30:27 +0530 Message-ID: Subject: Re: [patch][pgAdmin] Fix for pgadmin4-linux-qa #1651 failure To: Rahul Shirsat Cc: pgadmin-hackers , Dave Page Content-Type: multipart/alternative; boundary="0000000000009c0d0805c5e585a8" X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000009c0d0805c5e585a8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Rahul, I did "make msg-extract" and "make msg-update" and looking at the PO files I think it is not updated correctly. For instance, the below message has msgstr without %s. I corrected it and the error was gone. #: pgadmin/browser/server_groups/servers/roles/static/js/role.js:766 #, fuzzy, python-format msgid "%s Objects" msgstr "Obiekty" The one below had 2 %s in msgstr and I corrected it to fix the error. #: pgadmin/browser/server_groups/servers/roles/static/js/role.js:767 #, fuzzy, python-format msgid "Are you sure you wish to %s all the objects owned by the selected role?" msgstr "Czy na pewno skasowa=C4=87 %s \"%s\" i wszystkie obiekty zale=C5=BC= ne od niego?" You have to update the .po files to match the total %s and send the patch. On Tue, Jun 29, 2021 at 1:56 PM Dave Page wrote: > Hi > > On Tue, Jun 29, 2021 at 4:38 AM Rahul Shirsat < > rahul.shirsat@enterprisedb.com> wrote: > >> I feel gettext sometimes won't escape the characters as it should be. >> >> I now tried to escape those using some utils. >> > > That won't work either. The string being passed to gettext() *must* be in > the gettext call. > > When gettext extracts strings to create/update the catalogs, it will > search the code for all gettext calls, and then extract a string constant > from the first argument. You cannot have variables, function calls or > expressions in there. It *must* be a string constant. > > Keep in mind that msgextract is scanning the source code; it's not > executing it. There are many examples in the code, e.g. (from node.js): > > title =3D gettext('Drop %s?', obj.label); > > I don't see anything obviously wrong with the existing code. Are you sure > there are no weird unprintable characters in there? > > >> >> Please find the updated patch. >> >> On Mon, Jun 28, 2021 at 9:33 PM Dave Page wrote: >> >>> Hi >>> >>> On Mon, Jun 28, 2021 at 4:57 PM Rahul Shirsat < >>> rahul.shirsat@enterprisedb.com> wrote: >>> >>>> Hi Hackers, >>>> >>>> Please find the attached patch for fixation of jenkins failure. >>>> >>> >>> That won't work - you can't include variables (or string building >>> operations) in the first argument to gettext calls, as there won't be a= ny >>> way to extract a complete message into the catalogs. The way it's being >>> done at the moment is correct (I don't know why it's failing, but it's = the >>> correct way to structure the gettext calls). >>> >>> -- >>> Dave Page >>> Blog: https://pgsnake.blogspot.com >>> Twitter: @pgsnake >>> >>> EDB: https://www.enterprisedb.com >>> >>> >> >> -- >> *Rahul Shirsat* >> Senior Software Engineer | EnterpriseDB Corporation. >> > > > -- > Dave Page > Blog: https://pgsnake.blogspot.com > Twitter: @pgsnake > > EDB: https://www.enterprisedb.com > > --=20 Thanks, Aditya Toshniwal pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* "Don't Complain about Heat, Plant a TREE" --0000000000009c0d0805c5e585a8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Rahul,

I=C2=A0did "make msg-extract" and "make msg-update" and looking at the PO files I think it is not= updated correctly.
For instance, the below message has msgstr without %= s. I corrected it and the error was gone.

#: pgadmin/browser/server_= groups/servers/roles/static/js/role.js:766
#, fuzzy, python-format
ms= gid "%s Objects"
msgstr "Obiekty"

The one bel= ow had 2 %s in msgstr and I corrected it to fix the error.

#: pgadmi= n/browser/server_groups/servers/roles/static/js/role.js:767
#, fuzzy, py= thon-format
msgid "Are you sure you wish to %s all the objects owne= d by the selected role?"
msgstr "Czy na pewno skasowa=C4=87 %s= \"%s\" i wszystkie obiekty zale=C5=BCne od niego?"

<= br>You have to update the .po files to match the total %s and send the patc= h.


Keep in mind that msgextract is scanning the source code; = it's not executing it. There are many examples in the code, e.g. (from = node.js):

title =3D gettext('Drop %s?', ob= j.label);

I don't see anything obviously w= rong with the existing code. Are you sure there are no weird unprintable ch= aracters in there?
=C2=A0

Please=C2=A0find the u= pdated patch.

Hi

On Mon, Jun 28, 2021 at 4:57 PM Rahul Shirsat <rahul.shirsat@enterpr= isedb.com> wrote:
Hi Hackers,

Please find the = attached patch for fixation of jenkins failure.

That won't work - you can't include variables (or = string building operations) in the first argument=C2=A0to gettext calls, as= there won't be any way to extract a complete message into the catalogs= . The way it's being done at the moment is correct (I don't know wh= y it's failing, but it's the correct way to structure the gettext c= alls).
=C2=A0
--


--
Rahul Shirsat
Senior Software Engin= eer=C2=A0|=C2=A0EnterpriseDB=C2=A0Corporation.


--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitter: @pgsnake<= br>
EDB: http= s://www.enterprisedb.com



--
Thanks,
Aditya Toshniwal
pgAdmin hacker=C2=A0| Sr. Softwa= re Engineer | edbpostgres.com<= /font>
"Don't Complain about Heat, Plant a TREE&qu= ot;
--0000000000009c0d0805c5e585a8--