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 1lyG0l-0006q2-CW for pgadmin-hackers@arkaria.postgresql.org; Tue, 29 Jun 2021 15:50:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lyG0j-0006Si-Fk for pgadmin-hackers@arkaria.postgresql.org; Tue, 29 Jun 2021 15:50:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyG0i-0006SS-Tc for pgadmin-hackers@lists.postgresql.org; Tue, 29 Jun 2021 15:50:53 +0000 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lyG0f-00073R-LF for pgadmin-hackers@postgresql.org; Tue, 29 Jun 2021 15:50:51 +0000 Received: by mail-io1-xd35.google.com with SMTP id k16so26975055ios.10 for ; Tue, 29 Jun 2021 08:50:49 -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=yvKpIO0mvtg+76je5Z8fNW8sXtfi63QfR3cjyIQLQVI=; b=GBs2IWD6WMS0Wx2mORT1Xx2mc9l7A1IpDZw/YUJN5gHzc0xtJvxbCWSle4Z4mWA/+1 wpB2SHT5ncjK+mc449MqeshjjGR/3FTa8KoyZCYcV5Lpvmlj2QNYOSrr38dZmG4PBszq fz59E2CkA5AdlBAm++w1kZan2n14BqwEF9O63HNQNkbne0M7eZqMK383owKMeWr533tT Omik7zUgOT487dugS4Ek9N4K63+lOKuQgeYvaxmlJZEoFnz2OV5nNMOV90v53Jq79lzZ s+of7ks6sNTO2ZII7TqkgtvBCGbRhTXvrXUxhHYwu47A67nXUracP9Ft7RcLWchExY/K ADBA== 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=yvKpIO0mvtg+76je5Z8fNW8sXtfi63QfR3cjyIQLQVI=; b=lp5nq9Ls7I0eBzC7xFEqdAavLf+5x/UzXxtoeHQzOe7CvZuKQg2tF169OTNSfWB+ep gW6P1hykl2Mi06Yn5VLyCmTLWBSjKLQM6zABZux+uHLaN83ETux+hMIcKqdj2KBCqYFg rqPTR/jbf+0smXN3fmZf8DF3BpB2KhdObmHsawNu/zbZlarqVuiqgCh+l4ZdrwlIXypl cj/9gCKrbHpWTqcMV1PpnjtDqIw0BPkFUjWtD8UexgFIh47eo6jn0MTIgDW0lpVjobuy aPHJoHeyOkvvMfC6+KVRELXETIRaidbmQfqT2KG6VW+CcTZgd0AABBsijJVZUtWzHnsG kpIg== X-Gm-Message-State: AOAM530TTIDwCiR9zgppoA9jibTurH8VKLzqQTEBcskPPVBg5LpmU2RG uVa5cSNF/3cK1la2NyyOXPxELjTV1bjsW9juZ6bT+C0aYpxgT5JsZfVdVjJ292hH8+Mg/jpy/Up APwIu9IMrNFmSEsEp+aropN6C2Cm1jHviuU5uvh49A2e4kTjaFOZHd9h38ny3SZ0Ev6uqnHti0K 6EWd3YLqGoRwXea+hRSjG7DqdJo1m6SIDXAFMhE6NkVaissfF0W0xRWjx++A== X-Google-Smtp-Source: ABdhPJxlNJXmPTIKnQ6L/HZFjOqNLUrUcqNa+F39nfPrPvLEWxHETfRAqNgPGyArro8pJJeeaizdLV6Phd5dN1tXmtE= X-Received: by 2002:a02:8790:: with SMTP id t16mr4892053jai.81.1624981846963; Tue, 29 Jun 2021 08:50:46 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Rahul Shirsat Date: Tue, 29 Jun 2021 21:20:10 +0530 Message-ID: Subject: Re: [patch][pgAdmin] Fix for pgadmin4-linux-qa #1651 failure To: Dave Page Cc: Aditya Toshniwal , pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000c1571e05c5e9914f" 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 --000000000000c1571e05c5e9914f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Dave / Aditya, For a time being, Let's make a call to gettext conditional instead of passing dynamic parameters for this scenario at least. With this, we won't be touching the *.po files and translations will do its task smoothly. I have already checked for the string with weird unprintable characters, and there were none. e.g. Instead of - *title =3D gettext('%s objects?', obj.label);* *if (drop) {* * title =3D gettext('Drop objects?');* *}* *else {* *title =3D gettext('Reassign objects?');* *}* I have tried the above code and it looks good to me. Please suggest. On Tue, Jun 29, 2021 at 7:31 PM Dave Page wrote: > > > On Tue, Jun 29, 2021 at 2:55 PM Aditya Toshniwal < > aditya.toshniwal@enterprisedb.com> wrote: > >> Hi, >> >> On Tue, Jun 29, 2021 at 7:14 PM Dave Page wrote: >> >>> >>> >>> On Tue, Jun 29, 2021 at 2:41 PM Aditya Toshniwal < >>> aditya.toshniwal@enterprisedb.com> wrote: >>> >>>> Dave, >>>> >>>> Somehow, the new text strings are added to PO with incorrect >>>> translations. That is causing the issue. >>>> Either they should be empty or fixed. >>>> >>> >>> Then the source problem should be fixed. There's no point at all in >>> putting fixes directly in the PO files as they'll be overwritten prior = to >>> release anyway. >>> >> The translations submitted by translators are updated in the PO file >> right ? And then they're compiled to MO ? >> > > Right. > > >> It's the same like Rahul will be submitting the translations. Please >> correct me if I'm wrong. >> > > That depends if he's changed the original message or the translated > message. It's impossible to see without reading megabytes of text. > > And in any case, he's updated translations that haven't been touched in > ages - why would they suddenly have broken? (hint: if the upstream messag= e > has changed, it'll be marked as fuzzy or untranslated - in other words, > gettext knows how to handle that). > > >> >>> >>>> >>>> On Tue, Jun 29, 2021 at 7:01 PM Dave Page wrote: >>>> >>>>> Hi >>>>> >>>>> Please send the patch without updates to the po files. Those get >>>>> updated as part of the release process. >>>>> >>>>> Thanks. >>>>> >>>>> On Tue, Jun 29, 2021 at 2:00 PM Rahul Shirsat < >>>>> rahul.shirsat@enterprisedb.com> wrote: >>>>> >>>>>> Hi Hackers, >>>>>> >>>>>> Thanks Aditya for pointing out the issue. Please find the attached >>>>>> patch which contains all the .po files corrected with %s. >>>>>> >>>>>> Regards, >>>>>> Rahul Shirsat. >>>>>> >>>>>> On Tue, Jun 29, 2021 at 4:31 PM Aditya Toshniwal < >>>>>> aditya.toshniwal@enterprisedb.com> wrote: >>>>>> >>>>>>> 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:76= 6 >>>>>>> #, fuzzy, python-format >>>>>>> msgid "%s Objects" >>>>>>> msgstr "Obiekty" >>>>>>> >>>>>>> The one below had 2 %s in msgstr and I corrected it to fix the erro= r. >>>>>>> >>>>>>> #: pgadmin/browser/server_groups/servers/roles/static/js/role.js:76= 7 >>>>>>> #, 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 za= le=C5=BCne >>>>>>> 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 str= ing >>>>>>>> constant from the first argument. You cannot have variables, funct= ion 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 buildin= g >>>>>>>>>> operations) in the first argument to 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 why it's failing, bu= t 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 >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Thanks, >>>>>>> Aditya Toshniwal >>>>>>> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* >>>>>>> >>>>>>> "Don't Complain about Heat, Plant a TREE" >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> *Rahul Shirsat* >>>>>> Senior Software Engineer | EnterpriseDB Corporation. >>>>>> >>>>> >>>>> >>>>> -- >>>>> Dave Page >>>>> Blog: https://pgsnake.blogspot.com >>>>> Twitter: @pgsnake >>>>> >>>>> EDB: https://www.enterprisedb.com >>>>> >>>>> >>>> >>>> -- >>>> Thanks, >>>> Aditya Toshniwal >>>> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* >>>> >>>> "Don't Complain about Heat, Plant a TREE" >>>> >>> >>> >>> -- >>> Dave Page >>> Blog: https://pgsnake.blogspot.com >>> Twitter: @pgsnake >>> >>> EDB: https://www.enterprisedb.com >>> >>> >> >> -- >> Thanks, >> Aditya Toshniwal >> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com* >> >> "Don't Complain about Heat, Plant a TREE" >> > > > -- > Dave Page > Blog: https://pgsnake.blogspot.com > Twitter: @pgsnake > > EDB: https://www.enterprisedb.com > > --=20 *Rahul Shirsat* Senior Software Engineer | EnterpriseDB Corporation. --000000000000c1571e05c5e9914f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Dave / Aditya,

