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 1jObNF-0007M3-63 for pgadmin-hackers@arkaria.postgresql.org; Wed, 15 Apr 2020 06:18:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jObNE-0006NT-2Z for pgadmin-hackers@arkaria.postgresql.org; Wed, 15 Apr 2020 06:18:12 +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 1jObND-0006NM-Ot for pgadmin-hackers@lists.postgresql.org; Wed, 15 Apr 2020 06:18:11 +0000 Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jObNB-0008Jk-5t for pgadmin-hackers@postgresql.org; Wed, 15 Apr 2020 06:18:10 +0000 Received: by mail-ot1-x32f.google.com with SMTP id k21so2320261otl.5 for ; Tue, 14 Apr 2020 23:18:09 -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=3OmLUIiC+9kew+w8ZwmnUoMWMMAFw/1Y8nw+ZCtNG98=; b=PfyL/7iJ0y77DZGQHFNexE/wqIL+VttyzlpLxPtXLb4yYrVZNXL7RR7DyppsF247iS nnMfFcjONHMnKOHEzbzzcuoujU1SgnLg83mRTi3a4pf7cplr8Fckh5HcZ4FgfTdHOZgm 52wVx9R26ZTJ5eMM4IFaJaLZj3NtRuiuyOgel265LlheWtcMNgG1jnF1SqAos8enHEIX uXLMNcz6SlVEetbazizyrf+UU0UxT4+8ycQQD6hy28LmpBYqmhRbHdRbwf6ZnuWr1Mwf fR+cII0IFBCr8ec0je6i0DmV2CMR9PzXDWZbyQxpXjHIn06sT/GBo2jvuXNXzw+OAZd4 Bj6A== 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=3OmLUIiC+9kew+w8ZwmnUoMWMMAFw/1Y8nw+ZCtNG98=; b=qgQ/x8vtmoOzJ/jibcumaAJK82zosxRilz8zJVy30ohPSQIo2nD4isps+AE6yWYXp8 QPzZVl56titCTBZi2BmQL6xhxckxHdsqWqL1XD3ZKe1xJ8TMQ+F9tIp+SBVrr1ycG/Cn RgpRNUNfDXojuTicqhc8t71obmT1O49QJsyF9H+emlwaPr9E+v2FnAbZnByF9FNu14wB egoQRi1mbzkLHeZTOUpbHvPJa2BCcVqytXltxNMlTWTgeKPB0ApoxiE+BtAKVmPV2rZK UbrcsEVjvkGWYfkR3GJxv/0LFg8/Gx5AnGFzfeykSNZtZRQSAJfIj8NM4Ej+Lx7dZ8Z/ 1Vgg== X-Gm-Message-State: AGi0Puaf6Va8WCNrExZOcFLOlR6cuiaS+ZD+mJK+wSbmiE0weruMuezr IPnGYFq5O4IPtuGOdUlnTxClzHtBBPozpQJ6qS0YBUnDT6LSw1UFsAVWZlZ2ca/mrBhdZl6drdZ V2GLJEhTWF33SQKn3l1/s0eV1rKdoIdQ3V6w788JQXBzh4U4H62a9GDGOf+zfh7S/mRgU/wvEQX FwKkS//iV3iEBLfbuE/SyBd793/NDP1sBZWqrmikRXprSMHLbrB+w= X-Google-Smtp-Source: APiQypLzUep537lFt07o6XTQVoTwk9ck9WBZMeYoqPnRAn5Kof6q5zRp9HWt3SEcsgS5UCuhSQBmaO4j1dF/Ie+qnPY= X-Received: by 2002:a9d:7cd4:: with SMTP id r20mr7851433otn.172.1586931488537; Tue, 14 Apr 2020 23:18:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ashesh Vashi Date: Wed, 15 Apr 2020 11:47:57 +0530 Message-ID: Subject: Re: pgAdmin 4 - next gettext usage fixes To: Aditya Toshniwal Cc: Akshay Joshi , "Libor M." , pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000a8507405a34e4742" X-CLOUD-SEC-AV-Info: edb,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: Precedence: bulk --000000000000a8507405a34e4742 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 15, 2020 at 11:38 AM Aditya Toshniwal < aditya.toshniwal@enterprisedb.com> wrote: > Hi Hackers/Libor, > > The changes like below are incorrect. Try "Count rows" from a table's > context menu. > > - info=3Dgettext("Table rows counted: %s" % count), > > + info=3Dgettext("Table rows counted: %s") % count, > I would also avoid using this syntax, when multiple variables need to be replaced. e.g. gettext("Test(#%s) -> %s") % test_no % test_result Each language has different semantics, and the position of these variables may change based on them. We should use the 'format' function with proper variables in such cases. e.g. gettext("Test(#{test_no}) ->{test_result}").format(test_no, test_result). I've not reviewed the patch, but - please look at this aspect while reviewing the patch. -- Thanks, Ashesh > > Attached is the patch to fix all such changes in pgAdmin, to use format() > instead. > Please review. > > On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi < > akshay.joshi@enterprisedb.com> wrote: > >> Hi Libor >> >> Thanks, patch applied. Please make sure to run the PEP8 checks before >> sending the patch. >> I have fixed and committed the code. >> >> On Wed, Apr 8, 2020 at 9:30 PM Libor M. wrote: >> >>> Hello, >>> I fixed next gettext usage: >>> >>> - fixed gettext usage with .format() only for original text with %s >>> - fixed typos >>> - fixed translation yes/no buttons in dialog >>> - improved translating sentences without "connecting" words (eg. see >>> web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs to >>> be translated in Czech language as 'zru=C5=A1it' but in another sentenc= e as >>> 'zru=C5=A1en=C3=AD') >>> - added gettext for text translations >>> >>> Diff file is attached. >>> >>> Best regards, >>> >>> Libor M. >>> >>> E-mail: liborm85@gmail.com >>> GitHub: https://github.com/liborm85 >>> >> >> >> -- >> *Thanks & Regards* >> *Akshay Joshi* >> >> *Sr. Software Architect* >> *EnterpriseDB Software India Private Limited* >> *Mobile: +91 976-788-8246* >> > > > -- > Thanks and Regards, > Aditya Toshniwal > pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune > "Don't Complain about Heat, Plant a TREE" > --000000000000a8507405a34e4742 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Wed, Apr 15, 2020 at 11:38 AM Aditya T= oshniwal <aditya.to= shniwal@enterprisedb.com> wrote:
Hi Hackers/Libor,

