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 1lzP2i-0001ED-50 for pgadmin-hackers@arkaria.postgresql.org; Fri, 02 Jul 2021 19:41:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lzP2h-0000Ot-4B for pgadmin-hackers@arkaria.postgresql.org; Fri, 02 Jul 2021 19:41:39 +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 1lzP2g-0000Ol-Qf for pgadmin-hackers@lists.postgresql.org; Fri, 02 Jul 2021 19:41:38 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lzP2c-0001hz-NF for pgadmin-hackers@postgresql.org; Fri, 02 Jul 2021 19:41:37 +0000 Received: by mail-io1-xd29.google.com with SMTP id i189so12969418ioa.8 for ; Fri, 02 Jul 2021 12:41:34 -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=1MWUsjUW7xgK+Z9lIiJV9XBYThIcL/ZR2jY45VtS/cY=; b=Wnx/tKrLH/ZDhGO2bKt2CXHpUbHHz2I2A2r8wFHLyEVzaN3MyDnWBLsD6ujIJlfKjR dzxyuAHX5ts0rx4UFdI8YKnieYzCWL/81IRiWiAlECCM2v1Qqz3EoWSicXfNjy97Poji XD7+cnxIkadU8xHUv0L3S4n3Q/fPKrQnXSKXHAqKsMWpq8IruQ83ADeOwFq2qKN48lKf DtKVU3mYOIygfrJKAlWAj0iVl6aJ/lD9tQnqpLUcBoL0kZSyNO7tQbcRtUbQ4wQb8kR8 jJtQ3gQx7PKS6u1DmmHgOuA9DDKfoExqFNAmwFOdOLw+qEwr6QwC5GbHpX90tIMT2Hiw I2Cw== 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=1MWUsjUW7xgK+Z9lIiJV9XBYThIcL/ZR2jY45VtS/cY=; b=iGsBNnmGWlE40K0yV1zLRn76ukyXrpl363LZm0dNRCh6JnCMv68FfvhnX1ebOowWUf 2xAlUJcJswtKQBXeeXuOHrlvco6D7eloyD1C99T/FJx53mPwGY4X6yWOKf8TgOnlPVg1 x8pChctNG8itUxMAUyB3z6A5yIknoP0C+W4elcXZX1u//ktJB0swUQSnVZagLu8cc1xP zzmo5gtOrilWQejH2wUw17mqrnDxxEL/IqcxSc3hc9IdOEmDcToqatHRp73lj6FWIL51 Fev7SYyaAzhjIlBngodoBYsJcRJ/lnJ17IalyZSn8C9MBxw6RoOWISZLNNkhUmGdA09/ PhiQ== X-Gm-Message-State: AOAM532ut3MJX2YsW/bTcEKxn39G+biX3484UN13yCLnMgKQZ2C68CvX UOZPpPUnR3gQ/W8LZ1tr0wqZKnhs/N4GLWP3Dus5Wv1zfPKZBoB7edmlbrJ1rJEYqzSlla1M+2p JXch0hVN/+ra3Ah3FQtG2UnhMQanja6kf1ezU97VHxzxOfFl1VR6Bzh2EMHwOBy8d8Vi4icjjsi kXuG1ZWyK52ecjMtY6TulBIReNG0eTagDfhuzn3KYdUOHK/mgNw30A4rWtLA== X-Google-Smtp-Source: ABdhPJyP8zBu2wT/ymbO5dAXY9dXDG+/NUqcxLy2mJxfmK2/xrHHlaTwQ4pMRKuC97eNtTbiytzoAucmQZpatLKDQnE= X-Received: by 2002:a02:cb49:: with SMTP id k9mr909335jap.95.1625254893714; Fri, 02 Jul 2021 12:41:33 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Rahul Shirsat Date: Sat, 3 Jul 2021 01:10:57 +0530 Message-ID: Subject: Re: [patch][pgAdmin] Fix for pgadmin4-linux-qa #1651 failure To: Khushboo Vashi Cc: Dave Page , Aditya Toshniwal , pgadmin-hackers , Akshay Joshi Content-Type: multipart/alternative; boundary="0000000000009c154a05c629243a" 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 --0000000000009c154a05c629243a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable +1 for --no-fuzzy-matching for updating translations. On Thu, Jul 1, 2021 at 11:18 AM Khushboo Vashi < khushboo.vashi@enterprisedb.com> wrote: > > > On Wed, Jun 30, 2021 at 6:55 PM Dave Page wrote: > >> Hi >> >> On Wed, Jun 30, 2021 at 9:22 AM Dave Page wrote: >> >>> Hi >>> >>> On Wed, Jun 30, 2021 at 8:28 AM Rahul Shirsat < >>> rahul.shirsat@enterprisedb.com> wrote: >>> >>>> Hi All, >>>> >>>> Please find the attached patch for resolving this issue wrt above >>>> suggestion. >>>> >>> >>> Well that may fix the problem (and is a reasonable change), however, I >>> think it's important that we understand the root cause. Why is this fai= ling >>> on Linux only? Why does the following from node.js (which follows the s= ame >>> pattern) work fine? >>> >>> var type_label =3D gettext('%s Script',stype.toUpperCase()); >>> >> >> Rahul and I figured out the root cause. The issue is occuring because th= e >> previous string had no parameters (i.e. no %s's). Because fuzzy matching= is >> used for the translations, when updating the catalogs it was matching wi= th >> the old translation, which at runtime would likely have caused a crash >> because the catalogs would have contained something like: >> >> #: pgadmin/browser/static/js/node.js:209 >> #, fuzzy, python-format >> msgid "Search %s Objects" >> msgstr "Typy obiekt=C3=B3w" >> >> There are a few of ways around this: >> >> - Manually fix the translations in each catalog. This is not a good idea >> because we don't speak all those languages and will probably mess the >> translations up. >> >> - Run something like 'make msg-extract && pybabel update >> --no-fuzzy-matching -i web/pgadmin/messages.pot -d web/pgadmin/translati= ons >> && make msg-compile', then commit the results. This will remove all fuzz= y >> matches from the catalogs, which means more work for the translators on = the >> next release, but will likely also result in them becoming much cleaner. >> >> +1 for pybabel update with -N option > >> - Change the code to use the conditional fix. >> >> I'm leaning towards the second option. In the worst case, it'll lose >> about 58 fuzzy translations (meaning 58 messages to re-translate), but a= t >> least we'll know they are clean. See >> https://www.pgadmin.org/development/translations/ for current stats. >> >> Thoughts? >> >> -- >> Dave Page >> Blog: https://pgsnake.blogspot.com >> Twitter: @pgsnake >> >> EDB: https://www.enterprisedb.com >> >> --=20 *Rahul Shirsat* Senior Software Engineer | EnterpriseDB Corporation. --0000000000009c154a05c629243a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
+1 for --no-fuzzy-matching for updating translations.
<= /div>
O= n Thu, Jul 1, 2021 at 11:18 AM Khushboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
<= div dir=3D"ltr">