For a time being, Let= 's make a call to gettext conditional instead of passing dynamic parame= ters for this scenario at least. With this, we won't be touching the *.= po files and translations will do its task smoothly.
I have alrea= dy checked for the string with weird unprintable characters, and there were= none.

e.g.=C2=A0
Instead of -=C2=A0=C2= =A0title =3D gettext('%s objects?', obj.label);

if (drop) {
=C2=A0 =C2=A0title =3D = gettext('Drop objects?');
}
else {
=C2=A0 =C2=A0title =3D gettext('Re= assign objects?');
}

I have tried the above code and it looks good to me.

Please suggest.

On Tue, Jun 29, 2021 at 7:31 PM Dave Page <dpage@pgadmin.org> wrote:


On Tue, Jun 29, 2021 at 2:55 PM Aditya Toshniwal <aditya.tos= hniwal@enterprisedb.com> wrote:
Hi,

<= div dir=3D"ltr" class=3D"gmail_attr">On Tue, Jun 29, 2021 at 7:14 PM Dave P= age <dpage@pgadmi= n.org> wrote:


On Tue, Jun 29, 2021 at 2:41 PM = Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrote:
=
Dave,

Somehow, the new text strings are added to PO with incorrect translations.= That is causing the issue.
Either they should be empty or fixed.

