Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Backup in other langauge

2017-05-04 Thread Dave Page
Thanks, applied.

On Thu, May 4, 2017 at 10:56 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA patch to fix the issue in Backup module where it was not working if
> user changes its preference language other than english.
> RM#2354
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


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

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Backup in other langauge

2017-05-04 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue in Backup module where it was not working if
user changes its preference language other than english.
RM#2354

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/tools/backup/templates/backup/js/backup.js 
b/web/pgadmin/tools/backup/templates/backup/js/backup.js
index 96fe082..4c742f9 100644
--- a/web/pgadmin/tools/backup/templates/backup/js/backup.js
+++ b/web/pgadmin/tools/backup/templates/backup/js/backup.js
@@ -123,10 +123,10 @@ TODO LIST FOR BACKUP:
 width: "100%"
 },
 options: [
-  {label: "Custom", value: "custom"},
-  {label: "Tar", value: "tar"},
-  {label: "Plain", value: "plain"},
-  {label: "Directory", value: "directory"}
+  {label: '{{ _('Custom') }}', value: "custom"},
+  {label: '{{ _('Tar') }}', value: "tar"},
+  {label: '{{ _('Plain') }}', value: "plain"},
+  {label: '{{ _('Directory') }}', value: "directory"}
 ]
   },{
 id: 'ratio', label: '{{ _('Compression ratio') }}',
@@ -447,9 +447,11 @@ TODO LIST FOR BACKUP:
   url: '{{ url_for('help.static', 
filename='backup_dialog.html') }}'
   }
 },{
-text: '{{ _('Backup') }}', key: 27, className: 'btn 
btn-primary fa fa-lg fa-save pg-alertify-button'
+  text: '{{ _('Backup') }}', key: 27, className: 'btn 
btn-primary fa fa-lg fa-save pg-alertify-button',
+  'data-btn-name': 'backup'
 },{
-text: '{{ _('Cancel') }}', key: 27, className: 'btn 
btn-danger fa fa-lg fa-times pg-alertify-button'
+  text: '{{ _('Cancel') }}', key: 27, className: 'btn 
btn-danger fa fa-lg fa-times pg-alertify-button',
+  'data-btn-name': 'cancel'
   }],
   // Set options for dialog
   options: {
@@ -537,7 +539,7 @@ TODO LIST FOR BACKUP:
   return;
 }
 
-if (e.button.text === '{{ _('Backup') }}') {
+if (e.button['data-btn-name'] === "backup") {
 
   if (!d)
 return;
@@ -660,9 +662,11 @@ TODO LIST FOR BACKUP:
   attrs:{name:'dialog_help', type:'button', label: '{{ 
_('Backup') }}',
   url: '{{ url_for('help.static', 
filename='backup_dialog.html') }}'}
 },{
-text: '{{ _('Backup') }}', key: 27, className: 'btn 
btn-primary fa fa-lg fa-save pg-alertify-button'
+  text: '{{ _('Backup') }}', key: 27, className: 'btn 
btn-primary fa fa-lg fa-save pg-alertify-button',
+  'data-btn-name': 'backup'
 },{
-text: '{{ _('Cancel') }}', key: 27, className: 'btn 
btn-danger fa fa-lg fa-times pg-alertify-button'
+  text: '{{ _('Cancel') }}', key: 27, className: 'btn 
btn-danger fa fa-lg fa-times pg-alertify-button',
+  'data-btn-name': 'cancel'
   }],
   // Set options for dialog
   options: {
@@ -748,7 +752,7 @@ TODO LIST FOR BACKUP:
   return;
 }
 
-if (e.button.text === "Backup") {
+if (e.button['data-btn-name'] === "backup") {
   if (!d)
 return;
 
diff --git 
a/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js 
b/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js
index 8859b23..a300531 100644
--- 
a/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js
+++ 
b/web/pgadmin/tools/import_export/templates/import_export/js/import_export.js
@@ -374,10 +374,12 @@ define(
 return {
   buttons:[{
 text: "{{ _('OK') }}", key: 27, disable: true,
+'data-btn-name': 'ok',
 className:
   "btn btn-primary fa fa-lg fa-save pg-alertify-button"
   }, {
 text: "{{ _('Cancel') }}", key: 27,
+'data-btn-name': 'cancel',
 className:
   "btn btn-danger fa fa-lg fa-times pg-alertify-button"
   }],
@@ -393,7 +395,7 @@ define(
 
   // Callback functions when click on the buttons of the Alertify 
dialogs
   callback: function(e) {
-if (e.button.text === "{{ _('OK') }}") {
+if (e.button['data-btn-name'] === "ok") {
 
   var n = this.settings['pg_node'],
 i = this.settings['pg_item'],
diff --git 
a/web/pgadmin/tools/maintenance/templates/maintenance/js/maintenance.js 
b/web/pgadmin/tools/maintenance/templates/maintenance/js/mainte