On Wed, Jun 30, 2021 at 6:55 PM Dave Page <dpage@pgadmin.org> w= rote:
Hi

On Wed, Jun 30, 2021 at 9:22 AM Dave Page <dpage@pgadmin.org> wrote:
Hi

On Wed, Jun 30, 2021 at 8:28 AM Rahul Shirsat <rahul.shirsat@= enterprisedb.com> wrote:
Hi All,

Please fi= nd the attached patch for resolving=C2=A0this issue wrt above suggestion.

Well that may fix the problem (and is = a reasonable change), however, I think it's important that we understan= d the root cause. Why is this failing on Linux only? Why does the following= from node.js (which follows the same pattern) work fine?

var type_label =3D gettext('%s Script',stype.toUpperCase())= ;

Rahul and I figur= ed out the root cause. The issue is occuring because the previous string ha= d no parameters=C2=A0(i.e. no %s's). Because fuzzy matching is used for= the translations, when updating the catalogs it was matching with the old = translation, which at runtime would likely have caused a crash because the = catalogs would have contained something like:

#: pgadmin/browser/static/js/node.js:209
#, fuzzy, python-format=
msgid "Search %s Objects"
msgstr "Typy = obiekt=C3=B3w"

There are a few of ways = around this:

- Manually fix the translations in ea= ch catalog. This is not a good idea because we don't speak all those la= nguages and will probably mess the translations up.

- Run something like 'make msg-extract && pybabel update --no= -fuzzy-matching=C2=A0-i web/pgadmin/messages.pot -d web/pgadmin/translation= s && make msg-compile', then commit the results. This will remo= ve all fuzzy matches from the catalogs, which means more work for the trans= lators on the next release, but will likely also result in them becoming mu= ch cleaner.

+1 for=C2=A0pybabel update with -N option
=
- Change the code to use the conditional fix.

I'm leaning towards the second option. In the worst case, it'= ;ll lose about 58 fuzzy translations (meaning 58 messages to re-translate),= but at least we'll know they are clean. See=C2=A0https://www.pgad= min.org/development/translations/ for current stats.

Thoughts?

--
Dave Page
Blog: https://pgsnake.blogspot.com
Twitter: @pgsnake

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



--
Rahul Shirsat
Senior Software Engineer=C2=A0|=C2=A0EnterpriseDB=C2=A0Corporation.=
--0000000000009c154a05c629243a--