=
Then the source problem should be fixed. There's no point at= all in putting fixes directly in the PO files as they'll be overwritte= n prior to release anyway.
The translation= s submitted by translators are updated in the PO file right ? And then they= 're compiled to MO ?

Right.
=C2=A0
It's the same l= ike Rahul will be submitting the translations. Please correct me if I'm= wrong.

That depen= ds if he's changed the original message or the translated message. It&#= 39;s impossible to see without reading megabytes of text.

And in any case, he's updated translations that haven't bee= n touched in ages - why would they suddenly have broken? (hint: if the upst= ream message has changed, it'll be marked as fuzzy or untranslated - in= other words, gettext knows how to handle that).
=C2=A0
=C2=A0

On Tue, Jun 29, 2021 at 7:01 PM Dave Page <dpage@pgadmin.org> w= rote:
Hi

Please send the patch without updates to the= po files. Those get updated as part of the release process.

=
Thanks.

On Tue, Jun 29, 2021 at 2:00 PM Rahul Shirsat <<= a href=3D"mailto:rahul.shirsat@enterprisedb.com" target=3D"_blank">rahul.sh= irsat@enterprisedb.com> wrote:
Hi Hackers,

<= /div>
Thanks Aditya for pointing out the issue. Please=C2=A0find the at= tached patch which contains all the .po files corrected with %s.
=
Regards,
Rahul Shirsat.

On Tue, Jun 29, 2021= at 4:31 PM Aditya Toshniwal <aditya.toshniwal@enterprisedb.com> wrot= e:
Hi Rahul,

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

#: pgadmin/browser/server_groups/ser= vers/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-forma= t
msgid "Are you sure you wish to %s all the objects owned by the s= elected role?"
msgstr "Czy na pewno skasowa=C4=87 %s \"%s= \" i wszystkie obiekty zale=C5=BCne od niego?"


You hav= e to update the .po files to match the total %s and send the patch.
<= /div>
O= n Tue, Jun 29, 2021 at 1:56 PM Dave Page <dpage@pgadmin.org> wrote:
Hi

On Tue, Jun 29, 2021 at 4:38 AM Rahul Shirsat <rahul.shirsat@enterprise= db.com> wrote:
I feel gettext sometimes won't escape the charac= ters 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 t= he catalogs, it will search the code for all gettext calls, and then extrac= t a string constant from the first argument. You cannot have variables, fun= ction calls or expressions in there. It *must* be a string constant.=C2=A0<= /div>

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

title =3D gettext('Drop %s?&= #39;, obj.label);

I don't see anything obv= iously wrong with the existing code. Are you sure there are no weird unprin= table characters in there?
=C2=A0

Please=C2=A0fi= nd the updated patch.

On Mon, Jun 28, 2021 at 9:33 PM Dave Page <dpage@pgadmin.org&= gt; wrote:
Hi

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

Please fin= d the attached patch for fixation of jenkins failure.

That won't work - you can't include variable= s (or string building operations) in the first argument=C2=A0to gettext cal= ls, as there won't be any way to extract a complete message into the ca= talogs. The way it's being done at the moment is correct (I don't k= now why it's failing, but it's the correct way to structure the get= text calls).
=C2=A0
--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitter: @pgsnake

ED= B: https://www.e= nterprisedb.com



--
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. Software Engineer | edbpostgres.com
&quo= t;Don't Complain about Heat, Plant a TREE"


--
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. Software Engineer | edbpostgres.com
&quo= t;Don't Complain about Heat, Plant a TREE"


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



--
Thanks,
Aditya Toshniwal=
pgAdmin hacker=C2=A0| Sr. Software Engineer | edbpostgres.com
&quo= t;Don't Complain about Heat, Plant a TREE"


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



--
Rahul Shirsat
Senior Software Engineer=C2=A0|=C2=A0EnterpriseDB=C2=A0Corporation.=
--000000000000c1571e05c5e9914f--