The changes like below are incorrect. Try &q= uot;Count rows" from a table's context menu.

-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 info=3Dge= ttext("Table rows counted: %s" % count),

+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 info=3Dge= ttext("Table rows counted: %s") % count,

I would also avoid using this syntax, when multiple v= ariables need to be replaced.
e.g.
gettext("Test(#= %s) -> %s") % test_no % test_result

Each l= anguage=C2=A0has different semantics, and the position of these variables m= ay change based on them.
We should use the 'format' funct= ion with proper variables in such cases.
e.g.
gettext(&= quot;Test(#{test_no}) ->{test_result}").format(test_no, test_result= ).

I've not reviewed the patch, but - please l= ook at this aspect while reviewing the patch.

-- T= hanks, Ashesh

Attached is the patch to fix all= such changes in pgAdmin, to use format() instead.
Please review.

On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <akshay.jos= hi@enterprisedb.com> wrote:
Hi=C2=A0Libor

Thanks= , patch applied. Please make sure to run the PEP8 checks before sending the= patch.
I have fixed and committed the code.

On Wed, Apr 8, = 2020 at 9:30 PM Libor M. <liborm85@gmail.com> wrote:
Hello,
I fixed next gettext usage:

- fixed gettext usage with .format() only for original text with %s
- fixed typos
- fixed translation yes/no buttons in dialog
- improved translating sentences without "connecting" words (eg. = see
web/pgadmin/dashboard/static/js/dashboard.js, word 'cancel' needs t= o
be translated in Czech language as 'zru=C5=A1it' but in another sen= tence as
'zru=C5=A1en=C3=AD')
- added gettext for text translations

Diff file is attached.

Best regards,

Libor M.

E-mail: liborm85@gm= ail.com
GitHub: https://github.com/liborm85


--
Thanks & Regards
Akshay Joshi
<= font color=3D"#3333FF">Sr. Software Architect=
<= font color=3D"#000000" face=3D"arial, sans-serif">EnterpriseDB Software = India Private Limited
Mobile: +91 976-788-8246=


--
Thanks and Regards,
Aditya Toshniwal
pgAdmin Hacker | Sr. Software Engineer |=C2=A0Ent= erpriseDB India |=C2=A0Pune<= /span>
"Don't Complain about Heat, Plant a TREE"=
--000000000000a8507405a34e4742--