Subject: pgAdmin 4 - next gettext usage fixes

From: "Libor M." <[email-masked]>
Date: Wed, 8 Apr 2020 17:41:22 +0200

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šit' but in another sentence as
'zrušení')
- added gettext for text translations

Diff file is attached.

Best regards,

Libor M.

E-mail: [email-masked]
GitHub: https://github.com/liborm85

---

From: Akshay Joshi <[email-masked]>
Date: Fri, 10 Apr 2020 14:57:35 +0530

Hi Libor

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

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*

---

From: Aditya Toshniwal <[email-masked]>
Date: Wed, 15 Apr 2020 11:38:11 +0530

Hi Hackers/Libor,

The changes like below are incorrect. Try "Count rows" from a table's
context menu.

-            info=gettext("Table rows counted: %s" % count),

+            info=gettext("Table rows counted: %s") % count,

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

-- 
Thanks and Regards,
Aditya Toshniwal
pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"

---

From: Ashesh Vashi <[email-masked]>
Date: Wed, 15 Apr 2020 11:47:57 +0530

> +            info=gettext("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

> On Fri, Apr 10, 2020 at 2:57 PM Akshay Joshi <
> [email-masked]> wrote:
>
>> Hi Libor
>>

---

From: Akshay Joshi <[email-masked]>
Date: Wed, 15 Apr 2020 13:33:31 +0530

Hi Aditya

I think the fix is incorrect. .format method should be applied after
gettext() like gettext().format(). Please check for other places too and
send the updated patch.

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*

---

From: Aditya Toshniwal <[email-masked]>
Date: Wed, 15 Apr 2020 14:55:11 +0530

Hi,

Please find the updated patch.

---

From: Akshay Joshi <[email-masked]>
Date: Wed, 15 Apr 2020 16:47:04 +0530

Thanks, patch applied.

On Wed, Apr 15, 2020 at 2:55 PM Aditya Toshniwal <
[email-masked]> wrote:

> On Wed, Apr 15, 2020 at 1:33 PM Akshay Joshi <
>>> Attached is the patch to fix all such changes in pgAdmin, to use
>>> format() instead.
>>> Please review.
>>>

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*

---

From: "Libor M." <[email-masked]>
Date: Wed, 15 Apr 2020 13:46:49 +0200

Hi,
next minor gettext and format fixes in patch.

Best regards,

Libor M.

st 15. 4. 2020 v 13:17 odesílatel Akshay Joshi
<[email-masked]> napsal:
>
> Thanks, patch applied.
>
> On Wed, Apr 15, 2020 at 2:55 PM Aditya Toshniwal <[email-masked]> wrote:
>>
>> Hi,
>>
>> On Wed, Apr 15, 2020 at 1:33 PM Akshay Joshi <[email-masked]> wrote:
>>>
>>> Hi Aditya
>>>
>>> I think the fix is incorrect. .format method should be applied after gettext() like gettext().format(). Please check for other places too and send the updated patch.
>>>
>>> On Wed, Apr 15, 2020 at 11:38 AM Aditya Toshniwal <[email-masked]> wrote:
>>>>
>>>> Hi Hackers/Libor,
>>>>
>>>> The changes like below are incorrect. Try "Count rows" from a table's context menu.
>>>>
>>>> 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 <[email-masked]> wrote:
>>>>>
>>>>> Hi Libor
>>>>>
>>>>> Thanks, patch applied. Please make sure to run the PEP8 checks before sending the patch.
>>>>> Thanks & Regards
>>>>> Akshay Joshi
>>>>> Sr. Software Architect
>>>>> EnterpriseDB Software India Private Limited
>>>>> Mobile: +91 976-788-8246
>>>>
>>>>
>>>>
>>>> --
>>>> Thanks and Regards,
>>>> Aditya Toshniwal
>>> Thanks & Regards
>>> Akshay Joshi
>>> Sr. Software Architect
>>> EnterpriseDB Software India Private Limited
>>> Mobile: +91 976-788-8246
>>
>>
>>
>> --
>> Thanks and Regards,
>> Aditya Toshniwal
> Thanks & Regards
> Akshay Joshi
> Sr. Software Architect
> EnterpriseDB Software India Private Limited
> Mobile: +91 976-788-8246

---

From: Akshay Joshi <[email-masked]>
Date: Thu, 16 Apr 2020 13:20:50 +0530

Thanks, patch applied.

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*

---

From: "Libor M." <[email-masked]>
Date: Sun, 19 Apr 2020 14:20:39 +0200

Hi,
I sending patch for slightly modified the use of gettext:
- fixed `%` vs. `.format()`
- unified texts and usage `%s` vs. `{}`/`{0}`
- improved text sentences for translate
- added gettext for next texts

Best regards,

Libor M.

---

From: Akshay Joshi <[email-masked]>
Date: Mon, 20 Apr 2020 19:17:59 +0530

Thanks, patch applied.

On Sun, Apr 19, 2020 at 5:50 PM Libor M. <[email-masked]> wrote:

> >> >>> I think the fix is incorrect. .format method should be applied
> after gettext() like gettext().format(). Please check for other places too
> and send the updated patch.
> >> >>>

-- 
*Thanks & Regards*
*Akshay Joshi*

*Sr. Software Architect*