diff --git a/web/pgadmin/browser/server_groups/servers/databases/casts/templates/cast/js/casts.js b/web/pgadmin/browser/server_groups/servers/databases/casts/templates/cast/js/casts.js index 148303415..869a2cc71 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/casts/templates/cast/js/casts.js +++ b/web/pgadmin/browser/server_groups/servers/databases/casts/templates/cast/js/casts.js @@ -1,13 +1,13 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { - +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the collection class for cast if (!pgBrowser.Nodes['coll-cast']) { var casts = pgAdmin.Browser.Nodes['coll-cast'] = pgAdmin.Browser.Collection.extend({ node: 'cast', - label: '{{ _('Casts') }}', + label: gettext('Casts'), type: 'coll-cast', columns: ['name', 'description'] }); @@ -23,7 +23,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { dialogHelp: '{{ url_for('help.static', filename='cast_dialog.html') }}', canDrop: true, canDropCascade: true, - label: '{{ _('Cast') }}', + label: gettext('Cast'), hasSQL: true, hasDepends: true, Init: function() { @@ -38,18 +38,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_cast_on_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Cast...') }}', + category: 'create', priority: 4, label: gettext('Cast...'), icon: 'wcTabIcon icon-cast', data: {action: 'create'}, enable: pgBrowser.Nodes['database'].is_conn_allow },{ name: 'create_cast_on_coll', node: 'coll-cast', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Cast...') }}', + category: 'create', priority: 4, label: gettext('Cast...'), icon: 'wcTabIcon icon-cast', data: {action: 'create'} },{ name: 'create_cast', node: 'cast', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Cast...') }}', + category: 'create', priority: 4, label: gettext('Cast...'), icon: 'wcTabIcon icon-cast', data: {action: 'create'} }]); @@ -70,14 +70,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Define the schema for cast schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', editable: false, type: 'text', disabled: true, cellHeaderClasses: 'width_percent_50' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', editable: false, type: 'text', disabled: true, mode: ['properties'], },{ - id: 'srctyp', label:'{{ _('Source type') }}', url: 'get_type', - type: 'text', group: 'Definition', disabled: function(m) { + id: 'srctyp', label: gettext('Source type'), url: 'get_type', + type: 'text', group: gettext('Definition'), disabled: function(m) { return !m.isNew() }, mode: ['create'], @@ -120,11 +120,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { * edit mode only */ { - id: 'srctyp', label:'{{ _('Source type') }}', type: 'text', - group: 'Definition', disabled: true, mode:['properties','edit'] + id: 'srctyp', label: gettext('Source type'), type: 'text', + group: gettext('Definition'), disabled: true, mode:['properties','edit'] },{ - id: 'trgtyp', label:'{{ _('Target type') }}', url: 'get_type', - type: 'text', group: 'Definition', disabled: function(m) { + id: 'trgtyp', label: gettext('Target type'), url: 'get_type', + type: 'text', group: gettext('Definition'), disabled: function(m) { return !m.isNew() }, mode: ['create'], transform: function(rows) { @@ -165,8 +165,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { * edit mode only */ { - id: 'trgtyp', label:'{{ _('Target type') }}', type: 'text', - group: 'Definition', disabled: true, mode:['properties','edit'] + id: 'trgtyp', label: gettext('Target type'), type: 'text', + group: gettext('Definition'), disabled: true, mode:['properties','edit'] }, /* @@ -175,9 +175,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { * associated functions will be fetch using ajax call */ { - id: 'proname', label:'{{ _('Function') }}', deps:['srctyp', 'trgtyp'], + id: 'proname', label: gettext('Function'), deps:['srctyp', 'trgtyp'], type: 'text', disabled: function(m) { return !m.isNew(); }, - group: 'Definition', mode: ['create'], + group: gettext('Definition'), mode: ['create'], control: 'node-ajax-options', options: function(control) { var srcTyp = control.model.get('srctyp'); @@ -226,12 +226,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { * edit mode only */ { - id: 'proname', label:'{{ _('Function') }}', type: 'text', - group: 'Definition', disabled: true, mode:['properties','edit'] + id: 'proname', label: gettext('Function'), type: 'text', + group: gettext('Definition'), disabled: true, mode:['properties','edit'] },{ - id: 'castcontext', label:'{{ _('Context') }}', + id: 'castcontext', label: gettext('Context'), options:{'onText':'IMPLICIT','offText':'EXPLICIT'}, - editable: false, type: 'string', group: 'Definition', + editable: false, type: 'string', group: gettext('Definition'), mode:['create'], control: Backform.SwitchControl.extend({ getValueFromDOM: function() { @@ -244,17 +244,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { * edit mode */ { - id: 'castcontext', label:'{{ _('Context') }}', disabled: true, + id: 'castcontext', label: gettext('Context'), disabled: true, options:[{ label: 'IMPLICIT', value: 'IMPLICIT' },{ label: 'EXPLICIT', value: 'EXPLICIT' },{ label: 'ASSIGNMENT', value: 'ASSIGNMENT' - }], editable: false, type: 'select2', group: 'Definition', + }], editable: false, type: 'select2', group: gettext('Definition'), mode:['properties', 'edit'] },{ - id: 'syscast', label:'{{ _('System cast?') }}', + id: 'syscast', label: gettext('System cast?'), cell: 'switch', type: 'switch', mode: ['properties'], disabled: true, options: { 'onText': 'Yes', 'offText': 'No', @@ -262,7 +262,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { 'size': 'small' } },{ - id: 'description', label:'{{ _('Comment') }}',type: 'text', + id: 'description', label: gettext('Comment'),type: 'text', type: 'multiline', cellHeaderClasses: 'width_percent_50' } ], @@ -279,7 +279,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // validate source type control if (_.isUndefined(srctype) || _.isNull(srctype) || String(srctype).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Source type must be selected.') }}'; + var msg = gettext('Source type must be selected.'); this.errorModel.set('srctyp', msg); return msg; } @@ -290,7 +290,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // validate target type control if (_.isUndefined(trgtype) || _.isNull(trgtype) || String(trgtype).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Target type must be selected.') }}'; + var msg = gettext('Target type must be selected.'); this.errorModel.set('trgtyp', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js index a5e5d2104..2165236bf 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js +++ b/web/pgadmin/browser/server_groups/servers/databases/event_triggers/templates/event_triggers/js/event_trigger.js @@ -1,13 +1,14 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the browser's collection class for event trigger collection if (!pgBrowser.Nodes['coll-event_trigger']) { var databases = pgAdmin.Browser.Nodes['coll-event_trigger'] = pgAdmin.Browser.Collection.extend({ node: 'event_trigger', - label: '{{ _('Event Trigger') }}', + label: gettext('Event Trigger'), type: 'coll-event_trigger', columns: ['name', 'eventowner', 'comment'] }); @@ -21,7 +22,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'sql-altereventtrigger.html', sqlCreateHelp: 'sql-createeventtrigger.html', dialogHelp: '{{ url_for('help.static', filename='event_trigger_dialog.html') }}', - label: '{{ _('Event Trigger') }}', + label: gettext('Event Trigger'), hasSQL: true, hasDepends: true, canDrop: true, @@ -35,17 +36,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_event_trigger_on_coll', node: 'coll-event_trigger', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Event Trigger...') }}', + category: 'create', priority: 4, label: gettext('Event Trigger...'), icon: 'wcTabIcon icon-event_trigger', data: {action: 'create'} },{ name: 'create_event_trigger', node: 'event_trigger', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Event Trigger...') }}', + category: 'create', priority: 4, label: gettext('Event Trigger...'), icon: 'wcTabIcon icon-event_trigger', data: {action: 'create'} },{ name: 'create_event_trigger', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Event Trigger...') }}', + category: 'create', priority: 4, label: gettext('Event Trigger...'), icon: 'wcTabIcon icon-event_trigger', data: {action: 'create'}, enable: pgBrowser.Nodes['database'].is_conn_allow } @@ -82,20 +83,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Define the schema for the event trigger node schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text', mode: ['properties'] },{ - id: 'eventowner', label:'{{ _('Owner') }}', cell: 'string', + id: 'eventowner', label: gettext('Owner'), cell: 'string', type: 'text', mode: ['properties', 'edit','create'], node: 'role', control: Backform.NodeListByNameControl },{ - id: 'comment', label:'{{ _('Comment') }}', type: 'multiline' + id: 'comment', label: gettext('Comment'), type: 'multiline' },{ - id: 'enabled', label:'{{ _('Enabled status') }}', - type:"radio", group: "Definition", mode: ['properties', 'edit','create'], + id: 'enabled', label: gettext('Enabled status'), + type:"radio", group: gettext("Definition"), mode: ['properties', 'edit','create'], options: [ {label: "Enable", value: "O"}, {label: "Disable", value: "D"}, @@ -103,23 +104,23 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { {label: "Always", value: "A"} ] },{ - id: 'eventfunname', label:'{{ _('Trigger function') }}', - type: 'text', control: 'node-ajax-options', group: "Definition", + id: 'eventfunname', label: gettext('Trigger function'), + type: 'text', control: 'node-ajax-options', group: gettext("Definition"), url:'fopts', cache_node: 'trigger_function' },{ - id: 'eventname', label:'{{ _('Events') }}', - type:"radio", group: "Definition", cell: 'string', + id: 'eventname', label: gettext('Events'), + type:"radio", group: gettext("Definition"), cell: 'string', options: [ {label: "DDL COMMAND START", value: "DDL_COMMAND_START"}, {label: "DDL COMMAND END", value: "DDL_COMMAND_END"}, {label: "SQL DROP", value: "SQL_DROP"} ] },{ - id: 'when', label:'{{ _('When') }}', type: 'multiline', group: "Definition", + id: 'when', label: gettext('When'), type: 'multiline', group: gettext("Definition"), },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', + id: 'seclabels', label: gettext('Security Labels'), model: pgBrowser.SecLabelModel, editable: false, type: 'collection', - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: gettext('Security'), mode: ['edit', 'create'], min_version: 90200, canAdd: true, canEdit: false, canDelete: true, control: 'unique-col-collection' } @@ -132,33 +133,33 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Event trigger name cannot be empty.') }}'; + msg = gettext('Event trigger name cannot be empty.'); this.errorModel.set('name', msg); return msg; } if (_.isUndefined(this.get('eventowner')) || String(this.get('eventowner')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Event trigger owner cannot be empty.') }}'; + msg = gettext('Event trigger owner cannot be empty.'); this.errorModel.set('eventowner', msg); return msg; } if (_.isUndefined(this.get('enabled'))) { - msg = '{{ _('Event trigger enabled status cannot be empty.') }}'; + msg = gettext('Event trigger enabled status cannot be empty.'); this.errorModel.set('enabled', msg); return msg; } if (_.isUndefined(this.get('eventfunname')) || String(this.get('eventfunname')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Event trigger function cannot be empty.') }}'; + msg = gettext('Event trigger function cannot be empty.'); this.errorModel.set('eventfunname', msg); return msg; } if (_.isUndefined(this.get('eventname'))) { - msg = '{{ _('Event trigger event cannot be empty.') }}'; + msg = gettext('Event trigger event cannot be empty.'); this.errorModel.set('eventname', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/extensions/templates/extensions/js/extensions.js b/web/pgadmin/browser/server_groups/servers/databases/extensions/templates/extensions/js/extensions.js index 14e65e342..5f6a8c930 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/extensions/templates/extensions/js/extensions.js +++ b/web/pgadmin/browser/server_groups/servers/databases/extensions/templates/extensions/js/extensions.js @@ -1,7 +1,7 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser) { /* * Create and Add an Extension Collection into nodes @@ -14,7 +14,7 @@ function($, _, S, pgAdmin, pgBrowser) { var extensions = pgAdmin.Browser.Nodes['coll-extension'] = pgAdmin.Browser.Collection.extend({ node: 'extension', - label: '{{ _('Extension') }}', + label: gettext('Extension'), type: 'coll-extension', columns: ['name', 'owner', 'comment'] }); @@ -45,7 +45,7 @@ function($, _, S, pgAdmin, pgBrowser) { hasDepends: true, canDrop: true, canDropCascade: true, - label: '{{ _('Extension') }}', + label: gettext('Extension'), Init: function() { if(this.initialized) @@ -61,17 +61,17 @@ function($, _, S, pgAdmin, pgBrowser) { pgBrowser.add_menus([{ name: 'create_extension_on_coll', node: 'coll-extension', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Extension...') }}', + category: 'create', priority: 4, label: gettext('Extension...'), icon: 'wcTabIcon icon-extension', data: {action: 'create'} },{ name: 'create_extension', node: 'extension', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Extension...') }}', + category: 'create', priority: 4, label: gettext('Extension...'), icon: 'wcTabIcon icon-extension', data: {action: 'create'} },{ name: 'create_extension', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Extension...') }}', + category: 'create', priority: 4, label: gettext('Extension...'), icon: 'wcTabIcon icon-extension', data: {action: 'create'}, enable: pgBrowser.Nodes['database'].is_conn_allow } @@ -85,7 +85,7 @@ function($, _, S, pgAdmin, pgBrowser) { model: pgAdmin.Browser.Node.Model.extend({ schema: [ { - id: 'name', label: '{{ _('Name')}}', first_empty: true, + id: 'name', label: gettext('Name'), first_empty: true, type: 'text', mode: ['properties', 'create', 'edit'], visible: true, url:'avails', disabled: function(m) { return !m.isNew(); @@ -168,17 +168,17 @@ function($, _, S, pgAdmin, pgBrowser) { }) }, { - id: 'eid', label: '{{ _('OID')}}', cell: 'string', + id: 'eid', label: gettext('OID'), cell: 'string', type: 'text', disabled: true, mode: ['properties'] }, { - id: 'owner', label:'{{ _('Owner') }}', control: 'node-list-by-name', + id: 'owner', label: gettext('Owner'), control: 'node-list-by-name', mode: ['properties'], node: 'role', cell: 'string', cache_level: 'server' }, { - id: 'schema', label: '{{ _('Schema')}}', type: 'text', - control: 'node-list-by-name', group: '{{ _('Definition')}}', + id: 'schema', label: gettext('Schema'), type: 'text', + control: 'node-list-by-name', group: gettext('Definition'), mode: ['properties', 'create', 'edit'], deps: ['relocatable'], node: 'schema', first_empty: true, disabled: function(m) { @@ -190,8 +190,8 @@ function($, _, S, pgAdmin, pgBrowser) { } }, { - id: 'relocatable', label: '{{ _('Relocatable?')}}', cell: 'switch', - group: '{{ _('Definition')}}', type: 'switch', mode: ['properties'], + id: 'relocatable', label: gettext('Relocatable?'), cell: 'switch', + group: gettext('Definition'), type: 'switch', mode: ['properties'], options: { 'onText': 'Yes', 'offText': 'No', 'onColor': 'success', 'offColor': 'primary', @@ -199,8 +199,8 @@ function($, _, S, pgAdmin, pgBrowser) { } }, { - id: 'version', label: '{{ _('Version')}}', cell: 'string', - mode: ['properties', 'create', 'edit'], group: '{{ _('Definition')}}', + id: 'version', label: gettext('Version'), cell: 'string', + mode: ['properties', 'create', 'edit'], group: gettext('Definition'), control: 'node-ajax-options', url:'avails', first_empty: true, // Transform the data into version for the selected extension. @@ -222,7 +222,7 @@ function($, _, S, pgAdmin, pgBrowser) { } }, { - id: 'comment', label: '{{ _('Comment')}}', cell: 'string', + id: 'comment', label: gettext('Comment'), cell: 'string', type: 'multiline', disabled: true } ], @@ -237,7 +237,7 @@ function($, _, S, pgAdmin, pgBrowser) { name = this.get('name'); if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _('Name cannot be empty.') }}'; + err['name'] = gettext('Name cannot be empty.'); errmsg = errmsg || err['name']; this.errorModel.set('name', errmsg); return errmsg; diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/js/foreign_servers.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/js/foreign_servers.js index 1d1bf1a86..0e80fb588 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/js/foreign_servers.js +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/templates/foreign_servers/js/foreign_servers.js @@ -1,7 +1,8 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', - 'pgadmin.browser.server.privilege'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the browser's node model class to create a Options model var OptionsModel = pgAdmin.Browser.Node.Model.extend({ @@ -41,7 +42,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { var foreign_data_wrappers = pgAdmin.Browser.Nodes['coll-foreign_server'] = pgAdmin.Browser.Collection.extend({ node: 'foreign_server', - label: '{{ _('Foreign Servers') }}', + label: gettext('Foreign Servers'), type: 'coll-foreign_server', columns: ['name','fsrvowner','description'] }); @@ -54,7 +55,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { type: 'foreign_server', sqlAlterHelp: 'sql-alterforeignserver.html', sqlCreateHelp: 'sql-createforeignserver.html', - label: '{{ _('Foreign Server') }}', + label: gettext('Foreign Server'), hasSQL: true, hasDepends: true, canDrop: true, @@ -73,17 +74,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_foreign_server_on_coll', node: 'coll-foreign_server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Foreign Server...') }}', + category: 'create', priority: 4, label: gettext('Foreign Server...'), icon: 'wcTabIcon icon-foreign_server', data: {action: 'create'} },{ name: 'create_foreign_server', node: 'foreign_server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Foreign Server...') }}', + category: 'create', priority: 4, label: gettext('Foreign Server...'), icon: 'wcTabIcon icon-foreign_server', data: {action: 'create'} },{ name: 'create_foreign_server', node: 'foreign_data_wrapper', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Foreign Server...') }}', + category: 'create', priority: 4, label: gettext('Foreign Server...'), icon: 'wcTabIcon icon-foreign_server', data: {action: 'create'} } ]); @@ -116,7 +117,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Defining schema for the foreign server node schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', disabled: function(m) { if (this.mode == 'edit' && this.node_info.server.version < 90200) { return true; @@ -125,25 +126,25 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return false; } },{ - id: 'fsrvid', label:'{{ _('OID') }}', cell: 'string', + id: 'fsrvid', label: gettext('OID'), cell: 'string', type: 'text', disabled: true, mode: ['properties'] },{ - id: 'fsrvowner', label:'{{ _('Owner') }}', type: 'text', + id: 'fsrvowner', label: gettext('Owner'), type: 'text', control: Backform.NodeListByNameControl, node: 'role', mode: ['edit', 'create', 'properties'], select2: { allowClear: false } },{ - id: 'fsrvtype', label:'{{ _('Type') }}', cell: 'string', - group: '{{ _('Definition') }}', type: 'text', mode: ['edit','create','properties'], disabled: function(m) { + id: 'fsrvtype', label: gettext('Type'), cell: 'string', + group: gettext('Definition'), type: 'text', mode: ['edit','create','properties'], disabled: function(m) { return !m.isNew(); } },{ - id: 'fsrvversion', label:'{{ _('Version') }}', cell: 'string', - group: '{{ _('Definition') }}', type: 'text' + id: 'fsrvversion', label: gettext('Version'), cell: 'string', + group: gettext('Definition'), type: 'text' },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline' },{ - id: 'fsrvoptions', label: 'Options', type: 'collection', group: "Options", + id: 'fsrvoptions', label: 'Options', type: 'collection', group: gettext("Options"), model: OptionsModel, control: 'unique-col-collection', mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['fsrvoption'], columns: ['fsrvoption','fsrvvalue'] @@ -152,8 +153,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}), control: 'unique-col-collection', mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['grantee'] },{ - id: 'acl', label: '{{ _('Privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'acl', label: gettext('Privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true } ], @@ -166,7 +167,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name cannot be empty.') }}'; + var msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; } else { diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/templates/user_mappings/js/user_mappings.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/templates/user_mappings/js/user_mappings.js index 43f2fb88d..ca6cb97ff 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/templates/user_mappings/js/user_mappings.js +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/foreign_servers/user_mapping/templates/user_mappings/js/user_mappings.js @@ -1,6 +1,7 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the browser's node model class to create a Options model var OptionsModel = pgAdmin.Browser.Node.Model.extend({ @@ -11,10 +12,13 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, // Defining schema for the Options model - schema: [ - {id: 'umoption', label:'Options', type:'text', cellHeaderClasses:'width_percent_50', group: null, editable: true}, - {id: 'umvalue', label:'Value', type: 'text', cellHeaderClasses:'width_percent_50', group:null, editable: true}, - ], + schema: [{ + id: 'umoption', label: gettext('Options'), type:'text', + cellHeaderClasses:'width_percent_50', group: null, editable: true + }, { + id: 'umvalue', label: gettext('Value'), type: 'text', + cellHeaderClasses:'width_percent_50', group:null, editable: true + }], /* validate function is used to validate the input given by * the user. In case of error, message will be displayed on @@ -40,7 +44,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { var foreign_data_wrappers = pgAdmin.Browser.Nodes['coll-user_mapping'] = pgAdmin.Browser.Collection.extend({ node: 'user_mapping', - label: '{{ _('User Mappings') }}', + label: gettext('User Mappings'), type: 'coll-user_mapping', columns: ['name'] }); @@ -54,7 +58,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'sql-alterusermapping.html', sqlCreateHelp: 'sql-createusermapping.html', dialogHelp: '{{ url_for('help.static', filename='user_mapping_dialog.html') }}', - label: '{{ _('User Mapping') }}', + label: gettext('User Mapping'), hasSQL: true, hasDepends: true, canDrop: true, @@ -73,17 +77,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_user_mapping_on_coll', node: 'coll-user_mapping', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('User Mapping...') }}', + category: 'create', priority: 4, label: gettext('User Mapping...'), icon: 'wcTabIcon icon-user_mapping', data: {action: 'create'} },{ name: 'create_user_mapping', node: 'user_mapping', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('User Mapping...') }}', + category: 'create', priority: 4, label: gettext('User Mapping...'), icon: 'wcTabIcon icon-user_mapping', data: {action: 'create'} },{ name: 'create_user_mapping', node: 'foreign_server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('User Mapping...') }}', + category: 'create', priority: 4, label: gettext('User Mapping...'), icon: 'wcTabIcon icon-user_mapping', data: {action: 'create'} } ]); @@ -110,7 +114,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Defining schema for the user mapping node schema: [{ - id: 'name', label:'{{ _('User') }}', type: 'text', + id: 'name', label: gettext('User'), type: 'text', control: Backform.NodeListByNameControl, node: 'role', mode: ['edit', 'create', 'properties'], select2: { allowClear: false }, disabled: function(m) { return !m.isNew(); }, @@ -126,10 +130,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return res; } },{ - id: 'um_oid', label:'{{ _('OID') }}', cell: 'string', + id: 'um_oid', label: gettext('OID'), cell: 'string', type: 'text', disabled: true, mode: ['properties'], },{ - id: 'umoptions', label: 'Options', type: 'collection', group: "Options", + id: 'umoptions', label: 'Options', type: 'collection', group: gettext("Options"), model: OptionsModel, control: 'unique-col-collection', mode: ['create', 'edit'], canAdd: true, canDelete: true, uniqueCol : ['umoption'] } @@ -144,7 +148,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name cannot be empty.') }}'; + var msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; } else { diff --git a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/templates/foreign_data_wrappers/js/foreign_data_wrappers.js b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/templates/foreign_data_wrappers/js/foreign_data_wrappers.js index e3639fb61..facca75fb 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/templates/foreign_data_wrappers/js/foreign_data_wrappers.js +++ b/web/pgadmin/browser/server_groups/servers/databases/foreign_data_wrappers/templates/foreign_data_wrappers/js/foreign_data_wrappers.js @@ -1,8 +1,8 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', - 'alertify', 'pgadmin.browser.collection', - 'pgadmin.browser.server.privilege'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the browser's node model class to create a Options model var OptionsModel = pgBrowser.Node.Model.extend({ @@ -13,10 +13,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, // Defining schema for the Options model schema: [{ - id: 'fdwoption', label: '{{ _('Option') }}', type:'text', + id: 'fdwoption', label: gettext('Option'), type:'text', cellHeaderClasses:'width_percent_50', editable: true },{ - id: 'fdwvalue', label:'{{ _('Value') }}', type: 'text', + id: 'fdwvalue', label: gettext('Value'), type: 'text', cellHeaderClasses:'width_percent_50', group:null, editable: true }], /* validate function is used to validate the input given by @@ -43,7 +43,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { var foreign_data_wrappers = pgBrowser.Nodes['coll-foreign_data_wrapper'] = pgBrowser.Collection.extend({ node: 'foreign_data_wrapper', - label: '{{ _('Foreign Data Wrappers') }}', + label: gettext('Foreign Data Wrappers'), type: 'coll-foreign_data_wrapper', columns: ['name','fdwowner','description'] }); @@ -57,7 +57,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'sql-alterforeigndatawrapper.html', sqlCreateHelp: 'sql-createforeigndatawrapper.html', dialogHelp: '{{ url_for('help.static', filename='foreign_data_wrapper_dialog.html') }}', - label: '{{ _('Foreign Data Wrapper') }}', + label: gettext('Foreign Data Wrapper'), hasSQL: true, hasDepends: true, canDrop: true, @@ -76,17 +76,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_foreign_data_wrapper_on_coll', node: 'coll-foreign_data_wrapper', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Foreign Data Wrapper...') }}', + category: 'create', priority: 4, label: gettext('Foreign Data Wrapper...'), icon: 'wcTabIcon icon-foreign_data_wrapper', data: {action: 'create'} },{ name: 'create_foreign_data_wrapper', node: 'foreign_data_wrapper', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Foreign Data Wrapper...') }}', + category: 'create', priority: 4, label: gettext('Foreign Data Wrapper...'), icon: 'wcTabIcon icon-foreign_data_wrapper', data: {action: 'create'} },{ name: 'create_foreign_data_wrapper', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Foreign Data Wrapper...') }}', + category: 'create', priority: 4, label: gettext('Foreign Data Wrapper...'), icon: 'wcTabIcon icon-foreign_data_wrapper', data: {action: 'create'}, enable: pgBrowser.Nodes['database'].is_conn_allow } @@ -119,7 +119,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Defining schema for the foreign data wrapper node schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', disabled: function(m) { // name field will be disabled only if edit mode and server version is below 9.2 @@ -130,28 +130,28 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return false; } },{ - id: 'fdwoid', label:'{{ _('OID') }}', cell: 'string', + id: 'fdwoid', label: gettext('OID'), cell: 'string', type: 'text', disabled: true, mode: ['properties'] },{ - id: 'fdwowner', label:'{{ _('Owner') }}', type: 'text', + id: 'fdwowner', label: gettext('Owner'), type: 'text', control: Backform.NodeListByNameControl, node: 'role', mode: ['edit', 'create', 'properties'], select2: { allowClear: false } },{ - id: 'fdwhan', label:'{{ _('Handler') }}', type: 'text', control: 'node-ajax-options', - group: '{{ _('Definition') }}', mode: ['edit', 'create', 'properties'], url:'get_handlers' + id: 'fdwhan', label: gettext('Handler'), type: 'text', control: 'node-ajax-options', + group: gettext('Definition'), mode: ['edit', 'create', 'properties'], url:'get_handlers' },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline' },{ - id: 'fdwoptions', label: 'Options', type: 'collection', group: '{{ _('Options') }}', + id: 'fdwoptions', label: 'Options', type: 'collection', group: gettext('Options'), model: OptionsModel, control: 'unique-col-collection', mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['fdwoption'], columns: ['fdwoption','fdwvalue'] },{ - id: 'fdwvalue', label:'{{ _('Validator') }}', type: 'text', control: 'node-ajax-options', - group: '{{ _('Definition') }}', mode: ['edit', 'create', 'properties'], url:'get_validators' + id: 'fdwvalue', label: gettext('Validator'), type: 'text', control: 'node-ajax-options', + group: gettext('Definition'), mode: ['edit', 'create', 'properties'], url:'get_validators' },{ - id: 'security', label: '{{ _("Security") }}', type: 'group' + id: 'security', label: gettext('Security'), type: 'group' },{ id: 'fdwacl', label: 'Privileges', type: 'collection', group: 'security', mode: ['edit', 'create'], canAdd: true, @@ -160,8 +160,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { privileges: ['U'] }), control: 'unique-col-collection' },{ - id: 'acl', label: '{{ _('Privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'acl', label: gettext('Privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true }], /* validate function is used to validate the input given by * the user. In case of error, message will be displayed on @@ -172,7 +172,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name cannot be empty.') }}'; + var msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; } else { diff --git a/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/js/languages.js b/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/js/languages.js index 4340b9ee3..f8f5ad6ae 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/js/languages.js +++ b/web/pgadmin/browser/server_groups/servers/databases/languages/templates/languages/js/languages.js @@ -1,14 +1,15 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', - 'alertify', 'pgadmin.browser.collection', 'pgadmin.browser.server.privilege'], - function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the browser's collection class for languages collection if (!pgBrowser.Nodes['coll-language']) { var languages = pgBrowser.Nodes['coll-language'] = pgBrowser.Collection.extend({ node: 'language', - label: '{{ _('Languages') }}', + label: gettext('Languages'), type: 'coll-language', columns: ['name', 'lanowner', 'description'] }); @@ -22,7 +23,7 @@ define( sqlAlterHelp: 'sql-alterlanguage.html', sqlCreateHelp: 'sql-createlanguage.html', dialogHelp: '{{ url_for('help.static', filename='language_dialog.html') }}', - label: '{{ _('Language') }}', + label: gettext('Language'), hasSQL: true, canDrop: true, canDropCascade: true, @@ -40,18 +41,18 @@ define( pgBrowser.add_menus([{ name: 'create_language_on_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Language...') }}', + category: 'create', priority: 4, label: gettext('Language...'), icon: 'wcTabIcon icon-language', data: {action: 'create'}, enable: pgBrowser.Nodes['database'].is_conn_allow },{ name: 'create_language_on_coll', node: 'coll-language', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Language...') }}', + category: 'create', priority: 4, label: gettext('Language...'), icon: 'wcTabIcon icon-language', data: {action: 'create'} },{ name: 'create_language', node: 'language', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Language...') }}', + category: 'create', priority: 4, label: gettext('Language...'), icon: 'wcTabIcon icon-language', data: {action: 'create'} }]); }, @@ -85,7 +86,7 @@ define( // Define the schema for the language node schema: [{ - id: 'name', label: '{{ _('Name') }}', type: 'text', + id: 'name', label: gettext('Name'), type: 'text', control: 'node-ajax-options', mode: ['properties', 'create', 'edit'], url:'get_templates', select2: { allowClear: false, tags: true, multiple: false }, transform: function(data, cell) { @@ -110,26 +111,26 @@ define( return res; } },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', mode: ['properties'], + id: 'oid', label: gettext('OID'), cell: 'string', mode: ['properties'], type: 'text', disabled: true },{ - id: 'lanowner', label:'{{ _('Owner') }}', type: 'text', + id: 'lanowner', label: gettext('Owner'), type: 'text', control: Backform.NodeListByNameControl, node: 'role', mode: ['edit', 'properties', 'create'], select2: { allowClear: false } },{ - id: 'acl', label: '{{ _('Privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'acl', label: gettext('Privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline' },{ - id: 'trusted', label:'{{ _('Trusted?') }}', type: 'switch', + id: 'trusted', label: gettext('Trusted?'), type: 'switch', options: { 'onText': 'Yes', 'offText': 'No', 'onColor': 'success', 'offColor': 'primary', 'size': 'small' }, - group: 'Definition', mode: ['edit', 'properties', 'create'], deps: ['name'], + group: gettext('Definition'), mode: ['edit', 'properties', 'create'], deps: ['name'], disabled: function(m) { if (m.isNew()) { if (m.get('template_list').indexOf(m.get('name')) == -1) { @@ -142,8 +143,8 @@ define( return true; } },{ - id: 'lanproc', label:'{{ _('Handler Function') }}', type: 'text', control: 'node-ajax-options', - group: 'Definition', mode: ['edit', 'properties', 'create'], url:'get_functions', + id: 'lanproc', label: gettext('Handler Function'), type: 'text', control: 'node-ajax-options', + group: gettext('Definition'), mode: ['edit', 'properties', 'create'], url:'get_functions', deps: ['name'], first_empty: false, /* This function is used to populate the handler function * for the selected language node. It will check if the property @@ -167,8 +168,8 @@ define( return true; } },{ - id: 'laninl', label:'{{ _('Inline Function') }}', type: 'text', control: 'node-ajax-options', - group: 'Definition', mode: ['edit', 'properties', 'create'], url:'get_functions', + id: 'laninl', label: gettext('Inline Function'), type: 'text', control: 'node-ajax-options', + group: gettext('Definition'), mode: ['edit', 'properties', 'create'], url:'get_functions', deps: ['name'], first_empty: false, /* This function is used to populate the inline function * for the selected language node. It will check if the property @@ -192,8 +193,8 @@ define( return true; } },{ - id: 'lanval', label:'{{ _('Validator Function') }}', type: 'text', control: 'node-ajax-options', - group: 'Definition', mode: ['edit', 'properties', 'create'], url:'get_functions', + id: 'lanval', label: gettext('Validator Function'), type: 'text', control: 'node-ajax-options', + group: gettext('Definition'), mode: ['edit', 'properties', 'create'], url:'get_functions', deps: ['name'], /* This function is used to populate the validator function * for the selected language node. It will check if the property @@ -217,13 +218,13 @@ define( return true; } }, pgBrowser.SecurityGroupUnderSchema, { - id: 'lanacl', label: '{{ _('Privileges') }}', type: 'collection', + id: 'lanacl', label: gettext('Privileges'), type: 'collection', group: 'security', control: 'unique-col-collection', mode: ['edit', 'create'], model: pgBrowser.Node.PrivilegeRoleModel.extend({ privileges: ['U'] }), canAdd: true, canDelete: true, uniqueCol : ['grantee'] },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', mode: ['edit', 'create'], + id: 'seclabels', label: gettext('Security Labels'), mode: ['edit', 'create'], model: pgBrowser.SecLabelModel, editable: false, type: 'collection', group: 'security', min_version: 90200, canAdd: true, canEdit: false, canDelete: true, @@ -239,7 +240,7 @@ define( if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name cannot be empty.') }}'; + var msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; } else { @@ -251,7 +252,7 @@ define( var handler_func = this.get('lanproc'); if (_.isUndefined(handler_func) || _.isNull(handler_func) || String(handler_func).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Handler Function cannot be empty') }}'; + var msg = gettext('Handler Function cannot be empty'); this.errorModel.set('lanproc', msg); return msg; } else { diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/templates/catalog_object_column/js/catalog_object_column.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/templates/catalog_object_column/js/catalog_object_column.js index 88b0be512..9aba61541 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/templates/catalog_object_column/js/catalog_object_column.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/templates/catalog_object_column/js/catalog_object_column.js @@ -1,12 +1,13 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-catalog_object_column']) { var databases = pgAdmin.Browser.Nodes['coll-catalog_object_column'] = pgAdmin.Browser.Collection.extend({ node: 'catalog_object_column', - label: '{{ _('catalog_object_column') }}', + label: gettext('catalog_object_column'), type: 'coll-catalog_object_column', columns: ['attname', 'attnum', 'cltype', 'description'] }); @@ -17,7 +18,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgAdmin.Browser.Node.extend({ parent_type: 'catalog_object', type: 'catalog_object_column', - label: '{{ _('catalog_object_column') }}', + label: gettext('catalog_object_column'), hasSQL: false, hasScriptTypes: [], hasDepends: true, @@ -41,25 +42,25 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { description: undefined }, schema: [{ - id: 'attname', label: '{{ _('Column') }}', cell: 'string', + id: 'attname', label: gettext('Column'), cell: 'string', type: 'text', disabled: true },{ - id: 'attowner', label: '{{ _('Owner') }}', cell: 'string', + id: 'attowner', label: gettext('Owner'), cell: 'string', type: 'text', disabled: true },{ - id: 'attnum', label:'{{ _('Position') }}', cell: 'string', + id: 'attnum', label: gettext('Position'), cell: 'string', type: 'text', disabled: true },{ - id: 'cltype', label:'{{ _('Data type') }}', cell: 'string', - group: '{{ _('Definition') }}', type: 'text', disabled: true + id: 'cltype', label: gettext('Data type'), cell: 'string', + group: gettext('Definition'), type: 'text', disabled: true },{ - id: 'collspcname', label:'{{ _('Collation') }}', cell: 'string', - group: '{{ _('Definition') }}', type: 'text', disabled: true + id: 'collspcname', label: gettext('Collation'), cell: 'string', + group: gettext('Definition'), type: 'text', disabled: true },{ - id: 'attacl', label:'{{ _('Privileges') }}', cell: 'string', - group: '{{ _('Security') }}', type: 'text', disabled: true + id: 'attacl', label: gettext('Privileges'), cell: 'string', + group: gettext('Security'), type: 'text', disabled: true },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', disabled: true }] }) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/js/catalog_object.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/js/catalog_object.js index 9e361c6dd..e5a70c4c8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/js/catalog_object.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/templates/catalog_object/js/catalog_object.js @@ -1,12 +1,13 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-catalog_object']) { var databases = pgAdmin.Browser.Nodes['coll-catalog_object'] = pgAdmin.Browser.Collection.extend({ node: 'catalog_object', - label: '{{ _('Catalog Objects') }}', + label: gettext('Catalog Objects'), type: 'coll-catalog_object', columns: ['name', 'owner', 'description'] }); @@ -16,7 +17,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgAdmin.Browser.Nodes['catalog_object'] = pgAdmin.Browser.Node.extend({ parent_type: 'catalog', type: 'catalog_object', - label: '{{ _('Catalog Object') }}', + label: gettext('Catalog Object'), hasSQL: false, hasScriptTypes: [], hasDepends: true, @@ -36,16 +37,16 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { description: undefined, }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', disabled: true },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text', disabled: true },{ - id: 'owner', label:'{{ _('Owner') }}', cell: 'string', + id: 'owner', label: gettext('Owner'), cell: 'string', type: 'text', disabled: true },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline' , disabled: true } ] diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js index 119dae0c3..27cfc7a3f 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/collations/templates/collation/js/collation.js @@ -1,12 +1,13 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-collation']) { var databases = pgAdmin.Browser.Nodes['coll-collation'] = pgAdmin.Browser.Collection.extend({ node: 'collation', - label: '{{ _('Collations') }}', + label: gettext('Collations'), type: 'coll-collation', columns: ['name', 'owner', 'description'] }); @@ -18,7 +19,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'sql-altercollation.html', sqlCreateHelp: 'sql-createcollation.html', dialogHelp: '{{ url_for('help.static', filename='collation_dialog.html') }}', - label: '{{ _('Collation') }}', + label: gettext('Collation'), collection_type: 'coll-collation', hasSQL: true, hasDepends: true, @@ -33,19 +34,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_collation_on_coll', node: 'coll-collation', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Collation...') }}', + category: 'create', priority: 4, label: gettext('Collation...'), icon: 'wcTabIcon icon-collation', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_collation', node: 'collation', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Collation...') }}', + category: 'create', priority: 4, label: gettext('Collation...'), icon: 'wcTabIcon icon-collation', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_collation', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Collation...') }}', + category: 'create', priority: 4, label: gettext('Collation...'), icon: 'wcTabIcon icon-collation', data: {action: 'create', check: false}, enable: 'canCreate' } @@ -79,19 +80,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'inSchema' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'owner', label:'{{ _('Owner') }}', cell: 'string', + id: 'owner', label: gettext('Owner'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'inSchema', control: 'node-list-by-name', node: 'role' },{ - id: 'schema', label:'{{ _('Schema') }}', cell: 'string', + id: 'schema', label: gettext('Schema'), cell: 'string', type: 'text', mode: ['create', 'edit'], node: 'schema', disabled: 'inSchema', filter: function(d) { // If schema name start with pg_* then we need to exclude them @@ -103,27 +104,27 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, control: 'node-list-by-name', cache_node: 'database', cached_level: 'database' },{ - id: 'copy_collation', label:'{{ _('Copy collation') }}', cell: 'string', + id: 'copy_collation', label: gettext('Copy collation'), cell: 'string', control: 'node-ajax-options', - type: 'text', mode: ['create', 'edit'], group: 'Definition', + type: 'text', mode: ['create', 'edit'], group: gettext('Definition'), url: 'get_collations', disabled: 'inSchemaWithModelCheck', deps: ['locale', 'lc_collate', 'lc_type'] },{ - id: 'locale', label:'{{ _('Locale') }}', cell: 'string', - type: 'text', mode: ['create', 'edit'], group: 'Definition', + id: 'locale', label: gettext('Locale'), cell: 'string', + type: 'text', mode: ['create', 'edit'], group: gettext('Definition'), disabled: 'inSchemaWithModelCheck', deps: ['lc_collate', 'lc_type', 'copy_collation'] },{ - id: 'lc_collate', label:'{{ _('LC_COLLATE') }}', cell: 'string', - type: 'text', mode: ['properties', 'create', 'edit'], group: 'Definition', + id: 'lc_collate', label: gettext('LC_COLLATE'), cell: 'string', + type: 'text', mode: ['properties', 'create', 'edit'], group: gettext('Definition'), deps: ['locale', 'copy_collation'], disabled: 'inSchemaWithModelCheck' },{ - id: 'lc_type', label:'{{ _('LC_TYPE') }}', cell: 'string', - type: 'text', mode: ['properties', 'create', 'edit'], group: 'Definition', + id: 'lc_type', label: gettext('LC_TYPE'), cell: 'string', + type: 'text', mode: ['properties', 'create', 'edit'], group: gettext('Definition'), disabled: 'inSchemaWithModelCheck', deps: ['locale', 'copy_collation'] },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', mode: ['properties', 'create', 'edit'], disabled: 'inSchema' } @@ -143,7 +144,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.has(changedAttrs,data.name) && _.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Name cannot be empty.') }}'; + msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); } if (_.has(changedAttrs,data.locale) && (_.isUndefined(this.get('locale')) @@ -163,7 +164,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { copy_coll_flag = true; } if (locale_flag && (lc_coll_flag || lc_coll_flag) && copy_coll_flag) { - msg = '{{ _('Definition incomplete, Please provide Locale OR Copy collation OR LC_TYPE/LC_COLLATE!') }}'; + msg = gettext('Definition incomplete, Please provide Locale OR Copy collation OR LC_TYPE/LC_COLLATE!'); err['locale'] = msg } return null; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/templates/domain_constraints/js/domain_constraints.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/templates/domain_constraints/js/domain_constraints.js index ea71170b6..371899b9d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/templates/domain_constraints/js/domain_constraints.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/domain_constraints/templates/domain_constraints/js/domain_constraints.js @@ -1,14 +1,15 @@ // Domain Constraint Module: Collection and Node -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Define Domain Constraint Collection Node if (!pgBrowser.Nodes['coll-domain_constraints']) { var domain_constraints = pgAdmin.Browser.Nodes['coll-domain_constraints'] = pgAdmin.Browser.Collection.extend({ node: 'domain_constraints', - label: '{{ _('Domain Constraints') }}', + label: gettext('Domain Constraints'), type: 'coll-domain_constraints', columns: ['name', 'description'] }); @@ -21,7 +22,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'sql-alterdomain.html', sqlCreateHelp: 'sql-alterdomain.html', dialogHelp: '{{ url_for('help.static', filename='domain_constraint_dialog.html') }}', - label: '{{ _('Domain Constraints') }}', + label: gettext('Domain Constraints'), collection_type: 'coll-domain_constraints', hasSQL: true, hasDepends: true, @@ -36,19 +37,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_domain_on_coll', node: 'coll-domain_constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 5, label: '{{ _('Domain Constraint...') }}', + category: 'create', priority: 5, label: gettext('Domain Constraint...'), icon: 'wcTabIcon icon-domain_constraints', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_domain_constraints', node: 'domain_constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 5, label: '{{ _('Domain Constraint...') }}', + category: 'create', priority: 5, label: gettext('Domain Constraint...'), icon: 'wcTabIcon icon-domain_constraints', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_domain_constraints', node: 'domain', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 5, label: '{{ _('Domain Constraint...') }}', + category: 'create', priority: 5, label: gettext('Domain Constraint...'), icon: 'wcTabIcon icon-domain_constraints', data: {action: 'create', check: false}, enable: 'canCreate' } @@ -67,26 +68,26 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, // Domain Constraint Schema schema: [{ - id: 'name', label: '{{ _('Name') }}', type:'text', cell:'string', + id: 'name', label: gettext('Name'), type:'text', cell:'string', disabled: 'isDisabled' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'description', label: '{{ _('Comment') }}', type: 'multiline', cell: + id: 'description', label: gettext('Comment'), type: 'multiline', cell: 'string', mode: ['properties', 'create', 'edit'], min_version: 90500, },{ - id: 'consrc', label: '{{ _('Check') }}', type: 'multiline', cel: - 'string', group: '{{ _('Definition') }}', mode: ['properties', + id: 'consrc', label: gettext('Check'), type: 'multiline', cel: + 'string', group: gettext('Definition'), mode: ['properties', 'create', 'edit'], disabled: function(m) { return !m.isNew(); } },{ - id: 'connoinherit', label: '{{ _('No inherit') }}', type: - 'switch', cell: 'boolean', group: '{{ _('Definition') }}', mode: + id: 'connoinherit', label: gettext('No inherit'), type: + 'switch', cell: 'boolean', group: gettext('Definition'), mode: ['properties', 'create', 'edit'], disabled: 'isDisabled', visible: false },{ - id: 'convalidated', label: "{{ _("Validate?") }}", type: 'switch', cell: - 'boolean', group: '{{ _('Definition') }}', min_version: 90200, + id: 'convalidated', label: gettext("Validate?"), type: 'switch', cell: + 'boolean', group: gettext('Definition'), min_version: 90200, disabled: function(m) { if (!m.isNew()) { var server = this.node_info.server; @@ -107,12 +108,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { errmsg; if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _('Name cannot be empty.') }}'; + err['name'] = gettext('Name cannot be empty.'); errmsg = errmsg || err['name']; } if (_.isUndefined(this.get('consrc')) || String(this.get('consrc')).replace(/^\s+|\s+$/g, '') == '') { - err['consrc'] = '{{ _('Check cannot be empty.') }}'; + err['consrc'] = gettext('Check cannot be empty.'); errmsg = errmsg || err['consrc']; } @@ -137,8 +138,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return false; } }), - }); - + }); } return pgBrowser.Nodes['domain']; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js index 7d1e8fe3f..ed1d69fbf 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js @@ -1,15 +1,15 @@ // Domain Module: Collection and Node. -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Define Domain Collection Node if (!pgBrowser.Nodes['coll-domain']) { var domains = pgBrowser.Nodes['coll-domain'] = pgBrowser.Collection.extend({ node: 'domain', - label: '{{ _('Domains') }}', + label: gettext('Domains'), type: 'coll-domain', columns: ['name', 'owner', 'description'] }); @@ -42,7 +42,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { schema: [{ id: 'conoid', type: 'text', cell: 'string', visible: false },{ - id: 'conname', label: '{{ _('Name') }}', type: 'text', cell: 'string', + id: 'conname', label: gettext('Name'), type: 'text', cell: 'string', cellHeaderClasses: 'width_percent_40', editable: function(m) { if (_.isUndefined(m.isNew)) { return true; } @@ -54,14 +54,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return true; } },{ - id: 'consrc', label: '{{ _('Check') }}', type: 'multiline', - cell: Backgrid.Extension.TextareaCell, group: '{{ _('Definition') }}', + id: 'consrc', label: gettext('Check'), type: 'multiline', + cell: Backgrid.Extension.TextareaCell, group: gettext('Definition'), cellHeaderClasses: 'width_percent_60', editable: function(m) { return _.isUndefined(m.isNew) ? true : m.isNew(); } },{ - id: 'convalidated', label: '{{ _('Validate?') }}', type: 'switch', cell: - 'boolean', group: '{{ _('Definition') }}', + id: 'convalidated', label: gettext('Validate?'), type: 'switch', cell: + 'boolean', group: gettext('Definition'), editable: function(m) { var server = this.get('node_info').server; if (server.version < 90200) { return false; @@ -89,7 +89,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'sql-alterdomain.html', sqlCreateHelp: 'sql-createdomain.html', dialogHelp: '{{ url_for('help.static', filename='domain_dialog.html') }}', - label: '{{ _('Domain') }}', + label: gettext('Domain'), collection_type: 'coll-domain', hasSQL: true, hasDepends: true, @@ -104,19 +104,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_domain_on_coll', node: 'coll-domain', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Domain...') }}', + category: 'create', priority: 4, label: gettext('Domain...'), icon: 'wcTabIcon icon-domain', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_domain', node: 'domain', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Domain...') }}', + category: 'create', priority: 4, label: gettext('Domain...'), icon: 'wcTabIcon icon-domain', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_domain', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Domain...') }}', + category: 'create', priority: 4, label: gettext('Domain...'), icon: 'wcTabIcon icon-domain', data: {action: 'create', check: false}, enable: 'canCreate' } @@ -159,20 +159,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { type_options: undefined, // Domain Schema schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'] },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'owner', label:'{{ _('Owner') }}', cell: 'string', control: Backform.NodeListByNameControl, + id: 'owner', label: gettext('Owner'), cell: 'string', control: Backform.NodeListByNameControl, node: 'role', type: 'text', mode: ['edit', 'create', 'properties'] },{ - id: 'basensp', label:'{{ _('Schema') }}', cell: 'node-list-by-name', + id: 'basensp', label: gettext('Schema'), cell: 'node-list-by-name', control: 'node-list-by-name', cache_level: 'database', type: 'text', node: 'schema', mode: ['create', 'edit'] },{ - id: 'sysdomain', label:'{{ _('System domain?') }}', cell: 'boolean', + id: 'sysdomain', label: gettext('System domain?'), cell: 'boolean', type: 'switch', mode: ['properties'], options: { 'onText': 'Yes', 'offText': 'No', @@ -180,12 +180,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { 'size': 'small' } },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline' },{ - id: 'basetype', label:'{{ _('Base type') }}', cell: 'string', + id: 'basetype', label: gettext('Base type'), cell: 'string', control: 'node-ajax-options', type: 'text', url: 'get_types', - mode:['properties', 'create', 'edit'], group: '{{ _('Definition') }}', + mode:['properties', 'create', 'edit'], group: gettext('Definition'), cache_level: 'database', cache_node: 'schema', disabled: function(m) { return !m.isNew(); }, first_empty: true, transform: function(d) { @@ -193,8 +193,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return d; } },{ - id: 'typlen', label:'{{ _('Length') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', deps: ['basetype'], + id: 'typlen', label: gettext('Length'), cell: 'string', + type: 'text', group: gettext('Definition'), deps: ['basetype'], disabled: function(m) { // We will store type from selected from combobox if (!m.isNew()) { @@ -220,8 +220,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return !m.get('is_tlength'); } },{ - id: 'precision', label:'{{ _('Precision') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', deps: ['basetype'], + id: 'precision', label: gettext('Precision'), cell: 'string', + type: 'text', group: gettext('Definition'), deps: ['basetype'], disabled: function(m) { // We will store type from selected from combobox if (!m.isNew()) { @@ -247,33 +247,33 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return !m.get('is_precision'); } },{ - id: 'typdefault', label:'{{ _('Default') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', + id: 'typdefault', label: gettext('Default'), cell: 'string', + type: 'text', group: gettext('Definition'), placeholder: "Enter an expression or a value." },{ - id: 'typnotnull', label:'{{ _('Not Null?') }}', cell: 'boolean', - type: 'switch', group: '{{ _('Definition') }}', + id: 'typnotnull', label: gettext('Not Null?'), cell: 'boolean', + type: 'switch', group: gettext('Definition'), options: { 'onText': 'Yes', 'offText': 'No', 'onColor': 'success', 'offColor': 'primary', 'size': 'small' } },{ - id: 'collname', label:'{{ _('Collation') }}', cell: 'string', + id: 'collname', label: gettext('Collation'), cell: 'string', control: 'node-ajax-options', type: 'text', url: 'get_collations', - group: '{{ _('Definition') }}', cache_level: 'database', + group: gettext('Definition'), cache_level: 'database', cache_node: 'schema', disabled: function(m) { return !m.isNew(); } },{ - id: 'constraints', label:'{{ _('Constraints') }}', cell: 'string', - type: 'collection', group: '{{ _('Constraints') }}', mode: ['edit', 'create'], + id: 'constraints', label: gettext('Constraints'), cell: 'string', + type: 'collection', group: gettext('Constraints'), mode: ['edit', 'create'], model: ConstraintModel, canAdd: true, canDelete: true, canEdit: false, columns: ['conname','consrc', 'convalidated'] }, pgBrowser.SecurityGroupUnderSchema, { - id: 'seclabels', label: '{{ _('Security Labels') }}', + id: 'seclabels', label: gettext('Security Labels'), model: pgBrowser.SecLabelModel, type: 'collection', group: 'security', mode: ['edit', 'create'], min_version: 90100, canAdd: true, @@ -286,12 +286,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { seclabels = this.get('seclabels'); if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _('Name cannot be empty.') }}'; + err['name'] = gettext('Name cannot be empty.'); errmsg = errmsg || err['name']; } if (_.isUndefined(this.get('basetype')) || String(this.get('basetype')).replace(/^\s+|\s+$/g, '') == '') { - err['basetype'] = '{{ _('Base Type cannot be empty.') }}'; + err['basetype'] = gettext('Base Type cannot be empty.'); errmsg = errmsg || err['basetype']; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js index ac8ce5d74..b23997015 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js @@ -1,13 +1,14 @@ /* Create and Register Foreign Table Collection and Node. */ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-foreign-table']) { var foreigntable = pgBrowser.Nodes['coll-foreign-table'] = pgBrowser.Collection.extend({ node: 'foreign-table', - label: '{{ _('Foreign Tables') }}', + label: gettext('Foreign Tables'), type: 'coll-foreign-table', columns: ['name', 'owner', 'description'] }); @@ -85,20 +86,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, type_options: undefined, schema: [{ - id: 'attname', label:'{{ _('Name') }}', cell: 'string', type: 'text', + id: 'attname', label: gettext('Name'), cell: 'string', type: 'text', editable: 'is_editable_column', cellHeaderClasses: 'width_percent_40' },{ - id: 'datatype', label:'{{ _('Data Type') }}', cell: 'node-ajax-options', + id: 'datatype', label: gettext('Data Type'), cell: 'node-ajax-options', control: 'node-ajax-options', type: 'text', url: 'get_types', editable: 'is_editable_column', cellHeaderClasses: 'width_percent_0', - group: '{{ _('Definition') }}', + group: gettext('Definition'), transform: function(d, self){ self.model.type_options = d; return d; } },{ - id: 'typlen', label:'{{ _('Length') }}', - cell: 'string', group: '{{ _('Definition') }}', + id: 'typlen', label: gettext('Length'), + cell: 'string', group: gettext('Definition'), type: 'int', deps: ['datatype'], disabled: function(m) { // We will store type from selected from combobox @@ -132,9 +133,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, cellHeaderClasses: 'width_percent_10' },{ - id: 'precision', label:'{{ _('Precision') }}', + id: 'precision', label: gettext('Precision'), type: 'int', deps: ['datatype'], - cell: 'string', group: '{{ _('Definition') }}', + cell: 'string', group: gettext('Definition'), disabled: function(m) { if(!(_.isUndefined(m.get('inheritedid')) || _.isNull(m.get('inheritedid')) @@ -164,8 +165,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return true; }, cellHeaderClasses: 'width_percent_10' },{ - id: 'typdefault', label:'{{ _('Default') }}', type: 'text', - cell: 'string', min_version: 90300, group: '{{ _('Definition') }}', + id: 'typdefault', label: gettext('Default'), type: 'text', + cell: 'string', min_version: 90300, group: gettext('Definition'), placeholder: "Enter an expression or a value.", cellHeaderClasses: 'width_percent_10', editable: function(m) { @@ -179,12 +180,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return true; } },{ - id: 'attnotnull', label:'{{ _('Not Null') }}', + id: 'attnotnull', label: gettext('Not Null'), cell: 'boolean',type: 'switch', editable: 'is_editable_column', - cellHeaderClasses: 'width_percent_10', group: '{{ _('Definition') }}' + cellHeaderClasses: 'width_percent_10', group: gettext('Definition') },{ - id: 'attstattarget', label:'{{ _('Statistics') }}', min_version: 90200, - cell: 'integer', type: 'int', group: '{{ _('Definition') }}', + id: 'attstattarget', label: gettext('Statistics'), min_version: 90200, + cell: 'integer', type: 'int', group: gettext('Definition'), editable: function(m) { if (_.isUndefined(m.isNew) || m.isNew()) { return false; } if (this.get('node_info').server.version < 90200){ @@ -194,23 +195,23 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { || _.isUndefined(m.get('inheritedfrom')) || _.isNull(m.get('inheritedfrom'))) ? true : false }, cellHeaderClasses: 'width_percent_10' },{ - id: 'collname', label:'{{ _('Collation') }}', cell: 'node-ajax-options', + id: 'collname', label: gettext('Collation'), cell: 'node-ajax-options', control: 'node-ajax-options', type: 'text', url: 'get_collations', min_version: 90300, editable: function(m) { if (!(_.isUndefined(m.isNew)) && !m.isNew()) { return false; } return (_.isUndefined(m.get('inheritedid')) || _.isNull(m.get('inheritedid')) || _.isUndefined(m.get('inheritedfrom')) || _.isNull(m.get('inheritedfrom'))) ? true : false }, - cellHeaderClasses: 'width_percent_20', group: '{{ _('Definition') }}' + cellHeaderClasses: 'width_percent_20', group: gettext('Definition') },{ id: 'attnum', cell: 'string',type: 'text', visible: false },{ - id: 'inheritedfrom', label:'{{ _('Inherited From') }}', cell: 'string', + id: 'inheritedfrom', label: gettext('Inherited From'), cell: 'string', type: 'text', visible: false, mode: ['properties', 'edit'], cellHeaderClasses: 'width_percent_10' },{ - id: 'coloptions', label:'{{ _('Options') }}', cell: 'string', - type: 'collection', group: 'Options', mode: ['edit', 'create'], + id: 'coloptions', label: gettext('Options'), cell: 'string', + type: 'collection', group: gettext('Options'), mode: ['edit', 'create'], model: ColumnOptionsModel, canAdd: true, canDelete: true, canEdit: false, control: Backform.UniqueColCollectionControl, uniqueCol : ['option'], min_version: 90200 @@ -220,13 +221,13 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { errmsg; if (_.isUndefined(this.get('attname')) || String(this.get('attname')).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _('Column Name cannot be empty!') }}'; + err['name'] = gettext('Column Name cannot be empty!'); errmsg = errmsg || err['attname']; } if (_.isUndefined(this.get('datatype')) || String(this.get('datatype')) .replace(/^\s+|\s+$/g, '') == '') { - err['basensp'] = '{{ _('Column Datatype cannot be empty!') }}'; + err['basensp'] = gettext('Column Datatype cannot be empty!'); errmsg = errmsg || err['datatype']; } @@ -372,18 +373,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { schema: [{ id: 'conoid', type: 'text', cell: 'string', visible: false },{ - id: 'conname', label:'{{ _('Name') }}', type: 'text', cell: 'string', + id: 'conname', label: gettext('Name'), type: 'text', cell: 'string', editable: 'is_editable', cellHeaderClasses: 'width_percent_30' },{ - id: 'consrc', label:'{{ _('Check') }}', type: 'multiline', + id: 'consrc', label: gettext('Check'), type: 'multiline', editable: 'is_editable', cell: Backgrid.Extension.TextareaCell, cellHeaderClasses: 'width_percent_30' },{ - id: 'connoinherit', label:'{{ _('No Inherit') }}', type: 'switch', + id: 'connoinherit', label: gettext('No Inherit'), type: 'switch', cell: 'boolean', editable: 'is_editable', cellHeaderClasses: 'width_percent_20' },{ - id: 'convalidated', label:'{{ _('Validate?') }}', type: 'switch', + id: 'convalidated', label: gettext('Validate?'), type: 'switch', cell: 'boolean', cellHeaderClasses: 'width_percent_20', editable: function(m) { var server = this.get('node_info').server; @@ -403,13 +404,13 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { errmsg; if (_.isUndefined(this.get('conname')) || String(this.get('conname')).replace(/^\s+|\s+$/g, '') == '') { - err['conname'] = '{{ _('Constraint Name cannot be empty!') }}'; + err['conname'] = gettext('Constraint Name cannot be empty!'); errmsg = errmsg || err['conname']; } if (_.isUndefined(this.get('consrc')) || String(this.get('consrc')) .replace(/^\s+|\s+$/g, '') == '') { - err['consrc'] = '{{ _('Constraint Check cannot be empty!') }}'; + err['consrc'] = gettext('Constraint Check cannot be empty!'); errmsg = errmsg || err['consrc']; } @@ -431,10 +432,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { value: undefined }, schema: [{ - id: 'option', label:'{{ _('Option') }}', cell: 'string', type: 'text', + id: 'option', label: gettext('Option'), cell: 'string', type: 'text', editable: true, cellHeaderClasses:'width_percent_50' },{ - id: 'value', label:'{{ _('Value') }}', cell: 'string',type: 'text', + id: 'value', label: gettext('Value'), cell: 'string',type: 'text', editable: true, cellHeaderClasses:'width_percent_50' } ], @@ -451,7 +452,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'sql-alterforeigntable.html', sqlCreateHelp: 'sql-createforeigntable.html', dialogHelp: '{{ url_for('help.static', filename='foreign_table_dialog.html') }}', - label: '{{ _('Foreign Table') }}', + label: gettext('Foreign Table'), collection_type: 'coll-foreign-table', hasSQL: true, hasDepends: true, @@ -467,19 +468,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_foreign-table_on_coll', node: 'coll-foreign-table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Foreign Table...') }}', + category: 'create', priority: 4, label: gettext('Foreign Table...'), icon: 'wcTabIcon icon-foreign-table', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_foreign-table', node: 'foreign-table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Foreign Table...') }}', + category: 'create', priority: 4, label: gettext('Foreign Table...'), icon: 'wcTabIcon icon-foreign-table', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_foreign-table', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Foreign Table...') }}', + category: 'create', priority: 4, label: gettext('Foreign Table...'), icon: 'wcTabIcon icon-foreign-table', data: {action: 'create', check: false}, enable: 'canCreate' } @@ -519,27 +520,27 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { seclabels: [] }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'] },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'owner', label:'{{ _('Owner') }}', cell: 'string', + id: 'owner', label: gettext('Owner'), cell: 'string', control: Backform.NodeListByNameControl, node: 'role', type: 'text', select2: { allowClear: false } },{ - id: 'basensp', label:'{{ _('Schema') }}', cell: 'node-list-by-name', + id: 'basensp', label: gettext('Schema'), cell: 'node-list-by-name', control: 'node-list-by-name', cache_level: 'database', type: 'text', node: 'schema', mode:['create', 'edit'] },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline' },{ - id: 'ftsrvname', label:'{{ _('Foreign server') }}', cell: 'string', control: 'node-ajax-options', - type: 'text', group: 'Definition', url: 'get_foreign_servers', disabled: function(m) { return !m.isNew(); } + id: 'ftsrvname', label: gettext('Foreign server'), cell: 'string', control: 'node-ajax-options', + type: 'text', group: gettext('Definition'), url: 'get_foreign_servers', disabled: function(m) { return !m.isNew(); } },{ - id: 'inherits', label:'{{ _('Inherits') }}', group: 'Definition', + id: 'inherits', label: gettext('Inherits'), group: gettext('Definition'), type: 'array', min_version: 90500, control: NodeAjaxOptionsMultipleControl, url: 'get_tables', select2: {multiple: true}, 'cache_level': 'database', @@ -554,8 +555,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return d; } },{ - id: 'columns', label:'{{ _('Columns') }}', cell: 'string', - type: 'collection', group: 'Columns', visible: false, mode: ['edit', 'create'], + id: 'columns', label: gettext('Columns'), cell: 'string', + type: 'collection', group: gettext('Columns'), visible: false, mode: ['edit', 'create'], model: ColumnsModel, canAdd: true, canDelete: true, canEdit: true, columns: ['attname', 'datatype', 'inheritedfrom'], canDeleteRow: function(m) { @@ -568,8 +569,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } }, { - id: 'constraints', label:'{{ _('Constraints') }}', cell: 'string', - type: 'collection', group: 'Constraints', visible: false, mode: ['edit', 'create'], + id: 'constraints', label: gettext('Constraints'), cell: 'string', + type: 'collection', group: gettext('Constraints'), visible: false, mode: ['edit', 'create'], model: ConstraintModel, canAdd: true, canDelete: true, columns: ['conname','consrc', 'connoinherit', 'convalidated'], canEdit: function(o) { if (o instanceof Backbone.Model) { @@ -582,19 +583,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return (m.get('conislocal') == true || _.isUndefined(m.get('conislocal'))) ? true : false } },{ - id: 'strftoptions', label:'{{ _('Options') }}', cell: 'string', - type: 'text', group: 'Definition', mode: ['properties'] + id: 'strftoptions', label: gettext('Options'), cell: 'string', + type: 'text', group: gettext('Definition'), mode: ['properties'] },{ - id: 'ftoptions', label:'{{ _('Options') }}', cell: 'string', - type: 'collection', group: 'Options', mode: ['edit', 'create'], + id: 'ftoptions', label: gettext('Options'), cell: 'string', + type: 'collection', group: gettext('Options'), mode: ['edit', 'create'], model: OptionsModel, canAdd: true, canDelete: true, canEdit: false, control: 'unique-col-collection', uniqueCol : ['option'] },{ - id: 'relacl', label: '{{ _('Privileges') }}', cell: 'string', - type: 'text', group: '{{ _('Security') }}', + id: 'relacl', label: gettext('Privileges'), cell: 'string', + type: 'text', group: gettext('Security'), mode: ['properties'], min_version: 90200 }, pgBrowser.SecurityGroupUnderSchema, { - id: 'acl', label: '{{ _('Privileges') }}', model: pgAdmin + id: 'acl', label: gettext('Privileges'), model: pgAdmin .Browser.Node.PrivilegeRoleModel.extend( {privileges: ['a','r','w','x']}), uniqueCol : ['grantee', 'grantor'], editable: false, type: 'collection', group: 'security', @@ -602,7 +603,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { canAdd: true, canDelete: true, control: 'unique-col-collection', min_version: 90200 },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', + id: 'seclabels', label: gettext('Security Labels'), model: pgBrowser.SecLabelModel, type: 'collection', group: 'security', mode: ['edit', 'create'], min_version: 90100, canAdd: true, @@ -617,18 +618,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { seclabels = this.get('seclabels'); if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _('Name cannot be empty.') }}'; + err['name'] = gettext('Name cannot be empty.'); errmsg = errmsg || err['name']; } if (_.isUndefined(this.get('basensp')) || String(this.get('basensp')) .replace(/^\s+|\s+$/g, '') == '') { - err['basensp'] = '{{ _('Schema cannot be empty.') }}'; + err['basensp'] = gettext('Schema cannot be empty.'); errmsg = errmsg || err['basensp']; } if (_.isUndefined(this.get('ftsrvname')) || String(this.get('ftsrvname')).replace(/^\s+|\s+$/g, '') == '') { - err['ftsrvname'] = '{{ _('Foreign server cannot be empty.') }}'; + err['ftsrvname'] = gettext('Foreign server cannot be empty.'); errmsg = errmsg || err['ftsrvname']; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/templates/fts_configuration/js/fts_configuration.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/templates/fts_configuration/js/fts_configuration.js index 33719120a..ff1d4b4e4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/templates/fts_configuration/js/fts_configuration.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_configurations/templates/fts_configuration/js/fts_configuration.js @@ -1,10 +1,9 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { - -// Model for tokens control + // Model for tokens control var TokenModel = pgAdmin.Browser.Node.Model.extend({ defaults: { token: undefined, @@ -32,7 +31,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isNull(token) || _.isUndefined(token) || String(token).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Token cannot be empty!') }}'; + msg = gettext('Token cannot be empty!'); this.errorModel.set('token',msg); return msg; } @@ -40,7 +39,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isNull(dictionary) || _.isUndefined(dictionary) || String(dictionary).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Dictionary name cannot be empty!') }}'; + msg = gettext('Dictionary name cannot be empty!'); this.errorModel.set('dictname',msg); return msg; } @@ -147,7 +146,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Select2 control for adding new tokens select2: { allowClear: true, width: 'style', - placeholder: '{{ _('Select token') }}' + placeholder: gettext('Select token') }, first_empty: true, disabled: function(m) { @@ -208,7 +207,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { '',].join("\n") _.extend(data, { - token_label: '{{ _('Tokens') }}' + token_label: gettext('Tokens') }); var self = this, @@ -403,7 +402,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { var fts_configurations = pgAdmin.Browser.Nodes['coll-fts_configuration'] = pgAdmin.Browser.Collection.extend({ node: 'fts_configuration', - label: '{{ _('FTS Configurations') }}', + label: gettext('FTS Configurations'), type: 'coll-fts_configuration', columns: ['name', 'description'] }); @@ -419,7 +418,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { dialogHelp: '{{ url_for('help.static', filename='fts_configuration_dialog.html') }}', canDrop: true, canDropCascade: true, - label: '{{ _('FTS Configuration') }}', + label: gettext('FTS Configuration'), hasSQL: true, hasDepends: true, Init: function() { @@ -435,20 +434,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { name: 'create_fts_configuration_on_schema', node: 'schema', module: this, category: 'create', priority: 4, applies: ['object', 'context'], callback: 'show_obj_properties', - label: '{{_('FTS Configuration...')}}', + label: gettext('FTS Configuration...'), icon: 'wcTabIcon icon-fts_configuration', data: {action: 'create'}, enable: 'canCreate' },{ name: 'create_fts_configuration_on_coll', module: this, priority: 4, node: 'coll-fts_configuration', applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', - label: '{{ _('FTS Configuration...') }}', data: {action: 'create'}, + label: gettext('FTS Configuration...'), data: {action: 'create'}, icon: 'wcTabIcon icon-fts_configuration', enable: 'canCreate' },{ name: 'create_fts_configuration', node: 'fts_configuration', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 4, - label: '{{_('FTS Configuration...')}}', data: {action: 'create'}, + label: gettext('FTS Configuration...'), data: {action: 'create'}, icon: 'wcTabIcon icon-fts_configuration', enable: 'canCreate' }]); }, @@ -478,27 +477,27 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, // Defining schema for FTS Configuration schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', cellHeaderClasses: 'width_percent_50' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', editable: false, type: 'text', disabled: true, mode:['properties'] },{ - id: 'owner', label:'{{ _('Owner') }}', cell: 'string', + id: 'owner', label: gettext('Owner'), cell: 'string', type: 'text', mode: ['properties', 'edit','create'], node: 'role', control: Backform.NodeListByNameControl, select2: { allowClear: false } },{ - id: 'schema', label: '{{ _('Schema')}}', cell: 'string', + id: 'schema', label: gettext('Schema'), cell: 'string', type: 'text', mode: ['create','edit'], node: 'schema', control: 'node-list-by-id', cache_node: 'database', cache_level: 'database' },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', cellHeaderClasses: 'width_percent_50' },{ - id: 'prsname', label: '{{ _('Parser')}}',type: 'text', + id: 'prsname', label: gettext('Parser'),type: 'text', url: 'parsers', first_empty: true, - group: '{{ _('Definition') }}', control: 'node-ajax-options', + group: gettext('Definition'), control: 'node-ajax-options', deps: ['copy_config'], //disable parser when user select copy_config manually and vica-versa disabled: function(m) { @@ -509,8 +508,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { copy_config === '') ? false : true; } },{ - id: 'copy_config', label: '{{ _('Copy Config')}}',type: 'text', - mode: ['create'], group: '{{ _('Definition') }}', + id: 'copy_config', label: gettext('Copy Config'),type: 'text', + mode: ['create'], group: gettext('Definition'), control: 'node-ajax-options', url: 'copyConfig', deps: ['prsname'], //disable copy_config when user select parser manually and vica-versa @@ -522,8 +521,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { parser === '') ? false : true; } },{ - id: 'tokens', label: '{{ _('Tokens') }}', type: 'collection', - group: '{{ _('Tokens') }}', control: TokenControl, + id: 'tokens', label: gettext('Tokens'), type: 'collection', + group: gettext('Tokens'), control: TokenControl, model: TokenModel, columns: ['token', 'dictionary'], uniqueCol : ['token'], mode: ['create','edit'], canAdd: true, canEdit: false, canDelete: true @@ -552,7 +551,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Name must be specified!') }}'; + msg = gettext('Name must be specified!'); this.errorModel.set('name', msg); return msg; } @@ -561,7 +560,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { else if (_.isUndefined(copy_config_or_parser) || _.isNull(copy_config_or_parser) || String(copy_config_or_parser).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Select parser or configuration to copy!') }}'; + msg = gettext('Select parser or configuration to copy!'); this.errorModel.set('parser', msg); return msg; } @@ -570,7 +569,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { else if (_.isUndefined(schema) || _.isNull(schema) || String(schema).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Schema must be selected!') }}'; + msg = gettext('Schema must be selected!'); this.errorModel.set('schema', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/templates/fts_dictionary/js/fts_dictionary.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/templates/fts_dictionary/js/fts_dictionary.js index 60b47fd62..0059a7c2c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/templates/fts_dictionary/js/fts_dictionary.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_dictionaries/templates/fts_dictionary/js/fts_dictionary.js @@ -1,7 +1,7 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the browser's node model class to create a option/value pair var OptionLabelModel = pgAdmin.Browser.Node.Model.extend({ @@ -12,11 +12,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Define the schema for the Options schema: [ { - id: 'option', label:'Option', type:'text', group: null, - cellHeaderClasses:'width_percent_50', editable: true + id: 'option', label: gettext('Option'), type:'text', group: null, + cellHeaderClasses: 'width_percent_50', editable: true },{ - id: 'value', label:'Value', type: 'text', group:null, - cellHeaderClasses:'width_percent_50', editable: true + id: 'value', label: gettext('Value'), type: 'text', group:null, + cellHeaderClasses: 'width_percent_50', editable: true }, ], validate: function() { @@ -25,13 +25,13 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(this.get('option')) || String(this.get('option')).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Option cannot be empty!') }}'; + var msg = gettext('Option cannot be empty!'); this.errorModel.set('option',msg); return msg; } if (_.isUndefined(this.get('value')) || String(this.get('value')).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Value cannot be empty!') }}'; + var msg = gettext('Value cannot be empty!'); this.errorModel.set('value',msg); return msg; } @@ -44,7 +44,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { var fts_dictionaries = pgAdmin.Browser.Nodes['coll-fts_dictionary'] = pgAdmin.Browser.Collection.extend({ node: 'fts_dictionary', - label: '{{ _('FTS Dictionaries') }}', + label: gettext('FTS Dictionaries'), type: 'coll-fts_dictionary', columns: ['name', 'description'] }); @@ -60,7 +60,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { dialogHelp: '{{ url_for('help.static', filename='fts_dictionary_dialog.html') }}', canDrop: true, canDropCascade: true, - label: '{{ _('FTS Dictionary') }}', + label: gettext('FTS Dictionary'), hasSQL: true, hasDepends: true, Init: function() { @@ -75,19 +75,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_fts_dictionary_on_schema', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{_('FTS Dictionary...')}}', + category: 'create', priority: 4, label: gettext('FTS Dictionary...'), icon: 'wcTabIcon icon-fts_dictionary', data: {action: 'create'}, enable: 'canCreate' },{ name: 'create_fts_dictionary_on_coll', node: 'coll-fts_dictionary', module: this, applies: ['object', 'context'], priority: 4, callback: 'show_obj_properties', category: 'create', - label: '{{ _('FTS Dictionary...') }}', data: {action: 'create'}, + label: gettext('FTS Dictionary...'), data: {action: 'create'}, icon: 'wcTabIcon icon-fts_dictionary', enable: 'canCreate' },{ name: 'create_fts_dictionary', node: 'fts_dictionary', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{_('FTS Dictionary...')}}', + category: 'create', priority: 4, label: gettext('FTS Dictionary...'), icon: 'wcTabIcon icon-fts_dictionary', data: {action: 'create'}, enable: 'canCreate' }]); @@ -117,30 +117,30 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, // Defining schema for fts dictionary schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', cellHeaderClasses: 'width_percent_50' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', editable: false, type: 'text', disabled: true, mode:['properties'] },{ - id: 'owner', label:'{{ _('Owner') }}', cell: 'string', + id: 'owner', label: gettext('Owner'), cell: 'string', type: 'text', mode: ['properties', 'edit','create'], node: 'role', control: Backform.NodeListByNameControl },{ - id: 'schema', label: '{{ _('Schema')}}', cell: 'string', + id: 'schema', label: gettext('Schema'), cell: 'string', type: 'text', mode: ['create','edit'], node: 'schema', cache_node: 'database', control: 'node-list-by-id' },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', cellHeaderClasses: 'width_percent_50' },{ - id: 'template', label: '{{ _('Template')}}',type: 'text', + id: 'template', label: gettext('Template'),type: 'text', disabled: function(m) { return !m.isNew(); }, url: 'fetch_templates', - group: '{{ _('Definition') }}', control: 'node-ajax-options', + group: gettext('Definition'), control: 'node-ajax-options', cache_node: 'fts_template', },{ - id: 'options', label: '{{ _('Option') }}', type: 'collection', - group: '{{ _('Options') }}', control: 'unique-col-collection', + id: 'options', label: gettext('Option'), type: 'collection', + group: gettext('Options'), control: 'unique-col-collection', model: OptionLabelModel, columns: ['option', 'value'], uniqueCol : ['option'], mode: ['edit', 'create'], canAdd: true, canEdit: false,canDelete: true @@ -158,21 +158,21 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Validate FTS Dictionary name if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name must be specified!') }}'; + var msg = gettext('Name must be specified!'); this.errorModel.set('name', msg); return msg; } // Validate template name else if (_.isUndefined(template) || _.isNull(template) || String(template).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Template must be selected!') }}'; + var msg = gettext('Template must be selected!'); this.errorModel.set('template', msg); return msg; } // Validate schema else if (_.isUndefined(schema) || _.isNull(schema) || String(schema).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Schema must be selected!') }}'; + var msg = gettext('Schema must be selected!'); this.errorModel.set('schema', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/templates/fts_parser/js/fts_parser.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/templates/fts_parser/js/fts_parser.js index 6a12bf709..a1bae7576 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/templates/fts_parser/js/fts_parser.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_parser/templates/fts_parser/js/fts_parser.js @@ -1,14 +1,14 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the collection class for fts parser if (!pgBrowser.Nodes['coll-fts_parser']) { var fts_parsers = pgAdmin.Browser.Nodes['coll-fts_parser'] = pgAdmin.Browser.Collection.extend({ node: 'fts_parser', - label: '{{ _('FTS Parsers') }}', + label: gettext('FTS Parsers'), type: 'coll-fts_parser', columns: ['name', 'description'] }); @@ -24,7 +24,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { dialogHelp: '{{ url_for('help.static', filename='fts_parser_dialog.html') }}', canDrop: true, canDropCascade: true, - label: '{{ _('FTS Parser') }}', + label: gettext('FTS Parser'), hasSQL: true, hasDepends: true, Init: function() { @@ -39,19 +39,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_fts_parser_on_schema', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('FTS Parser...') }}', + category: 'create', priority: 4, label: gettext('FTS Parser...'), icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'}, enable: 'canCreate' },{ name: 'create_fts_parser_on_coll', node: 'coll-fts_parser', applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('FTS Parser...') }}', + category: 'create', priority: 4, label: gettext('FTS Parser...'), icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'}, module: this, enable: 'canCreate' },{ name: 'create_fts_parser', node: 'fts_parser', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('FTS Parser...') }}', + category: 'create', priority: 4, label: gettext('FTS Parser...'), icon: 'wcTabIcon icon-fts_parser', data: {action: 'create'}, enable: 'canCreate' }]); @@ -81,49 +81,49 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, // Defining schema for fts parser schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', cellHeaderClasses: 'width_percent_50' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', editable: false, type: 'text', disabled: true, mode:['properties'] },{ - id: 'schema', label: '{{ _('Schema')}}', cell: 'string', + id: 'schema', label: gettext('Schema'), cell: 'string', type: 'text', mode: ['create','edit'], node: 'schema', control: 'node-list-by-id', cache_node: 'database', cache_level: 'database' },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', cellHeaderClasses: 'width_percent_50' },{ - id: 'prsstart', label: '{{ _('Start function')}}', + id: 'prsstart', label: gettext('Start function'), type: 'text', disabled: function(m) { return !m.isNew(); }, control: 'node-ajax-options', url: 'start_functions', - group: '{{ _('Definition') }}', cache_level: 'database', + group: gettext('Definition'), cache_level: 'database', cache_node: 'schema' },{ - id: 'prstoken', label: '{{ _('Get next token function')}}', + id: 'prstoken', label: gettext('Get next token function'), type: 'text', disabled: function(m) { return !m.isNew(); }, control: 'node-ajax-options', url: 'token_functions', - group: '{{ _('Definition') }}', cache_level: 'database', + group: gettext('Definition'), cache_level: 'database', cache_node: 'schema' },{ - id: 'prsend', label: '{{ _('End function')}}', + id: 'prsend', label: gettext('End function'), type: 'text', disabled: function(m) { return !m.isNew(); }, control: 'node-ajax-options', url: 'end_functions', - group: '{{ _('Definition') }}', cache_level: 'database', + group: gettext('Definition'), cache_level: 'database', cache_node: 'schema', cache_node: 'schema' },{ - id: 'prslextype', label: '{{ _('Lextypes function')}}', + id: 'prslextype', label: gettext('Lextypes function'), type: 'text', disabled: function(m) { return !m.isNew(); }, control: 'node-ajax-options', url: 'lextype_functions', - group: '{{ _('Definition') }}', cache_level: 'database', + group: gettext('Definition'), cache_level: 'database', cache_node: 'schema' },{ - id: 'prsheadline', label: '{{ _('Headline function')}}', + id: 'prsheadline', label: gettext('Headline function'), type: 'text', disabled: function(m) { return !m.isNew(); }, control: 'node-ajax-options', url: 'headline_functions', - group: '{{ _('Definition') }}', cache_level: 'database', + group: gettext('Definition'), cache_level: 'database', cache_node: 'schema' }], @@ -144,7 +144,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name must be specified.') }}'; + var msg = gettext('Name must be specified.'); this.errorModel.set('name', msg); return msg; } @@ -153,7 +153,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { else if (_.isUndefined(start) || _.isNull(start) || String(start).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Start function must be selected.') }}'; + var msg = gettext('Start function must be selected.'); this.errorModel.set('prsstart', msg); return msg; } @@ -162,7 +162,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { else if (_.isUndefined(token) || _.isNull(token) || String(token).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Get next token function must be selected.') }}'; + var msg = gettext('Get next token function must be selected.'); this.errorModel.set('prstoken', msg); return msg; } @@ -171,7 +171,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { else if (_.isUndefined(end) || _.isNull(end) || String(end).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('End function must be selected.') }}'; + var msg = gettext('End function must be selected.'); this.errorModel.set('prsend', msg); return msg; } @@ -180,7 +180,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { else if (_.isUndefined(lextype) || _.isNull(lextype) || String(lextype).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Lextype function must be selected.') }}'; + var msg = gettext('Lextype function must be selected.'); this.errorModel.set('prslextype', msg); return msg; } @@ -189,7 +189,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { else if (_.isUndefined(schema) || _.isNull(schema) || String(schema).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Schema must be selected.') }}'; + var msg = gettext('Schema must be selected.'); this.errorModel.set('schema', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/templates/fts_template/js/fts_templates.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/templates/fts_template/js/fts_templates.js index 7fb9f2fa1..f3d90817a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/templates/fts_template/js/fts_templates.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/fts_templates/templates/fts_template/js/fts_templates.js @@ -1,13 +1,14 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the collection class for fts template if (!pgBrowser.Nodes['coll-fts_template']) { var fts_templates = pgAdmin.Browser.Nodes['coll-fts_template'] = pgAdmin.Browser.Collection.extend({ node: 'fts_template', - label: '{{ _('FTS Templates') }}', + label: gettext('FTS Templates'), type: 'coll-fts_template', columns: ['name', 'description'] }); @@ -23,7 +24,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { dialogHelp: '{{ url_for('help.static', filename='fts_template_dialog.html') }}', canDrop: true, canDropCascade: true, - label: '{{ _('FTS Template') }}', + label: gettext('FTS Template'), hasSQL: true, hasDepends: true, Init: function() { @@ -38,19 +39,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_fts_template_on_schema', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('FTS Template...') }}', + category: 'create', priority: 4, label: gettext('FTS Template...'), icon: 'wcTabIcon icon-fts_template', data: {action: 'create'}, enable: 'canCreate' },{ name: 'create_fts_template_on_coll', node: 'coll-fts_template', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('FTS Template...') }}', + category: 'create', priority: 4, label: gettext('FTS Template...'), icon: 'wcTabIcon icon-fts_template', data: {action: 'create'}, enable: 'canCreate' },{ name: 'create_fts_template', node: 'fts_template', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('FTS Template...') }}', + category: 'create', priority: 4, label: gettext('FTS Template...'), icon: 'wcTabIcon icon-fts_template', data: {action: 'create'}, enable: 'canCreate' }]); @@ -75,27 +76,27 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, // Defining schema for fts template schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', cellHeaderClasses: 'width_percent_50' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', editable: false, type: 'text', disabled: true, mode:['properties'] },{ - id: 'schema', label: '{{ _('Schema')}}', cell: 'string', + id: 'schema', label: gettext('Schema'), cell: 'string', type: 'text', mode: ['create','edit'], node: 'schema', control: 'node-list-by-id', cache_node: 'database', cache_level: 'database' },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', cellHeaderClasses: 'width_percent_50' },{ - id: 'tmplinit', label: '{{ _('Init function')}}', - group: '{{ _('Definition') }}', type: 'text', disabled: function(m) { + id: 'tmplinit', label: gettext('Init function'), + group: gettext('Definition'), type: 'text', disabled: function(m) { return !m.isNew(); }, control: 'node-ajax-options', url: 'get_init', cache_level: 'database', cache_node: 'schema' },{ - id: 'tmpllexize', label: '{{ _('Lexize function')}}', group: '{{ _('Definition') }}', + id: 'tmpllexize', label: gettext('Lexize function'), group: gettext('Definition'), type: 'text', disabled: function(m) { return !m.isNew(); }, control: 'node-ajax-options', url: 'get_lexize', cache_level: 'database', cache_node: 'schema' @@ -113,21 +114,21 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Validate fts template name if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name must be specified.') }}'; + var msg = gettext('Name must be specified.'); this.errorModel.set('name', msg); return msg; } // Validate lexize function control else if (_.isUndefined(lexize) || _.isNull(lexize) || String(lexize).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Lexize function must be selected.') }}'; + var msg = gettext('Lexize function must be selected.'); this.errorModel.set('tmpllexize', msg); return msg; } // Validate schema for fts template else if (_.isUndefined(schema) || _.isNull(schema) || String(schema).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Schema must be selected.') }}'; + var msg = gettext('Schema must be selected.'); this.errorModel.set('schema', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/js/functions.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/js/functions.js index 8bed1cba0..19bfbeea5 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/js/functions.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/js/functions.js @@ -1,15 +1,15 @@ /* Create and Register Function Collection and Node. */ -define( - ['jquery', 'underscore', 'underscore.string', - 'pgadmin', 'pgadmin.browser', 'alertify', - 'pgadmin.browser.collection', 'pgadmin.browser.server.privilege'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-function']) { var functions = pgBrowser.Nodes['coll-function'] = pgBrowser.Collection.extend({ node: 'function', - label: '{{ _('Functions') }}', + label: gettext('Functions'), type: 'coll-function', columns: ['name', 'funcowner', 'description'], hasStatistics: true @@ -30,7 +30,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { id: 'argid', visible: false, type: 'text', mode: ['properties', 'edit','create'] },{ - id: 'argtype', label:'{{ _('Data Type') }}', cell: + id: 'argtype', label: gettext('Data Type'), cell: 'node-ajax-options', cellHeaderClasses: 'width_percent_30', control: 'node-ajax-options', type: 'text', url: 'get_types', editable: function(m) { @@ -41,7 +41,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return _.isUndefined(m.isNew) ? true : m.isNew(); }, first_empty: true },{ - id: 'argmode', label:'{{ _('Mode') }}', type: 'options', + id: 'argmode', label: gettext('Mode'), type: 'options', control: 'node-ajax-options', cellHeaderClasses:'width_percent_20', options:[ {'label': 'IN', 'value': 'IN'}, @@ -56,10 +56,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return _.isUndefined(m.isNew) ? true : m.isNew(); } },{ - id: 'argname', label:'{{ _('Argument Name') }}', type: 'text', + id: 'argname', label: gettext('Argument Name'), type: 'text', cell: 'string', editable: 'isInCatalog', cellHeaderClasses:'width_percent_30' },{ - id: 'argdefval', label:'{{ _('Default Value') }}', type: 'text', + id: 'argdefval', label: gettext('Default Value'), type: 'text', cell: 'string', editable: 'isInCatalog', cellHeaderClasses:'width_percent_20' } ], @@ -88,7 +88,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'sql-alterfunction.html', sqlCreateHelp: 'sql-createfunction.html', dialogHelp: '{{ url_for('help.static', filename='function_dialog.html') }}', - label: '{{ _('Function') }}', + label: gettext('Function'), collection_type: 'coll-function', hasSQL: true, hasDepends: true, @@ -105,19 +105,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_function_on_coll', node: 'coll-function', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Function...') }}', + category: 'create', priority: 4, label: gettext('Function...'), icon: 'wcTabIcon icon-function', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_function', node: 'function', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Function...') }}', + category: 'create', priority: 4, label: gettext('Function...'), icon: 'wcTabIcon icon-function', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_function', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Function...') }}', + category: 'create', priority: 4, label: gettext('Function...'), icon: 'wcTabIcon icon-function', data: {action: 'create', check: false}, enable: 'canCreate' } @@ -174,59 +174,59 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sysproc: undefined }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'isDisabled' },{ - id: 'oid', label: '{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'funcowner', label: '{{ _('Owner') }}', cell: 'string', + id: 'funcowner', label: gettext('Owner'), cell: 'string', control: Backform.NodeListByNameControl, node: 'role', type: 'text', disabled: 'isDisabled' },{ - id: 'pronamespace', label: '{{ _('Schema') }}', cell: 'string', + id: 'pronamespace', label: gettext('Schema'), cell: 'string', control: 'node-list-by-id', type: 'text', cache_level: 'database', node: 'schema', disabled: 'isDisabled', mode: ['create', 'edit'] },{ - id: 'sysfunc', label: '{{ _('System function?') }}', + id: 'sysfunc', label: gettext('System function?'), cell:'boolean', type: 'switch', mode: ['properties'], visible: 'isVisible' },{ - id: 'sysproc', label: '{{ _('System procedure?') }}', + id: 'sysproc', label: gettext('System procedure?'), cell:'boolean', type: 'switch', mode: ['properties'], visible: 'isVisible' },{ - id: 'description', label: '{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', disabled: 'isDisabled' },{ - id: 'pronargs', label: '{{ _('Argument count') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', mode: ['properties'] + id: 'pronargs', label: gettext('Argument count'), cell: 'string', + type: 'text', group: gettext('Definition'), mode: ['properties'] },{ - id: 'proargs', label: '{{ _('Arguments') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', mode: ['properties', 'edit'], + id: 'proargs', label: gettext('Arguments'), cell: 'string', + type: 'text', group: gettext('Definition'), mode: ['properties', 'edit'], disabled: 'isDisabled' },{ - id: 'proargtypenames', label: '{{ _('Signature arguments') }}', cell: - 'string', type: 'text', group: '{{ _('Definition') }}', mode: ['properties'], + id: 'proargtypenames', label: gettext('Signature arguments'), cell: + 'string', type: 'text', group: gettext('Definition'), mode: ['properties'], disabled: 'isDisabled' },{ - id: 'prorettypename', label: '{{ _('Return type') }}', cell: 'string', - control: 'node-ajax-options', type: 'text', group: '{{ _('Definition') }}', + id: 'prorettypename', label: gettext('Return type'), cell: 'string', + control: 'node-ajax-options', type: 'text', group: gettext('Definition'), url: 'get_types', disabled: 'isDisabled', first_empty: true, mode: ['create'], visible: 'isVisible' },{ - id: 'prorettypename', label: '{{ _('Return type') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', disabled: true, + id: 'prorettypename', label: gettext('Return type'), cell: 'string', + type: 'text', group: gettext('Definition'), disabled: true, mode: ['properties', 'edit'], disabled: 'isDisabled', visible: 'isVisible' }, { - id: 'lanname', label: '{{ _('Language') }}', cell: 'string', - control: 'node-ajax-options', type: 'text', group: '{{ _('Definition') }}', + id: 'lanname', label: gettext('Language'), cell: 'string', + control: 'node-ajax-options', type: 'text', group: gettext('Definition'), url: 'get_languages', disabled: 'isDisabled' },{ - id: 'prosrc', label: '{{ _('Code') }}', cell: 'string', + id: 'prosrc', label: gettext('Code'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], - group: '{{ _('Definition') }}', deps: ['lanname'], + group: gettext('Definition'), deps: ['lanname'], control: Backform.SqlFieldControl, extraClasses:['custom_height_css_class'], visible: function(m) { @@ -236,73 +236,73 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return true; }, disabled: 'isDisabled' },{ - id: 'probin', label: '{{ _('Object file') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', deps: ['lanname'], visible: + id: 'probin', label: gettext('Object file'), cell: 'string', + type: 'text', group: gettext('Definition'), deps: ['lanname'], visible: function(m) { if (m.get('lanname') == 'c') { return true; } return false; }, disabled: 'isDisabled' },{ - id: 'prosrc_c', label: '{{ _('Link symbol') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', deps: ['lanname'], visible: + id: 'prosrc_c', label: gettext('Link symbol'), cell: 'string', + type: 'text', group: gettext('Definition'), deps: ['lanname'], visible: function(m) { if (m.get('lanname') == 'c') { return true; } return false; }, disabled: 'isDisabled' },{ - id: 'provolatile', label: '{{ _('Volatility') }}', cell: 'string', - control: 'node-ajax-options', type: 'text', group: '{{ _('Options') }}', + id: 'provolatile', label: gettext('Volatility'), cell: 'string', + control: 'node-ajax-options', type: 'text', group: gettext('Options'), options:[ {'label': 'VOLATILE', 'value': 'v'}, {'label': 'STABLE', 'value': 's'}, {'label': 'IMMUTABLE', 'value': 'i'}, ], disabled: 'isDisabled', select2: {allowClear: false} },{ - id: 'proretset', label: '{{ _('Returns a set?') }}', type: 'switch', - disabled: 'isDisabled', group: '{{ _('Options') }}', + id: 'proretset', label: gettext('Returns a set?'), type: 'switch', + disabled: 'isDisabled', group: gettext('Options'), visible: 'isVisible' },{ - id: 'proisstrict', label: '{{ _('Strict?') }}', type: 'switch', - group: '{{ _('Options') }}', disabled: 'isDisabled', + id: 'proisstrict', label: gettext('Strict?'), type: 'switch', + group: gettext('Options'), disabled: 'isDisabled', options: { 'onText': 'Yes', 'offText': 'No', 'onColor': 'success', 'offColor': 'primary', 'size': 'small' } },{ - id: 'prosecdef', label: '{{ _('Security of definer?') }}', - group: '{{ _('Options') }}', type: 'switch', + id: 'prosecdef', label: gettext('Security of definer?'), + group: gettext('Options'), type: 'switch', disabled: 'isDisabled' },{ - id: 'proiswindow', label: '{{ _('Window?') }}', - group: '{{ _('Options') }}', cell:'boolean', type: 'switch', + id: 'proiswindow', label: gettext('Window?'), + group: gettext('Options'), cell:'boolean', type: 'switch', disabled: 'isDisabled', visible: 'isVisible' },{ - id: 'proparallel', label: '{{ _('Parallel') }}', cell: 'string', - control: 'node-ajax-options', type: 'text', group: '{{ _('Options') }}', + id: 'proparallel', label: gettext('Parallel'), cell: 'string', + control: 'node-ajax-options', type: 'text', group: gettext('Options'), options:[ - {'label': '{{ _('UNSAFE') }}', 'value': 'u'}, - {'label': '{{ _('RESTRICTED') }}', 'value': 'r'}, - {'label': '{{ _('SAFE') }}', 'value': 's'}, + {'label': 'UNSAFE', 'value': 'u'}, + {'label': 'RESTRICTED', 'value': 'r'}, + {'label': 'SAFE', 'value': 's'}, ], disabled: 'isDisabled', min_version: 90600, select2: {allowClear: false} },{ - id: 'procost', label: '{{ _('Estimated cost') }}', group: '{{ _('Options') }}', + id: 'procost', label: gettext('Estimated cost'), group: gettext('Options'), cell:'string', type: 'text', disabled: 'isDisabled' },{ - id: 'prorows', label: '{{ _('Estimated rows') }}', type: 'text', + id: 'prorows', label: gettext('Estimated rows'), type: 'text', deps: ['proretset'], visible: 'isVisible', disabled: 'isDisabled', - group: '{{ _('Options') }}' + group: gettext('Options') },{ - id: 'proleakproof', label: '{{ _('Leak proof?') }}', - group: '{{ _('Options') }}', cell:'boolean', type: 'switch', min_version: 90200, + id: 'proleakproof', label: gettext('Leak proof?'), + group: gettext('Options'), cell:'boolean', type: 'switch', min_version: 90200, disabled: 'isDisabled' },{ - id: 'proacl', label: '{{ _('Privileges') }}', type: 'text', - mode: ['properties'], group: '{{ _('Security') }}' + id: 'proacl', label: gettext('Privileges'), type: 'text', + mode: ['properties'], group: gettext('Security') },{ - id: 'arguments', label: '{{ _('Arguments') }}', cell: 'string', - group: '{{ _('Arguments') }}', type: 'collection', canAdd: function(m){ + id: 'arguments', label: gettext('Arguments'), cell: 'string', + group: gettext('Arguments'), type: 'collection', canAdd: function(m){ return m.isNew(); }, canDelete: true, model: ArgumentModel, mode: ['create', 'edit'], @@ -311,13 +311,13 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return m.isNew(); }, },{ - id: 'variables', label: '{{ _('Parameters') }}', type: 'collection', - group: '{{ _('Parameters') }}', control: 'variable-collection', + id: 'variables', label: gettext('Parameters'), type: 'collection', + group: gettext('Parameters'), control: 'variable-collection', model: pgBrowser.Node.VariableModel, mode: ['edit', 'create'], canAdd: 'canVarAdd', canEdit: false, canDelete: true, disabled: 'isDisabled' }, pgBrowser.SecurityGroupUnderSchema, { - id: 'acl', label: '{{ _('Privileges') }}', editable: false, + id: 'acl', label: gettext('Privileges'), editable: false, model: pgBrowser.Node.PrivilegeRoleModel.extend({ privileges: ['X'] }), uniqueCol : ['grantee', 'grantor'], type: 'collection', @@ -325,7 +325,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { canDelete: true, control: 'unique-col-collection', disabled: 'isDisabled' },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', canAdd: true, + id: 'seclabels', label: gettext('Security Labels'), canAdd: true, model: pgBrowser.SecLabelModel, type: 'collection', min_version: 90100, group: 'security', mode: ['edit', 'create'], canEdit: false, canDelete: true, uniqueCol : ['provider'], @@ -342,45 +342,45 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { seclabels = this.get('seclabels'); if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _('Name cannot be empty.') }}'; + err['name'] = gettext('Name cannot be empty.'); errmsg = errmsg || err['name']; } if (_.isUndefined(this.get('funcowner')) || String(this.get('funcowner')).replace(/^\s+|\s+$/g, '') == '') { - err['funcowner'] = '{{ _('Owner cannot be empty.') }}'; + err['funcowner'] = gettext('Owner cannot be empty.'); errmsg = errmsg || err['funcowner']; } if (_.isUndefined(this.get('pronamespace')) || String(this.get('pronamespace')).replace(/^\s+|\s+$/g, '') == '') { - err['pronamespace'] = '{{ _('Schema cannot be empty.') }}'; + err['pronamespace'] = gettext('Schema cannot be empty.'); errmsg = errmsg || err['pronamespace']; } if (_.isUndefined(this.get('prorettypename')) || String(this.get('prorettypename')).replace(/^\s+|\s+$/g, '') == '') { - err['prorettypename'] = '{{ _('Return type cannot be empty.') }}'; + err['prorettypename'] = gettext('Return type cannot be empty.'); errmsg = errmsg || err['prorettypename']; } if (_.isUndefined(this.get('lanname')) || String(this.get('lanname')).replace(/^\s+|\s+$/g, '') == '') { - err['lanname'] = '{{ _('Language cannot be empty.') }}'; + err['lanname'] = gettext('Language cannot be empty.'); errmsg = errmsg || err['lanname']; } if (String(this.get('lanname')) == 'c') { if (_.isUndefined(this.get('probin')) || String(this.get('probin')) .replace(/^\s+|\s+$/g, '') == '') { - err['probin'] = '{{ _('Object File cannot be empty.') }}'; + err['probin'] = gettext('Object File cannot be empty.'); errmsg = errmsg || err['probin']; } if (_.isUndefined(this.get('prosrc_c')) || String(this.get('prosrc_c')).replace(/^\s+|\s+$/g, '') == '') { - err['prosrc_c'] = '{{ _('Link Symbol cannot be empty.') }}'; + err['prosrc_c'] = gettext('Link Symbol cannot be empty.'); errmsg = errmsg || err['prosrc_c']; } } else { if (_.isUndefined(this.get('prosrc')) || String(this.get('prosrc')).replace(/^\s+|\s+$/g, '') == '') { - err['prosrc'] = '{{ _('Code cannot be empty.') }}'; + err['prosrc'] = gettext('Code cannot be empty.'); errmsg = errmsg || err['prosrc']; } } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/js/procedures.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/js/procedures.js index a3cfc5d9a..47b996c0e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/js/procedures.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedure/js/procedures.js @@ -1,16 +1,15 @@ /* Create and Register Procedure Collection and Node. */ -define( - ['jquery', 'underscore', 'underscore.string', - 'pgadmin', 'pgadmin.browser', 'alertify', - 'pgadmin.node.function', 'pgadmin.browser.collection', - 'pgadmin.browser.server.privilege'], -function($, _, S, pgAdmin, pgBrowser, alertify, Function) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.node.function', + 'pgadmin.browser.collection', 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify, Function) { if (!pgBrowser.Nodes['coll-procedure']) { var procedures = pgAdmin.Browser.Nodes['coll-procedure'] = pgAdmin.Browser.Collection.extend({ node: 'procedure', - label: '{{ _('Procedures') }}', + label: gettext('Procedures'), type: 'coll-procedure', columns: ['name', 'funcowner', 'description'], hasStatistics: true @@ -26,7 +25,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Function) { sqlAlterHelp: 'sql-alterprocedure.html', sqlCreateHelp: 'sql-createprocedure.html', dialogHelp: '{{ url_for('help.static', filename='procedure_dialog.html') }}', - label: '{{ _('Procedure') }}', + label: gettext('Procedure'), collection_type: 'coll-procedure', hasSQL: true, hasDepends: true, @@ -44,19 +43,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Function) { name: 'create_procedure_on_coll', node: 'coll-procedure', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Procedure...') }}', + category: 'create', priority: 4, label: gettext('Procedure...'), icon: 'wcTabIcon icon-procedure', data: {action: 'create', check: false}, enable: 'canCreateProc' },{ name: 'create_procedure', node: 'procedure', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Procedure...') }}', + category: 'create', priority: 4, label: gettext('Procedure...'), icon: 'wcTabIcon icon-procedure', data: {action: 'create', check: true}, enable: 'canCreateProc' },{ name: 'create_procedure', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Procedure...') }}', + category: 'create', priority: 4, label: gettext('Procedure...'), icon: 'wcTabIcon icon-procedure', data: {action: 'create', check: true}, enable: 'canCreateProc' } @@ -144,22 +143,22 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Function) { seclabels = this.get('seclabels'); if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _('Name cannot be empty.') }}'; + err['name'] = gettext('Name cannot be empty.'); errmsg = errmsg || err['name']; } if (_.isUndefined(this.get('pronamespace')) || String(this.get('pronamespace')).replace(/^\s+|\s+$/g, '') == '') { - err['pronamespace'] = '{{ _('Schema cannot be empty.') }}'; + err['pronamespace'] = gettext('Schema cannot be empty.'); errmsg = errmsg || err['pronamespace']; } if (_.isUndefined(this.get('lanname')) || String(this.get('lanname')).replace(/^\s+|\s+$/g, '') == '') { - err['lanname'] = '{{ _('Language cannot be empty.') }}'; + err['lanname'] = gettext('Language cannot be empty.'); errmsg = errmsg || err['lanname']; } if (_.isUndefined(this.get('prosrc')) || String(this.get('prosrc')).replace(/^\s+|\s+$/g, '') == '') { - err['prosrc'] = '{{ _('Code cannot be empty.') }}'; + err['prosrc'] = gettext('Code cannot be empty.'); errmsg = errmsg || err['prosrc']; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/js/trigger_functions.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/js/trigger_functions.js index 3fceee202..9c5a30951 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/js/trigger_functions.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_function/js/trigger_functions.js @@ -1,15 +1,15 @@ /* Create and Register Function Collection and Node. */ -define( - ['jquery', 'underscore', 'underscore.string', - 'pgadmin', 'pgadmin.browser', 'alertify', - 'pgadmin.browser.collection', 'pgadmin.browser.server.privilege'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-trigger_function']) { var trigger_functions = pgBrowser.Nodes['coll-trigger_function'] = pgBrowser.Collection.extend({ node: 'trigger_function', - label: '{{ _('Trigger functions') }}', + label: gettext('Trigger functions'), type: 'coll-trigger_function', columns: ['name', 'funcowner', 'description'], hasStatistics: true @@ -22,7 +22,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'plpgsql-trigger.html', sqlCreateHelp: 'plpgsql-trigger.html', dialogHelp: '{{ url_for('help.static', filename='trigger_function_dialog.html') }}', - label: '{{ _('Trigger function') }}', + label: gettext('Trigger function'), collection_type: 'coll-trigger_function', hasSQL: true, hasDepends: true, @@ -38,19 +38,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_trigger_function_on_coll', node: 'coll-trigger_function', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Trigger function...') }}', + category: 'create', priority: 4, label: gettext('Trigger function...'), icon: 'wcTabIcon icon-trigger_function', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_trigger_function', node: 'trigger_function', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Trigger function...') }}', + category: 'create', priority: 4, label: gettext('Trigger function...'), icon: 'wcTabIcon icon-trigger_function', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_trigger_function', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Trigger function...') }}', + category: 'create', priority: 4, label: gettext('Trigger function...'), icon: 'wcTabIcon icon-trigger_function', data: {action: 'create', check: false}, enable: 'canCreate' } @@ -106,45 +106,45 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sysproc: undefined }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'isDisabled' },{ - id: 'oid', label: '{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'funcowner', label: '{{ _('Owner') }}', cell: 'string', + id: 'funcowner', label: gettext('Owner'), cell: 'string', control: Backform.NodeListByNameControl, node: 'role', type: 'text', disabled: 'isDisabled' },{ - id: 'pronamespace', label: '{{ _('Schema') }}', cell: 'string', + id: 'pronamespace', label: gettext('Schema'), cell: 'string', control: 'node-list-by-id', type: 'text', cache_level: 'database', node: 'schema', disabled: 'isDisabled', mode: ['create', 'edit'] },{ - id: 'sysfunc', label: '{{ _('System function?') }}', + id: 'sysfunc', label: gettext('System function?'), cell:'boolean', type: 'switch', mode: ['properties'], visible: 'isVisible' },{ - id: 'sysproc', label: '{{ _('System procedure?') }}', + id: 'sysproc', label: gettext('System procedure?'), cell:'boolean', type: 'switch', mode: ['properties'], visible: 'isVisible' },{ - id: 'description', label: '{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', disabled: 'isDisabled' },{ - id: 'pronargs', label: '{{ _('Argument count') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', mode: ['properties'] + id: 'pronargs', label: gettext('Argument count'), cell: 'string', + type: 'text', group: gettext('Definition'), mode: ['properties'] },{ - id: 'proargs', label: '{{ _('Arguments') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', mode: ['properties', 'edit'], + id: 'proargs', label: gettext('Arguments'), cell: 'string', + type: 'text', group: gettext('Definition'), mode: ['properties', 'edit'], disabled: 'isDisabled' },{ - id: 'proargtypenames', label: '{{ _('Signature arguments') }}', cell: - 'string', type: 'text', group: '{{ _('Definition') }}', mode: ['properties'], + id: 'proargtypenames', label: gettext('Signature arguments'), cell: + 'string', type: 'text', group: gettext('Definition'), mode: ['properties'], disabled: 'isDisabled' },{ - id: 'prorettypename', label: '{{ _('Return type') }}', cell: 'string', - control: 'select2', type: 'text', group: '{{ _('Definition') }}', + id: 'prorettypename', label: gettext('Return type'), cell: 'string', + control: 'select2', type: 'text', group: gettext('Definition'), disabled: 'isDisabled', first_empty: true, select2: { width: "100%", allowClear: false }, mode: ['create'], visible: 'isVisible', options: [ @@ -152,19 +152,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { {label: 'event_trigger', value: 'event_trigger'} ] },{ - id: 'prorettypename', label: '{{ _('Return type') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', disabled: true, + id: 'prorettypename', label: gettext('Return type'), cell: 'string', + type: 'text', group: gettext('Definition'), disabled: true, mode: ['properties', 'edit'], disabled: 'isDisabled', visible: 'isVisible' }, { - id: 'lanname', label: '{{ _('Language') }}', cell: 'string', - control: 'node-ajax-options', type: 'text', group: '{{ _('Definition') }}', + id: 'lanname', label: gettext('Language'), cell: 'string', + control: 'node-ajax-options', type: 'text', group: gettext('Definition'), url: 'get_languages', disabled: 'isDisabled', transform: function(d, self) { return _.reject(d, function(o){ return o.label == 'sql' || o.label == 'edbspl'; }); }, select2: { allowClear: false } },{ - id: 'prosrc', label: '{{ _('Code') }}', cell: 'string', + id: 'prosrc', label: gettext('Code'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], - group: '{{ _('Definition') }}', deps: ['lanname'], + group: gettext('Definition'), deps: ['lanname'], control: Backform.SqlFieldControl, extraClasses:['custom_height_css_class'], visible: function(m) { @@ -174,77 +174,77 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return true; }, disabled: 'isDisabled' },{ - id: 'probin', label: '{{ _('Object file') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', deps: ['lanname'], visible: + id: 'probin', label: gettext('Object file'), cell: 'string', + type: 'text', group: gettext('Definition'), deps: ['lanname'], visible: function(m) { if (m.get('lanname') == 'c') { return true; } return false; }, disabled: 'isDisabled' },{ - id: 'prosrc_c', label: '{{ _('Link symbol') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', deps: ['lanname'], visible: + id: 'prosrc_c', label: gettext('Link symbol'), cell: 'string', + type: 'text', group: gettext('Definition'), deps: ['lanname'], visible: function(m) { if (m.get('lanname') == 'c') { return true; } return false; }, disabled: 'isDisabled' },{ - id: 'provolatile', label: '{{ _('Volatility') }}', cell: 'string', - control: 'node-ajax-options', type: 'text', group: '{{ _('Options') }}', + id: 'provolatile', label: gettext('Volatility'), cell: 'string', + control: 'node-ajax-options', type: 'text', group: gettext('Options'), options:[ {'label': 'VOLATILE', 'value': 'v'}, {'label': 'STABLE', 'value': 's'}, {'label': 'IMMUTABLE', 'value': 'i'}, ], disabled: 'isDisabled', select2: { allowClear: false } },{ - id: 'proretset', label: '{{ _('Returns a set?') }}', type: 'switch', - group: '{{ _('Options') }}', disabled: 'isDisabled', + id: 'proretset', label: gettext('Returns a set?'), type: 'switch', + group: gettext('Options'), disabled: 'isDisabled', visible: 'isVisible' },{ - id: 'proisstrict', label: '{{ _('Strict?') }}', type: 'switch', - disabled: 'isDisabled', group: '{{ _('Options') }}', + id: 'proisstrict', label: gettext('Strict?'), type: 'switch', + disabled: 'isDisabled', group: gettext('Options'), options: { 'onText': 'Yes', 'offText': 'No', 'onColor': 'success', 'offColor': 'primary', 'size': 'small' } },{ - id: 'prosecdef', label: '{{ _('Security of definer?') }}', - group: '{{ _('Options') }}', cell:'boolean', type: 'switch', + id: 'prosecdef', label: gettext('Security of definer?'), + group: gettext('Options'), cell:'boolean', type: 'switch', disabled: 'isDisabled' },{ - id: 'proiswindow', label: '{{ _('Window?') }}', - group: '{{ _('Options') }}', cell:'boolean', type: 'switch', + id: 'proiswindow', label: gettext('Window?'), + group: gettext('Options'), cell:'boolean', type: 'switch', disabled: 'isDisabled', visible: 'isVisible' },{ - id: 'procost', label: '{{ _('Estimated cost') }}', type: 'text', - group: '{{ _('Options') }}', disabled: 'isDisabled' + id: 'procost', label: gettext('Estimated cost'), type: 'text', + group: gettext('Options'), disabled: 'isDisabled' },{ - id: 'prorows', label: '{{ _('Estimated rows') }}', type: 'text', - group: '{{ _('Options') }}', + id: 'prorows', label: gettext('Estimated rows'), type: 'text', + group: gettext('Options'), disabled: 'isDisabled', deps: ['proretset'], visible: 'isVisible' },{ - id: 'proleakproof', label: '{{ _('Leak proof?') }}', - group: '{{ _('Options') }}', cell:'boolean', type: 'switch', min_version: 90200, + id: 'proleakproof', label: gettext('Leak proof?'), + group: gettext('Options'), cell:'boolean', type: 'switch', min_version: 90200, disabled: 'isDisabled' }, pgBrowser.SecurityGroupUnderSchema, { - id: 'proacl', label: '{{ _('Privileges') }}', mode: ['properties'], - group: '{{ _('Security') }}', type: 'text' + id: 'proacl', label: gettext('Privileges'), mode: ['properties'], + group: gettext('Security'), type: 'text' },{ - id: 'variables', label: '{{ _('Parameters') }}', type: 'collection', - group: '{{ _('Parameters') }}', control: 'variable-collection', + id: 'variables', label: gettext('Parameters'), type: 'collection', + group: gettext('Parameters'), control: 'variable-collection', model: pgBrowser.Node.VariableModel, mode: ['edit', 'create'], canAdd: 'canVarAdd', canEdit: false, canDelete: true, disabled: 'isDisabled' },{ - id: 'acl', label: '{{ _('Privileges') }}', editable: false, + id: 'acl', label: gettext('Privileges'), editable: false, type: 'collection', group: 'security', mode: ['edit', 'create'], model: pgBrowser.Node.PrivilegeRoleModel.extend({ privileges: ['X'] }), uniqueCol : ['grantee', 'grantor'], disabled: 'isDisabled', canAdd: true, canDelete: true, control: 'unique-col-collection' },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', canEdit: true, + id: 'seclabels', label: gettext('Security Labels'), canEdit: true, model: pgBrowser.SecLabelModel, type: 'collection', min_version: 90100, group: 'security', mode: ['edit', 'create'], canDelete: true, control: 'unique-col-collection', canAdd: true, @@ -263,45 +263,45 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _('Name cannot be empty.') }}'; + err['name'] = gettext('Name cannot be empty.'); errmsg = errmsg || err['name']; } if (_.isUndefined(this.get('funcowner')) || String(this.get('funcowner')).replace(/^\s+|\s+$/g, '') == '') { - err['funcowner'] = '{{ _('Owner cannot be empty.') }}'; + err['funcowner'] = gettext('Owner cannot be empty.'); errmsg = errmsg || err['funcowner']; } if (_.isUndefined(this.get('pronamespace')) || String(this.get('pronamespace')).replace(/^\s+|\s+$/g, '') == '') { - err['pronamespace'] = '{{ _('Schema cannot be empty.') }}'; + err['pronamespace'] = gettext('Schema cannot be empty.'); errmsg = errmsg || err['pronamespace']; } if (_.isUndefined(this.get('prorettypename')) || String(this.get('prorettypename')).replace(/^\s+|\s+$/g, '') == '') { - err['prorettypename'] = '{{ _('Return type cannot be empty.') }}'; + err['prorettypename'] = gettext('Return type cannot be empty.'); errmsg = errmsg || err['prorettypename']; } if (_.isUndefined(this.get('lanname')) || String(this.get('lanname')).replace(/^\s+|\s+$/g, '') == '') { - err['lanname'] = '{{ _('Language cannot be empty.') }}'; + err['lanname'] = gettext('Language cannot be empty.'); errmsg = errmsg || err['lanname']; } if (String(this.get('lanname')) == 'c') { if (_.isUndefined(this.get('probin')) || String(this.get('probin')) .replace(/^\s+|\s+$/g, '') == '') { - err['probin'] = '{{ _('Object File cannot be empty.') }}'; + err['probin'] = gettext('Object File cannot be empty.'); errmsg = errmsg || err['probin']; } if (_.isUndefined(this.get('prosrc_c')) || String(this.get('prosrc_c')).replace(/^\s+|\s+$/g, '') == '') { - err['prosrc_c'] = '{{ _('Link Symbol cannot be empty.') }}'; + err['prosrc_c'] = gettext('Link Symbol cannot be empty.'); errmsg = errmsg || err['prosrc_c']; } } else { if (_.isUndefined(this.get('prosrc')) || String(this.get('prosrc')).replace(/^\s+|\s+$/g, '') == '') { - err['prosrc'] = '{{ _('Code cannot be empty.') }}'; + err['prosrc'] = gettext('Code cannot be empty.'); errmsg = errmsg || err['prosrc']; } } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbfunc/js/edbfunc.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbfunc/js/edbfunc.js index 88c3408a1..5d0af3149 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbfunc/js/edbfunc.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbfunc/js/edbfunc.js @@ -1,15 +1,15 @@ /* Create and Register Function Collection and Node. */ -define( - ['jquery', 'underscore', 'underscore.string', - 'pgadmin', 'pgadmin.browser', 'alertify', - 'pgadmin.browser.collection', 'pgadmin.browser.server.privilege'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-edbfunc']) { pgBrowser.Nodes['coll-edbfunc'] = pgBrowser.Collection.extend({ node: 'edbfunc', - label: '{{ _('Functions') }}', + label: gettext('Functions'), type: 'coll-edbfunc', columns: ['name', 'funcowner', 'description'] }); @@ -19,7 +19,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.Nodes['edbfunc'] = pgBrowser.Node.extend({ type: 'edbfunc', dialogHelp: '{{ url_for('help.static', filename='edbfunc_dialog.html') }}', - label: '{{ _('Function') }}', + label: gettext('Function'), collection_type: 'coll-edbfunc', hasDepends: true, canEdit: false, @@ -51,41 +51,41 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { visibility: 'Unknown' }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties'], disabled: true },{ - id: 'oid', label: '{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'funcowner', label: '{{ _('Owner') }}', cell: 'string', + id: 'funcowner', label: gettext('Owner'), cell: 'string', type: 'text', disabled: true },{ - id: 'pronargs', label: '{{ _('Argument count') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', mode: ['properties'] + id: 'pronargs', label: gettext('Argument count'), cell: 'string', + type: 'text', group: gettext('Definition'), mode: ['properties'] },{ - id: 'proargs', label: '{{ _('Arguments') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', mode: ['properties'], + id: 'proargs', label: gettext('Arguments'), cell: 'string', + type: 'text', group: gettext('Definition'), mode: ['properties'], disabled: true },{ - id: 'proargtypenames', label: '{{ _('Signature arguments') }}', cell: - 'string', type: 'text', group: '{{ _('Definition') }}', mode: ['properties'], + id: 'proargtypenames', label: gettext('Signature arguments'), cell: + 'string', type: 'text', group: gettext('Definition'), mode: ['properties'], disabled: true },{ - id: 'prorettypename', label: '{{ _('Return type') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', disabled: true, + id: 'prorettypename', label: gettext('Return type'), cell: 'string', + type: 'text', group: gettext('Definition'), disabled: true, mode: ['properties'], visible: 'isVisible' },{ - id: 'visibility', label: '{{ _('Visibility') }}', cell: 'string', + id: 'visibility', label: gettext('Visibility'), cell: 'string', type: 'text', mode: ['properties'], disabled: true },{ - id: 'lanname', label: '{{ _('Language') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', disabled: true + id: 'lanname', label: gettext('Language'), cell: 'string', + type: 'text', group: gettext('Definition'), disabled: true },{ - id: 'prosrc', label: '{{ _('Code') }}', cell: 'string', + id: 'prosrc', label: gettext('Code'), cell: 'string', type: 'text', mode: ['properties'], - group: '{{ _('Definition') }}', + group: gettext('Definition'), control: Backform.SqlFieldControl, extraClasses:['custom_height_css_class'], visible: function(m) { diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbproc/js/edbproc.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbproc/js/edbproc.js index dc035b19f..6b97b4c10 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbproc/js/edbproc.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbfuncs/templates/edbproc/js/edbproc.js @@ -1,16 +1,15 @@ /* Create and Register Procedure Collection and Node. */ -define( - ['jquery', 'underscore', 'underscore.string', - 'pgadmin', 'pgadmin.browser', 'alertify', - 'pgadmin.node.edbfunc', 'pgadmin.browser.collection', - 'pgadmin.browser.server.privilege'], -function($, _, S, pgAdmin, pgBrowser, alertify, EdbFunction) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.node.edbfunc', + 'pgadmin.browser.collection', 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify, EdbFunction) { if (!pgBrowser.Nodes['coll-edbproc']) { pgAdmin.Browser.Nodes['coll-edbproc'] = pgAdmin.Browser.Collection.extend({ node: 'edbproc', - label: '{{ _('Procedures') }}', + label: gettext('Procedures'), type: 'coll-edbproc', columns: ['name', 'funcowner', 'description'], hasStatistics: true @@ -22,7 +21,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, EdbFunction) { pgAdmin.Browser.Nodes['edbproc'] = pgBrowser.Node.extend({ type: 'edbproc', dialogHelp: '{{ url_for('help.static', filename='edbproc_dialog.html') }}', - label: '{{ _('Procedure') }}', + label: gettext('Procedure'), collection_type: 'coll-edbproc', hasDepends: true, canEdit: false, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/templates/edbvar/js/edbvar.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/templates/edbvar/js/edbvar.js index 882c227a3..0a149cee8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/templates/edbvar/js/edbvar.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/edbvars/templates/edbvar/js/edbvar.js @@ -1,15 +1,15 @@ /* Create and Register Function Collection and Node. */ -define( - ['jquery', 'underscore', 'underscore.string', - 'pgadmin', 'pgadmin.browser', 'alertify', - 'pgadmin.browser.collection', 'pgadmin.browser.server.privilege'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-edbvar']) { pgBrowser.Nodes['coll-edbvar'] = pgBrowser.Collection.extend({ node: 'edbvar', - label: '{{ _('Variables') }}', + label: gettext('Variables'), type: 'coll-edbvar', columns: ['name', 'funcowner', 'description'] }); @@ -19,7 +19,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.Nodes['edbvar'] = pgBrowser.Node.extend({ type: 'edbvar', dialogHelp: '{{ url_for('help.static', filename='edbvar_dialog.html') }}', - label: '{{ _('Function') }}', + label: gettext('Function'), collection_type: 'coll-edbvar', canEdit: false, hasSQL: true, @@ -43,17 +43,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { visibility: 'Unknown' }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties'], disabled: true },{ - id: 'oid', label: '{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'datatype', label: '{{ _('Data type') }}', cell: 'string', + id: 'datatype', label: gettext('Data type'), cell: 'string', type: 'text', disabled: true },{ - id: 'visibility', label: '{{ _('Visibility') }}', cell: 'string', + id: 'visibility', label: gettext('Visibility'), cell: 'string', type: 'text', mode: ['properties'], disabled: true }], diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/package/js/package.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/package/js/package.js index 618326857..cbf08a5b0 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/package/js/package.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/package/js/package.js @@ -1,13 +1,14 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the browser's collection class for package collection if (!pgBrowser.Nodes['coll-package']) { var databases = pgBrowser.Nodes['coll-package'] = pgBrowser.Collection.extend({ node: 'package', - label: '{{ _('Packages') }}', + label: gettext('Packages'), type: 'coll-package', columns: ['name' ,'owner', 'description'] }); @@ -18,7 +19,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.Nodes['package'] = pgBrowser.Node.extend({ type: 'package', dialogHelp: '{{ url_for('help.static', filename='package_dialog.html') }}', - label: '{{ _('Package') }}', + label: gettext('Package'), collection_type: 'coll-package', hasSQL: true, hasDepends: true, @@ -33,19 +34,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_package_on_coll', node: 'coll-package', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Package...') }}', + category: 'create', priority: 4, label: gettext('Package...'), icon: 'wcTabIcon icon-package', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_package', node: 'package', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Package...') }}', + category: 'create', priority: 4, label: gettext('Package...'), icon: 'wcTabIcon icon-package', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_package', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Package...') }}', + category: 'create', priority: 4, label: gettext('Package...'), icon: 'wcTabIcon icon-package', data: {action: 'create', check: true}, enable: 'canCreate' } @@ -98,22 +99,22 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, // Define the schema for package node. schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: function(m) { return !m.isNew(); } },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text', mode: ['properties'] },{ - id: 'owner', label:'{{ _('Owner') }}', cell: 'string', + id: 'owner', label: gettext('Owner'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: true, editable: false, visible: function(m) { return !m.isNew(); } },{ - id: 'schema', label:'{{_('Schema')}}', type: 'text', node: 'schema', + id: 'schema', label: gettext('Schema'), type: 'text', node: 'schema', control: 'node-list-by-name', disabled: function(m) { return !m.isNew(); }, filter: function(d) { // If schema name start with pg_* then we need to exclude them @@ -124,28 +125,28 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return true; }, cache_node: 'database', cache_level: 'database' },{ - id: 'is_sys_object', label: '{{ _('System package?') }}', + id: 'is_sys_object', label: gettext('System package?'), cell:'boolean', type: 'switch',mode: ['properties'] },{ - id: 'description', label:'{{ _('Comment') }}', type: 'multiline', + id: 'description', label: gettext('Comment'), type: 'multiline', mode: ['properties', 'create', 'edit'] },{ - id: 'pkgheadsrc', label: '{{ _('Header') }}', cell: 'string', - type: 'text', mode: ['properties', 'create', 'edit'], group: '{{ _('Code') }}', + id: 'pkgheadsrc', label: gettext('Header'), cell: 'string', + type: 'text', mode: ['properties', 'create', 'edit'], group: gettext('Code'), control: Backform.SqlFieldControl },{ - id: 'pkgbodysrc', label: '{{ _('Body') }}', cell: 'string', - type: 'text', mode: ['properties', 'create', 'edit'], group: '{{ _('Code') }}', + id: 'pkgbodysrc', label: gettext('Body'), cell: 'string', + type: 'text', mode: ['properties', 'create', 'edit'], group: gettext('Code'), control: Backform.SqlFieldControl },{ - id: 'acl', label: '{{ _('Privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties',] + id: 'acl', label: gettext('Privileges'), type: 'text', + group: gettext('Security'), mode: ['properties',] },{ - id: 'pkgacl', label: '{{ _('Privileges') }}', type: 'collection', + id: 'pkgacl', label: gettext('Privileges'), type: 'collection', model: pgBrowser.Node.PrivilegeRoleModel.extend({ privileges: ['X'] }), uniqueCol : ['grantee', 'grantor'], editable: false, - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: gettext('Security'), mode: ['edit', 'create'], canAdd: true, canDelete: true, control: 'unique-col-collection', }], /* validate function is used to validate the input given by @@ -159,14 +160,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Name cannot be empty.') }}'; + msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; } if (_.isUndefined(this.get('pkgheadsrc')) || String(this.get('pkgheadsrc')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Header cannot be empty.') }}'; + msg = gettext('Header cannot be empty.'); this.errorModel.set('pkgheadsrc', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js index 2fb7ae502..9e6711eb0 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js @@ -1,13 +1,14 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the browser's collection class for sequence collection if (!pgBrowser.Nodes['coll-sequence']) { var databases = pgBrowser.Nodes['coll-sequence'] = pgBrowser.Collection.extend({ node: 'sequence', - label: '{{ _('Sequences') }}', + label: gettext('Sequences'), type: 'coll-sequence', columns: ['name', 'seqowner', 'comment'], hasStatistics: true @@ -21,7 +22,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'sql-altersequence.html', sqlCreateHelp: 'sql-createsequence.html', dialogHelp: '{{ url_for('help.static', filename='sequence_dialog.html') }}', - label: '{{ _('Sequence') }}', + label: gettext('Sequence'), collection_type: 'coll-sequence', hasSQL: true, hasDepends: true, @@ -37,19 +38,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_sequence_on_coll', node: 'coll-sequence', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Sequence...') }}', + category: 'create', priority: 4, label: gettext('Sequence...'), icon: 'wcTabIcon icon-sequence', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_sequence', node: 'sequence', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Sequence...') }}', + category: 'create', priority: 4, label: gettext('Sequence...'), icon: 'wcTabIcon icon-sequence', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_sequence', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Sequence...') }}', + category: 'create', priority: 4, label: gettext('Sequence...'), icon: 'wcTabIcon icon-sequence', data: {action: 'create', check: false}, enable: 'canCreate' } @@ -121,17 +122,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Define the schema for sequence node. schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'] },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text', mode: ['properties'] },{ - id: 'seqowner', label:'{{ _('Owner') }}', cell: 'string', + id: 'seqowner', label: gettext('Owner'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], node: 'role', control: Backform.NodeListByNameControl },{ - id: 'schema', label:'{{ _('Schema') }}', cell: 'string', + id: 'schema', label: gettext('Schema'), cell: 'string', control: 'node-list-by-name', node: 'schema', type: 'text', mode: ['create', 'edit'], filter: function(d) { // If schema name start with pg_* then we need to exclude them @@ -142,48 +143,48 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return true; }, cache_node: 'database', cache_level: 'database' },{ - id: 'comment', label:'{{ _('Comment') }}', type: 'multiline', + id: 'comment', label: gettext('Comment'), type: 'multiline', mode: ['properties', 'create', 'edit'] },{ - id: 'current_value', label: '{{ _('Current value') }}', type: 'int', - mode: ['properties', 'edit'], group: '{{ _('Definition') }}' + id: 'current_value', label: gettext('Current value'), type: 'int', + mode: ['properties', 'edit'], group: gettext('Definition') },{ - id: 'increment', label: '{{ _('Increment') }}', type: 'int', - mode: ['properties', 'create', 'edit'], group: '{{ _('Definition') }}', + id: 'increment', label: gettext('Increment'), type: 'int', + mode: ['properties', 'create', 'edit'], group: gettext('Definition'), min: 1 },{ - id: 'start', label: '{{ _('Start') }}', type: 'int', - mode: ['properties', 'create'], group: '{{ _('Definition') }}' + id: 'start', label: gettext('Start'), type: 'int', + mode: ['properties', 'create'], group: gettext('Definition') },{ - id: 'minimum', label: '{{ _('Minimum') }}', type: 'int', - mode: ['properties', 'create', 'edit'], group: '{{ _('Definition') }}' + id: 'minimum', label: gettext('Minimum'), type: 'int', + mode: ['properties', 'create', 'edit'], group: gettext('Definition') },{ - id: 'maximum', label: '{{ _('Maximum') }}', type: 'int', - mode: ['properties', 'create', 'edit'], group: '{{ _('Definition') }}' + id: 'maximum', label: gettext('Maximum'), type: 'int', + mode: ['properties', 'create', 'edit'], group: gettext('Definition') },{ - id: 'cache', label: '{{ _('Cache') }}', type: 'int', - mode: ['properties', 'create', 'edit'], group: '{{ _('Definition') }}', + id: 'cache', label: gettext('Cache'), type: 'int', + mode: ['properties', 'create', 'edit'], group: gettext('Definition'), min: 1 },{ - id: 'cycled', label: '{{ _('Cycled') }}', type: 'switch', - mode: ['properties', 'create', 'edit'], group: '{{ _('Definition') }}', + id: 'cycled', label: gettext('Cycled'), type: 'switch', + mode: ['properties', 'create', 'edit'], group: gettext('Definition'), options: { 'onText': 'Yes', 'offText': 'No', 'onColor': 'success', 'offColor': 'primary', 'size': 'small' } }, pgBrowser.SecurityGroupUnderSchema,{ - id: 'acl', label: '{{ _('Privileges') }}', type: 'text', - group: '{{ _("Security") }}', mode: ['properties'], disabled: true + id: 'acl', label: gettext('Privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'relacl', label: '{{ _('Privileges') }}', group: 'security', + id: 'relacl', label: gettext('Privileges'), group: 'security', model: pgBrowser.Node.PrivilegeRoleModel.extend({ privileges: ['r', 'w', 'U'] }), uniqueCol : ['grantee', 'grantor'], mode: ['edit', 'create'], editable: false, type: 'collection', canAdd: true, canDelete: true, control: 'unique-col-collection', },{ - id: 'securities', label: '{{ _('Securitiy Labels') }}', canAdd: true, + id: 'securities', label: gettext('Securitiy Labels'), canAdd: true, model: pgBrowser.SecLabelModel, editable: false, type: 'collection', canEdit: false, group: 'security', mode: ['edit', 'create'], canDelete: true, @@ -204,28 +205,28 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Name cannot be empty.') }}'; + msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; } if (_.isUndefined(this.get('seqowner')) || String(this.get('seqowner')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Owner cannot be empty.') }}'; + msg = gettext('Owner cannot be empty.'); this.errorModel.set('seqowner', msg); return msg; } if (_.isUndefined(this.get('schema')) || String(this.get('schema')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Schema cannot be empty.') }}'; + msg = gettext('Schema cannot be empty.'); this.errorModel.set('schema', msg); return msg; } - var min_lt = '{{ _('Minimum value must be less than maximum value.') }}', - start_lt = '{{ _('Start value cannot be less than minimum value.') }}', - start_gt = '{{ _('Start value cannot be greater than maximum value.') }}'; + var min_lt = gettext('Minimum value must be less than maximum value.'), + start_lt = gettext('Start value cannot be less than minimum value.'), + start_gt = gettext('Start value cannot be greater than maximum value.'); if ((minimum == 0 && maximum == 0) || (parseInt(minimum, 10) >= parseInt(maximum, 10))) { msg = min_lt diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/js/synonym.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/js/synonym.js index 6e5bcb544..0a4cf8780 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/js/synonym.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/js/synonym.js @@ -1,12 +1,13 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-synonym']) { var databases = pgAdmin.Browser.Nodes['coll-synonym'] = pgAdmin.Browser.Collection.extend({ node: 'synonym', - label: '{{ _('Synonyms') }}', + label: gettext('Synonyms'), type: 'coll-synonym', columns: ['name', 'owner','is_public_synonym'] }); @@ -16,7 +17,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgAdmin.Browser.Nodes['synonym'] = pgBrowser.Node.extend({ type: 'synonym', dialogHelp: '{{ url_for('help.static', filename='synonym_dialog.html') }}', - label: '{{ _('Synonym') }}', + label: gettext('Synonym'), collection_type: 'coll-synonym', hasSQL: true, hasDepends: true, @@ -31,19 +32,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_synonym_on_coll', node: 'coll-synonym', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Synonym...') }}', + category: 'create', priority: 4, label: gettext('Synonym...'), icon: 'wcTabIcon icon-synonym', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_synonym', node: 'synonym', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Synonym...') }}', + category: 'create', priority: 4, label: gettext('Synonym...'), icon: 'wcTabIcon icon-synonym', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_synonym', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Synonym...') }}', + category: 'create', priority: 4, label: gettext('Synonym...'), icon: 'wcTabIcon icon-synonym', data: {action: 'create', check: true}, enable: 'canCreate' } @@ -76,40 +77,40 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'inSchemaWithModelCheck' },{ - id: 'owner', label:'{{ _('Owner') }}', cell: 'string', + id: 'owner', label: gettext('Owner'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: true , control: 'node-list-by-name', node: 'role', visible: false },{ - id: 'schema', label:'{{ _('Schema') }}', cell: 'string', + id: 'schema', label: gettext('Schema'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: function(m) { return !m.isNew(); }, node: 'schema', control: 'node-list-by-name', cache_node: 'database', cache_level: 'database' },{ - id: 'targettype', label:'{{ _('Target type') }}', cell: 'string', - disabled: 'inSchema', group: '{{ _('Definition') }}', + id: 'targettype', label: gettext('Target type'), cell: 'string', + disabled: 'inSchema', group: gettext('Definition'), select2: { width: "50%", allowClear: false }, options: function(obj) { return [ - {label: "{{ _('Function') }}", value: "f"}, - {label: "{{ _('Package') }}", value: "P"}, - {label: "{{ _('Procedure') }}", value: "p"}, - {label: "{{ _('Public Synonym') }}", value: "s"}, - {label: "{{ _('Sequence') }}", value: "S"}, - {label: "{{ _('Table') }}", value: "r"}, - {label: "{{ _('View') }}", value: "v"} + {label: gettext("Function"), value: "f"}, + {label: gettext("Package"), value: "P"}, + {label: gettext("Procedure"), value: "p"}, + {label: gettext("Public Synonym"), value: "s"}, + {label: gettext("Sequence"), value: "S"}, + {label: gettext("Table"), value: "r"}, + {label: gettext("View"), value: "v"} ] }, control: 'select2' },{ - id: 'synobjschema', label:'{{ _('Target schema') }}', cell: 'string', + id: 'synobjschema', label: gettext('Target schema'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], - group: '{{ _('Definition') }}', deps: ['targettype'], + group: gettext('Definition'), deps: ['targettype'], select2: { allowClear: false }, control: 'node-list-by-name', node: 'schema', filter: function(d) { // Exclude PPAS catalogs @@ -132,8 +133,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return true; } },{ - id: 'synobjname', label:'{{ _('Target object') }}', cell: 'string', - type: 'text', disabled: 'inSchema', group: '{{ _('Definition') }}', + id: 'synobjname', label: gettext('Target object'), cell: 'string', + type: 'text', disabled: 'inSchema', group: gettext('Definition'), deps: ['targettype', 'synobjschema'], control: 'node-ajax-options', options: function(control) { @@ -173,7 +174,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return res; } },{ - id: 'is_public_synonym', label:'{{ _('Public synonym?') }}', + id: 'is_public_synonym', label: gettext('Public synonym?'), disabled: true, type: 'switch', mode: ['properties'], cell: 'switch', options: { onText: 'Yes', offText: 'No', onColor: 'success', offColor: 'primary', size: 'mini'} @@ -186,15 +187,15 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Name cannot be empty.') }}'; + msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); } else if (_.isUndefined(this.get('synobjschema')) || String(this.get('synobjschema')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Target schema cannot be empty.') }}'; + msg = gettext('Target schema cannot be empty.'); this.errorModel.set('synobjschema', msg); } else if (_.isUndefined(this.get('synobjname')) || String(this.get('synobjname')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Target object cannot be empty.') }}'; + msg = gettext('Target object cannot be empty.'); this.errorModel.set('synobjname', msg); } return null; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/templates/column/js/column.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/templates/column/js/column.js index 476be31d2..0d67e876a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/templates/column/js/column.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/templates/column/js/column.js @@ -1,13 +1,13 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', - 'backform', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'backform', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, Backform, alertify) { if (!pgBrowser.Nodes['coll-column']) { var databases = pgBrowser.Nodes['coll-column'] = pgBrowser.Collection.extend({ node: 'column', - label: '{{ _('Columns') }}', + label: gettext('Columns'), type: 'coll-column', columns: ['name', 'atttypid', 'description'] }); @@ -20,14 +20,14 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { value: null }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'select2', + id: 'name', label: gettext('Name'), cell: 'select2', type: 'text', disabled: false, node: 'column', options: [['n_distinct', 'n_distinct'], ['n_distinct_inherited','n_distinct_inherited']], select2: {placeholder: "Select variable"}, cellHeaderClasses:'width_percent_50' },{ - id: 'value', label: '{{ _('Value') }}', + id: 'value', label: gettext('Value'), type: 'text', disabled: false, cellHeaderClasses:'width_percent_50' }], @@ -38,7 +38,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { if (_.isUndefined(this.get('value')) || _.isNull(this.get('value')) || String(this.get('value')).replace(/^\s+|\s+$/g, '') == '') { - errmsg = '{{ _('Please provide input for variable.')}}'; + errmsg = gettext('Please provide input for variable.'); this.errorModel.set('value', errmsg); return errmsg; } else { @@ -88,7 +88,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { parent_type: ['table', 'view', 'mview'], collection_type: ['coll-table', 'coll-view', 'coll-mview'], type: 'column', - label: '{{ _('Column') }}', + label: gettext('Column'), hasSQL: true, sqlAlterHelp: 'sql-altertable.html', sqlCreateHelp: 'sql-altertable.html', @@ -127,25 +127,25 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { pgBrowser.add_menus([{ name: 'create_column_on_coll', node: 'coll-column', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Column...') }}', + category: 'create', priority: 4, label: gettext('Column...'), icon: 'wcTabIcon icon-column', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_column', node: 'column', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Column...') }}', + category: 'create', priority: 4, label: gettext('Column...'), icon: 'wcTabIcon icon-column', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_column_onTable', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Column...') }}', + category: 'create', priority: 4, label: gettext('Column...'), icon: 'wcTabIcon icon-column', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_column_onView', node: 'view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Column...') }}', + category: 'create', priority: 4, label: gettext('Column...'), icon: 'wcTabIcon icon-column', data: {action: 'create', check: true}, enable: 'canCreate' } @@ -175,18 +175,18 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { attprecision: null }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', disabled: 'inSchemaWithColumnCheck', cellHeaderClasses:'width_percent_30', editable: 'editable_check_for_table' },{ // Need to show this field only when creating new table // [in SubNode control] - id: 'is_primary_key', label: '{{ _('Primary key?') }}', + id: 'is_primary_key', label: gettext('Primary key?'), cell: Backgrid.Extension.TableChildSwitchCell, type: 'switch', deps:['name'], cellHeaderClasses:'width_percent_5', options: { - onText: '{{ _("Yes") }}', offText: '{{ _("No") }}', + onText: gettext('Yes'), offText: gettext('No'), onColor: 'success', offColor: 'primary' }, visible: function(m) { @@ -236,10 +236,10 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { m.set('is_primary_key', false); } },{ - id: 'attnum', label:'{{ _('Position') }}', cell: 'string', + id: 'attnum', label: gettext('Position'), cell: 'string', type: 'text', disabled: 'notInSchema', mode: ['properties'] },{ - id: 'cltype', label:'{{ _('Data type') }}', + id: 'cltype', label: gettext('Data type'), cell: Backgrid.Extension.NodeAjaxOptionsCell.extend({ exitEditMode: function(e) { var self = this; @@ -276,7 +276,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { type: 'text', disabled: 'inSchemaWithColumnCheck', control: 'node-ajax-options', url: 'get_types', node: 'table', cellHeaderClasses:'width_percent_30', first_empty: true, - select2: { allowClear: false }, group: '{{ _('Definition') }}', + select2: { allowClear: false }, group: gettext('Definition'), transform: function(data, cell) { /* 'transform' function will be called by control, and cell both. * The way, we use the transform in cell, and control is different. @@ -325,15 +325,15 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { editable: 'editable_check_for_table' },{ // Need to show this field only when creating new table [in SubNode control] - id: 'inheritedfrom', label: '{{ _('Inherited from table') }}', + id: 'inheritedfrom', label: gettext('Inherited from table'), type: 'text', disabled: true, editable: false, cellHeaderClasses:'width_percent_10', visible: function(m) { return _.isUndefined(m.top.node_info['table'] || m.top.node_info['view'] || m.top.node_info['mview']); } },{ - id: 'attlen', label:'{{ _('Length') }}', cell: IntegerDepCell, - deps: ['cltype'], type: 'int', group: '{{ _('Definition') }}', cellHeaderClasses:'width_percent_20', + id: 'attlen', label: gettext('Length'), cell: IntegerDepCell, + deps: ['cltype'], type: 'int', group: gettext('Definition'), cellHeaderClasses:'width_percent_20', disabled: function(m) { var of_type = m.get('cltype'), flag = true; @@ -388,8 +388,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return flag; } },{ - id: 'attprecision', label:'{{ _('Precision') }}', cell: IntegerDepCell, - deps: ['cltype'], type: 'int', group: '{{ _('Definition') }}', cellHeaderClasses:'width_percent_20', + id: 'attprecision', label: gettext('Precision'), cell: IntegerDepCell, + deps: ['cltype'], type: 'int', group: gettext('Definition'), cellHeaderClasses:'width_percent_20', disabled: function(m) { var of_type = m.get('cltype'), flag = true; @@ -442,9 +442,9 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return flag; } },{ - id: 'collspcname', label:'{{ _('Collation') }}', cell: 'string', + id: 'collspcname', label: gettext('Collation'), cell: 'string', type: 'text', control: 'node-ajax-options', url: 'get_collations', - group: '{{ _('Definition') }}', node: 'collation', + group: gettext('Definition'), node: 'collation', deps: ['cltype'], disabled: function(m) { var of_type = m.get('cltype'), flag = true; @@ -466,8 +466,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return flag; } },{ - id: 'defval', label:'{{ _('Default Value') }}', cell: 'string', - type: 'text', group: '{{ _('Definition') }}', deps: ['cltype'], + id: 'defval', label: gettext('Default Value'), cell: 'string', + type: 'text', group: gettext('Definition'), deps: ['cltype'], disabled: function(m) { if(!m.inSchemaWithModelCheck.apply(this, [m])) { var type = m.get('cltype'); @@ -476,16 +476,16 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } } },{ - id: 'attnotnull', label:'{{ _('Not NULL?') }}', cell: 'switch', + id: 'attnotnull', label: gettext('Not NULL?'), cell: 'switch', type: 'switch', disabled: 'inSchemaWithColumnCheck', cellHeaderClasses:'width_percent_20', - group: '{{ _('Definition') }}', editable: 'editable_check_for_table', + group: gettext('Definition'), editable: 'editable_check_for_table', options: { onText: 'Yes', offText: 'No', onColor: 'success', offColor: 'primary' } },{ - id: 'attstattarget', label:'{{ _('Statistics') }}', cell: 'string', + id: 'attstattarget', label: gettext('Statistics'), cell: 'string', type: 'text', disabled: 'inSchemaWithColumnCheck', mode: ['properties', 'edit'], - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'attstorage', label:'{{ _('Storage') }}', group: '{{ _('Definition') }}', + id: 'attstorage', label: gettext('Storage'), group: gettext('Definition'), type: 'text', mode: ['properties', 'edit'], cell: 'string', disabled: 'inSchemaWithColumnCheck', first_empty: true, control: 'select2', select2: { placeholder: "Select storage", @@ -499,21 +499,21 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { {label: "EXTENDED", value: "x"}, ] },{ - id: 'is_pk', label:'{{ _('Primary key?') }}', + id: 'is_pk', label: gettext('Primary key?'), type: 'switch', disabled: true, mode: ['properties'], - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'is_fk', label:'{{ _('Foreign key?') }}', + id: 'is_fk', label: gettext('Foreign key?'), type: 'switch', disabled: true, mode: ['properties'], - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'is_inherited', label:'{{ _('Inherited?') }}', + id: 'is_inherited', label: gettext('Inherited?'), type: 'switch', disabled: true, mode: ['properties'], - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'tbls_inherited', label:'{{ _('Inherited from table(s)') }}', + id: 'tbls_inherited', label: gettext('Inherited from table(s)'), type: 'text', disabled: true, mode: ['properties'], deps: ['is_inherited'], - group: '{{ _('Definition') }}', + group: gettext('Definition'), visible: function(m) { if (!_.isUndefined(m.get('is_inherited')) && m.get('is_inherited')) { return true; @@ -522,15 +522,15 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } } },{ - id: 'is_sys_column', label:'{{ _('System column?') }}', cell: 'string', + id: 'is_sys_column', label: gettext('System column?'), cell: 'string', type: 'switch', disabled: true, mode: ['properties'] },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', mode: ['properties', 'create', 'edit'], disabled: 'notInSchema' },{ id: 'attoptions', label: 'Variables', type: 'collection', - group: '{{ _('Variables') }}', control: 'unique-col-collection', + group: gettext('Variables'), control: 'unique-col-collection', model: VariablesModel, uniqueCol : ['name'], mode: ['edit', 'create'], canAdd: true, canEdit: false, canDelete: true @@ -542,7 +542,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { mode: ['edit'], canAdd: true, canDelete: true, uniqueCol : ['grantee'] },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', canAdd: true, + id: 'seclabels', label: gettext('Security Labels'), canAdd: true, model: pgBrowser.SecLabelModel, group: 'security', mode: ['edit', 'create'], editable: false, type: 'collection', min_version: 90100, canEdit: false, canDelete: true, @@ -563,14 +563,14 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Column name cannot be empty.') }}'; + msg = gettext('Column name cannot be empty.'); this.errorModel.set('name', msg); return msg; } if (_.isUndefined(this.get('cltype')) || String(this.get('cltype')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Column type cannot be empty.') }}'; + msg = gettext('Column type cannot be empty.'); this.errorModel.set('cltype', msg); return msg; } @@ -581,9 +581,9 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { && this.get('attlen') !== '') { // Validation for Length field if (this.get('attlen') < this.get('min_val')) - msg = '{{ _('Length should not be less than: ') }}' + this.get('min_val'); + msg = gettext('Length should not be less than: ') + this.get('min_val'); if (this.get('attlen') > this.get('max_val')) - msg = '{{ _('Length should not be greater than: ') }}' + this.get('max_val'); + msg = gettext('Length should not be greater than: ') + this.get('max_val'); // If we have any error set then throw it to user if(msg) { this.errorModel.set('attlen', msg) @@ -597,9 +597,9 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { && this.get('attprecision') !== '') { // Validation for precision field if (this.get('attprecision') < this.get('min_val')) - msg = '{{ _('Precision should not be less than: ') }}' + this.get('min_val'); + msg = gettext('Precision should not be less than: ') + this.get('min_val'); if (this.get('attprecision') > this.get('max_val')) - msg = '{{ _('Precision should not be greater than: ') }}' + this.get('max_val'); + msg = gettext('Precision should not be greater than: ') + this.get('max_val'); // If we have any error set then throw it to user if(msg) { this.errorModel.set('attprecision', msg) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/templates/check_constraint/js/check_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/templates/check_constraint/js/check_constraint.js index 6e9544c6b..25dc93306 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/templates/check_constraint/js/check_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/templates/check_constraint/js/check_constraint.js @@ -1,16 +1,14 @@ // Check Constraint Module: Node -define( - [ - 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', - 'alertify', 'pgadmin.browser.collection' - ], -function($, _, S, pgAdmin, pgBrowser, Alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, Alertify) { // Check Constraint Node if (!pgBrowser.Nodes['check_constraints']) { pgAdmin.Browser.Nodes['check_constraints'] = pgBrowser.Node.extend({ type: 'check_constraints', - label: '{{ _('Check') }}', + label: gettext('Check'), collection_type: 'coll-constraints', sqlAlterHelp: 'ddl-alter.html', sqlCreateHelp: 'ddl-constraints.html', @@ -28,13 +26,13 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { pgBrowser.add_menus([{ name: 'create_check_constraints_on_coll', node: 'coll-constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 5, label: '{{ _('Check...') }}', + category: 'create', priority: 5, label: gettext('Check...'), icon: 'wcTabIcon icon-check_constraints', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'validate_check_constraint', node: 'check_constraints', module: this, applies: ['object', 'context'], callback: 'validate_check_constraint', - category: 'validate', priority: 4, label: '{{ _('Validate check constraint') }}', + category: 'validate', priority: 4, label: gettext('Validate check constraint'), icon: 'fa fa-link', enable : 'is_not_valid', data: {action: 'edit', check: true} } ]); @@ -64,7 +62,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { type:'GET', success: function(res) { if (res.success == 1) { - Alertify.success("{{ _('" + res.info + "') }}"); + Alertify.success(res.info); t.removeIcon(i); data.valid = true; data.icon = 'icon-check_constraints'; @@ -77,8 +75,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - msg = S('{{ _(' + err.errormsg + ')}}').value(); - Alertify.error("{{ _('" + err.errormsg + "') }}"); + Alertify.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -102,13 +99,13 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { }, // Check Constraint Schema schema: [{ - id: 'name', label: '{{ _('Name') }}', type:'text', cell:'string', + id: 'name', label: gettext('Name'), type:'text', cell:'string', disabled: 'isDisabled' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'comment', label: '{{ _('Comment') }}', type: 'multiline', cell: + id: 'comment', label: gettext('Comment'), type: 'multiline', cell: 'string', mode: ['properties', 'create', 'edit'], deps:['name'], disabled:function(m) { var name = m.get('name'); @@ -123,16 +120,16 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { } } },{ - id: 'consrc', label: '{{ _('Check') }}', type: 'multiline', cell: - 'string', group: '{{ _('Definition') }}', mode: ['properties', + id: 'consrc', label: gettext('Check'), type: 'multiline', cell: + 'string', group: gettext('Definition'), mode: ['properties', 'create', 'edit'], disabled: function(m) { return ((_.has(m, 'handler') && !_.isUndefined(m.handler) && !_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew())); }, editable: false },{ - id: 'connoinherit', label: '{{ _('No Inherit?') }}', type: - 'switch', cell: 'boolean', group: '{{ _('Definition') }}', mode: + id: 'connoinherit', label: gettext('No Inherit?'), type: + 'switch', cell: 'boolean', group: gettext('Definition'), mode: ['properties', 'create', 'edit'], min_version: 90200, disabled: function(m) { return ((_.has(m, 'handler') && @@ -140,8 +137,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { !_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew())); } },{ - id: 'convalidated', label: "{{ _("Don't validate?") }}", type: 'switch', cell: - 'boolean', group: '{{ _('Definition') }}', min_version: 90200, + id: 'convalidated', label: gettext("Don't validate?"), type: 'switch', cell: + 'boolean', group: gettext('Definition'), min_version: 90200, disabled: function(m) { if ((_.isFunction(m.isNew) && !m.isNew()) || (_.has(m, 'handler') && @@ -161,7 +158,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { errmsg; if (_.isUndefined(this.get('consrc')) || String(this.get('consrc')).replace(/^\s+|\s+$/g, '') == '') { - err['consrc'] = '{{ _('Check cannot be empty!') }}'; + err['consrc'] = gettext('Check cannot be empty!'); errmsg = errmsg || err['consrc']; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/templates/exclusion_constraint/js/exclusion_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/templates/exclusion_constraint/js/exclusion_constraint.js index 5972c51df..4d62588e0 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/templates/exclusion_constraint/js/exclusion_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/templates/exclusion_constraint/js/exclusion_constraint.js @@ -1,7 +1,7 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, Alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, Alertify) { var ExclusionConstraintColumnModel = pgBrowser.Node.Model.extend({ defaults: { @@ -19,10 +19,10 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { return d; }, schema: [{ - id: 'column', label:'{{ _('Column') }}', type:'text', editable: false, + id: 'column', label: gettext('Column'), type:'text', editable: false, cell:'string' },{ - id: 'oper_class', label:'{{ _('Operator class') }}', type:'text', + id: 'oper_class', label: gettext('Operator class'), type:'text', node: 'table', url: 'get_oper_class', first_empty: true, editable: function(m) { if (m instanceof Backbone.Collection) { @@ -42,7 +42,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { }, select2: { allowClear: true, width: 'style', tags: true, - placeholder: '{{ _("Select the operator class") }}' + placeholder: gettext('Select the operator class') }, cell: Backgrid.Extension.Select2Cell.extend({ initialize: function () { Backgrid.Extension.Select2Cell.prototype.initialize.apply(this, arguments); @@ -94,7 +94,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { } }) },{ - id: 'order', label:'{{ _('DESC') }}', type: 'switch', + id: 'order', label: gettext('DESC'), type: 'switch', options: { onText: 'ASC', offText: 'DESC', @@ -115,7 +115,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { } } },{ - id: 'nulls_order', label:'{{ _('NULLs order') }}', type:"switch", + id: 'nulls_order', label: gettext('NULLs order'), type:"switch", options: { onText: 'FIRST', offText: 'LAST', @@ -136,7 +136,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { } } },{ - id: 'operator', label:'{{ _('Operator') }}', type: 'text', + id: 'operator', label: gettext('Operator'), type: 'text', node: 'table', url: 'get_operator', editable: function(m) { if (m instanceof Backbone.Collection) { @@ -199,7 +199,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { var operator = this.get('operator'), column_name = this.get('column'); if (_.isUndefined(operator) || _.isNull(operator)) { - var msg = '{{ _('Please specify operator for column: ') }}' + column_name; + var msg = gettext('Please specify operator for column: ') + column_name; this.errorModel.set('operator', msg); return msg; } @@ -399,7 +399,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { '',].join("\n") _.extend(data, { - column_label: '{{ _('Column') }}' + column_label: gettext('Column') }); var self = this, @@ -602,7 +602,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { if (!pgBrowser.Nodes['exclusion_constraint']) { pgAdmin.Browser.Nodes['exclusion_constraint'] = pgBrowser.Node.extend({ type: 'exclusion_constraint', - label: '{{ _('Exclusion constraint') }}', + label: gettext('Exclusion constraint'), collection_type: 'coll-constraints', sqlAlterHelp: 'ddl-alter.html', sqlCreateHelp: 'ddl-constraints.html', @@ -624,7 +624,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { pgBrowser.add_menus([{ name: 'create_exclusion_constraint_on_coll', node: 'coll-constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Exclusion constraint...') }}', + category: 'create', priority: 4, label: gettext('Exclusion constraint...'), icon: 'wcTabIcon icon-exclusion_constraint', data: {action: 'create', check: true}, enable: 'canCreate' }]); @@ -650,13 +650,13 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { // Define the schema for the exclusion constraint node schema: [{ - id: 'name', label: '{{ _('Name') }}', type: 'text', + id: 'name', label: gettext('Name'), type: 'text', mode: ['properties', 'create', 'edit'], editable: true, },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'comment', label:'{{ _('Comment') }}', cell: 'string', + id: 'comment', label: gettext('Comment'), cell: 'string', type: 'multiline', mode: ['properties', 'create', 'edit'], deps:['name'], disabled:function(m) { var name = m.get('name'); @@ -671,8 +671,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { } } },{ - id: 'spcname', label: '{{ _('Tablespace') }}', - type: 'text', group: '{{ _('Definition') }}', + id: 'spcname', label: gettext('Tablespace'), + type: 'text', group: gettext('Definition'), control: 'node-list-by-name', node: 'tablespace', select2:{allowClear:false}, filter: function(m) { @@ -681,8 +681,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { else return true; } },{ - id: 'amname', label: '{{ _('Access method') }}', - type: 'text', group: '{{ _('Definition') }}', + id: 'amname', label: gettext('Access method'), + type: 'text', group: gettext('Definition'), url:"get_access_methods", node: 'table', control: Backform.NodeAjaxOptionsControl.extend({ // When access method changes we need to clear columns collection @@ -696,7 +696,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { column_collection = self.model.get('columns'); if (column_collection.length > 0 && current_am != previous_am) { - var msg = '{{ _('Changing access method will clear columns collection') }}'; + var msg = gettext('Changing access method will clear columns collection'); Alertify.confirm(msg, function (e) { // User clicks Ok, lets clear collection. column_collection.each(function(m) { @@ -726,19 +726,19 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { !_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew())); } },{ - id: 'fillfactor', label: '{{ _('Fill factor') }}', - type: 'int', group: '{{ _('Definition') }}', allowNull: true + id: 'fillfactor', label: gettext('Fill factor'), + type: 'int', group: gettext('Definition'), allowNull: true },{ - id: 'condeferrable', label: '{{ _('Deferrable?') }}', - type: 'switch', group: '{{ _('Definition') }}', deps: ['index'], + id: 'condeferrable', label: gettext('Deferrable?'), + type: 'switch', group: gettext('Definition'), deps: ['index'], disabled: function(m) { return ((_.has(m, 'handler') && !_.isUndefined(m.handler) && !_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew())); } },{ - id: 'condeferred', label: '{{ _('Deferred?') }}', - type: 'switch', group: '{{ _('Definition') }}', + id: 'condeferred', label: gettext('Deferred?'), + type: 'switch', group: gettext('Definition'), deps: ['condeferrable'], disabled: function(m) { if((_.has(m, 'handler') && @@ -759,16 +759,16 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { } } },{ - id: 'constraint', label:'{{ _('Constraint') }}', cell: 'string', + id: 'constraint', label: gettext('Constraint'), cell: 'string', type: 'multiline', mode: ['create', 'edit'], editable: false, - group: '{{ _('Definition') }}', disabled: function(m) { + group: gettext('Definition'), disabled: function(m) { return ((_.has(m, 'handler') && !_.isUndefined(m.handler) && !_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew())); } },{ - id: 'columns', label: '{{ _('Columns') }}', - type: 'collection', group: '{{ _('Columns') }}', disabled: false, + id: 'columns', label: gettext('Columns'), + type: 'collection', group: gettext('Columns'), disabled: false, deps:['amname'], canDelete: true, editable: false, canAdd: function(m) { // We can't update columns of existing exclusion constraint. @@ -896,12 +896,12 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { name = this.get('name'); if ((_.isUndefined(name) || _.isNull(name) || name.length < 1)) { - var msg = '{{ _('Please specify name for exclusion constraint.') }}'; + var msg = gettext('Please specify name for exclusion constraint.'); this.errorModel.set('name', msg); return msg; } else if ((_.isUndefined(columns) || _.isNull(columns) || columns.length < 1)) { - var msg = '{{ _('Please specify columns for exclusion constraint.') }}'; + var msg = gettext('Please specify columns for exclusion constraint.'); this.errorModel.set('columns', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js index 5fbb36298..4697fcaf3 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/foreign_key/templates/foreign_key/js/foreign_key.js @@ -1,33 +1,34 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, Alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, Alertify) { var formatNode = function(opt) { - if (!opt.id) { - return opt.text; - } + if (!opt.id) { + return opt.text; + } - var optimage = $(opt.element).data('image'); + var optimage = $(opt.element).data('image'); - if(!optimage){ - return opt.text; - } else { - return $( - '' + opt.text + '' + if(!optimage) { + return opt.text; + } else { + return $( + '' + opt.text + '' ); - } - }, - headerSelectControlTemplate = _.template([ - '
', - ' ', - '
'].join("\n")); + } + }, + headerSelectControlTemplate = _.template([ + '
', + ' ', + '
'].join("\n") + ); var ForeignKeyColumnModel = pgBrowser.Node.Model.extend({ defaults: { @@ -135,7 +136,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { }), select2: { allowClear: false, width: 'style', - placeholder: '{{ _('Select column') }}', + placeholder: gettext('Select column'), first_empty: !_.isUndefined(self.model.get('oid')) }, version_compatible: self.field.get('version_compatible'), @@ -240,7 +241,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { select2: { allowClear: false, width: "style", - placeholder: '{{ _('Select column') }}', + placeholder: gettext('Select column'), templateResult: formatNode, templateSelection: formatNode }, @@ -323,9 +324,9 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { '',].join("\n") _.extend(data, { - column_label: '{{ _('Local column') }}', - references_label: '{{ _('References') }}', - referenced_label: '{{ _('Referencing') }}' + column_label: gettext('Local column'), + references_label: gettext('References'), + referenced_label: gettext('Referencing') }); var self = this, @@ -599,7 +600,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { if (!pgBrowser.Nodes['foreign_key']) { pgAdmin.Browser.Nodes['foreign_key'] = pgBrowser.Node.extend({ type: 'foreign_key', - label: '{{ _('Foreign key') }}', + label: gettext('Foreign key'), collection_type: 'coll-constraints', sqlAlterHelp: 'ddl-alter.html', sqlCreateHelp: 'ddl-constraints.html', @@ -620,13 +621,13 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { pgBrowser.add_menus([{ name: 'create_foreign_key_on_coll', node: 'coll-constraints', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Foreign key...') }}', + category: 'create', priority: 4, label: gettext('Foreign key...'), icon: 'wcTabIcon icon-foreign_key', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'validate_foreign_key', node: 'foreign_key', module: this, applies: ['object', 'context'], callback: 'validate_foreign_key', - category: 'validate', priority: 4, label: '{{ _('Validate foreign key') }}', + category: 'validate', priority: 4, label: gettext('Validate foreign key'), icon: 'fa fa-link', enable : 'is_not_valid' } ]); @@ -651,7 +652,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { type:'GET', success: function(res) { if (res.success == 1) { - Alertify.success("{{ _('" + res.info + "') }}"); + Alertify.success(res.info); t.removeIcon(i); data.valid = true; data.icon = 'icon-foreign_key'; @@ -664,8 +665,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - msg = S('{{ _(' + err.errormsg + ')}}').value(); - Alertify.error("{{ _('" + err.errormsg + "') }}"); + Alertify.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -701,14 +701,14 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { }, // Define the schema for the foreign key node schema: [{ - id: 'name', label: '{{ _('Name') }}', type: 'text', + id: 'name', label: gettext('Name'), type: 'text', mode: ['properties', 'create', 'edit'], editable:true, headerCell: Backgrid.Extension.CustomHeaderCell, cellHeaderClasses: 'width_percent_50' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'comment', label:'{{ _('Comment') }}', cell: 'string', + id: 'comment', label: gettext('Comment'), cell: 'string', type: 'multiline', mode: ['properties', 'create', 'edit'], deps:['name'], disabled:function(m) { var name = m.get('name'); @@ -723,8 +723,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { } } },{ - id: 'condeferrable', label: '{{ _('Deferrable?') }}', - type: 'switch', group: '{{ _('Definition') }}', + id: 'condeferrable', label: gettext('Deferrable?'), + type: 'switch', group: gettext('Definition'), disabled: function(m) { // If we are in table edit mode then if (_.has(m, 'handler') && !_.isUndefined(m.handler)) { @@ -736,8 +736,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { return !m.isNew(); } },{ - id: 'condeferred', label: '{{ _('Deferred?') }}', - type: 'switch', group: '{{ _('Definition') }}', + id: 'condeferred', label: gettext('Deferred?'), + type: 'switch', group: gettext('Definition'), deps: ['condeferrable'], disabled: function(m) { // If we are in table edit mode then @@ -760,8 +760,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { } } },{ - id: 'confmatchtype', label: '{{ _('Match type') }}', - type: 'switch', group: '{{ _('Definition') }}', + id: 'confmatchtype', label: gettext('Match type'), + type: 'switch', group: gettext('Definition'), options: { onText: 'FULL', offText: 'SIMPLE', @@ -776,11 +776,11 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { return !m.isNew(); } },{ - id: 'convalidated', label: "{{ _("Validated?") }}", - type: 'switch', group: '{{ _('Definition') }}', + id: 'convalidated', label: gettext("Validated?"), + type: 'switch', group: gettext('Definition'), options: { - onText: 'Yes', - offText: 'No' + onText: gettext('Yes'), + offText: gettext('No') },disabled: function(m) { // If we are in table edit mode then if (_.has(m, 'handler') && !_.isUndefined(m.handler)) { @@ -792,12 +792,12 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { return !(m.isNew() || m.get("convalidated")); } },{ - id: 'autoindex', label: '{{ _('Auto FK index?') }}', - type: 'switch', group: '{{ _('Definition') }}', + id: 'autoindex', label: gettext('Auto FK index?'), + type: 'switch', group: gettext('Definition'), deps: ['name', 'hasindex'], options: { - onText: 'Yes', - offText: 'No', + onText: gettext('Yes'), + offText: gettext('No') },disabled: function(m) { var index = m.get('coveringindex'), autoindex = m.get('autoindex'), @@ -840,8 +840,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { } } },{ - id: 'coveringindex', label: '{{ _('Covering index') }}', type: 'text', - mode: ['properties', 'create', 'edit'], group: '{{ _('Definition') }}', + id: 'coveringindex', label: gettext('Covering index'), type: 'text', + mode: ['properties', 'create', 'edit'], group: gettext('Definition'), deps:['autoindex', 'hasindex'], disabled: function(m) { var index = m.get('coveringindex'), @@ -886,8 +886,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { return setIndexName(); } },{ - id: 'columns', label: '{{ _('Columns') }}', - type: 'collection', group: '{{ _('Columns') }}', disabled: false, + id: 'columns', label: gettext('Columns'), + type: 'collection', group: gettext('Columns'), disabled: false, node: 'foreign_key', editable: false, headerCell: Backgrid.Extension.CustomHeaderCell, cellHeaderClasses: 'width_percent_50', cell: Backgrid.StringCell.extend({ @@ -994,8 +994,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { return !m.isNew(); } },{ - id: 'confupdtype', label:'{{ _('On update') }}', - type:"select2", group: '{{ _('Action') }}', mode: ['edit','create'], + id: 'confupdtype', label: gettext('On update'), + type:"select2", group: gettext('Action'), mode: ['edit','create'], select2:{width:"50%", allowClear: false}, options: [ {label: "NO ACTION", value: "a"}, @@ -1014,8 +1014,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { return !m.isNew(); } },{ - id: 'confdeltype', label:'{{ _('On delete') }}', - type:"select2", group: '{{ _('Action') }}', mode: ['edit','create'], + id: 'confdeltype', label: gettext('On delete'), + type:"select2", group: gettext('Action'), mode: ['edit','create'], select2:{width:"50%", allowClear: false}, options: [ {label: "NO ACTION", value: "a"}, @@ -1040,7 +1040,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { var columns = this.get('columns'); if ((_.isUndefined(columns) || _.isNull(columns) || columns.length < 1)) { - var msg = '{{ _('Please specify columns for Foreign key.') }}'; + var msg = gettext('Please specify columns for Foreign key.'); this.errorModel.set('columns', msg); return msg; } @@ -1049,7 +1049,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { autoindex = this.get('autoindex'); if (autoindex && (_.isUndefined(coveringindex) || _.isNull(coveringindex) || String(coveringindex).replace(/^\s+|\s+$/g, '') == '')) { - var msg = '{{ _('Please specify covering index name.') }}'; + var msg = gettext('Please specify covering index name.'); this.errorModel.set('coveringindex', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js index a792e319b..3272d4a0b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/index_constraint/templates/index_constraint/js/index_constraint.js @@ -1,7 +1,7 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { // Extend the browser's node class for index constraint node if (!pgBrowser.Nodes['{{node_type}}']) { @@ -96,15 +96,15 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { // Define the schema for the index constraint node schema: [{ - id: 'name', label: '{{ _('Name') }}', type: 'text', + id: 'name', label: gettext('Name'), type: 'text', mode: ['properties', 'create', 'edit'], editable:true, cellHeaderClasses:'width_percent_40', },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'], editable: false, cellHeaderClasses:'width_percent_20', },{ - id: 'comment', label:'{{ _('Comment') }}', cell: 'string', + id: 'comment', label: gettext('Comment'), cell: 'string', type: 'multiline', mode: ['properties', 'create', 'edit'], deps:['name'], disabled:function(m) { var name = m.get('name'); @@ -120,8 +120,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } } },{ - id: 'columns', label: '{{ _('Columns') }}', - type: 'collection', group: '{{ _('Definition') }}', + id: 'columns', label: gettext('Columns'), + type: 'collection', group: gettext('Definition'), editable: false, cell: Backgrid.StringCell.extend({ initialize: function() { @@ -226,7 +226,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { multiple: true, allowClear: true, width: 'style', - placeholder: '{{ _('Select the column(s)') }}', + placeholder: gettext('Select the column(s)'), } } ), @@ -402,8 +402,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } } },{ - id: 'spcname', label: '{{ _('Tablespace') }}', - type: 'text', group: '{{ _('Definition') }}', + id: 'spcname', label: gettext('Tablespace'), + type: 'text', group: gettext('Definition'), control: 'node-list-by-name', node: 'tablespace', deps: ['index'], select2:{allowClear:false}, @@ -426,8 +426,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } } },{ - id: 'index', label: '{{ _('Index') }}', - type: 'text', group: '{{ _('Definition') }}', + id: 'index', label: gettext('Index'), + type: 'text', group: gettext('Definition'), control: Backform.NodeListByNameControl.extend({ initialize:function() { if (_.isUndefined(this.model.top)) { @@ -453,8 +453,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return !_.isUndefined(m.top.node_info['table']); } },{ - id: 'fillfactor', label: '{{ _('Fill factor') }}', deps: ['index'], - type: 'int', group: '{{ _('Definition') }}', allowNull: true, + id: 'fillfactor', label: gettext('Fill factor'), deps: ['index'], + type: 'int', group: gettext('Definition'), allowNull: true, disabled: function(m) { // Disable if index is selected. var index = m.get('index'); @@ -468,8 +468,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } } },{ - id: 'condeferrable', label: '{{ _('Deferrable?') }}', - type: 'switch', group: '{{ _('Definition') }}', deps: ['index'], + id: 'condeferrable', label: gettext('Deferrable?'), + type: 'switch', group: gettext('Definition'), deps: ['index'], disabled: function(m) { // If we are in table edit mode then if (_.has(m, 'top') && !_.isUndefined(m.top) @@ -496,8 +496,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } } },{ - id: 'condeferred', label: '{{ _('Deferred?') }}', - type: 'switch', group: '{{ _('Definition') }}', + id: 'condeferred', label: gettext('Deferred?'), + type: 'switch', group: gettext('Definition'), deps: ['condeferrable'], disabled: function(m) { // If we are in table edit mode then @@ -537,7 +537,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if ((_.isUndefined(index) || String(index).replace(/^\s+|\s+$/g, '') == '') && (_.isUndefined(columns) || _.isNull(columns) || columns.length < 1)) { - var msg = '{{ _('Please specify columns for ') }}' + '{{ node_label }}'; + var msg = gettext('Please specify columns for %(node)s', {node: '{{ node_label }}'}); this.errorModel.set('columns', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/templates/constraints/js/constraints.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/templates/constraints/js/constraints.js index 7fc9b3d9e..b3a44c1ae 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/templates/constraints/js/constraints.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/templates/constraints/js/constraints.js @@ -1,15 +1,13 @@ -define( - [ - 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', - 'pgadmin.browser.collection'{% for c in constraints %}, 'pgadmin.node.{{ c }}'{%endfor%} - ], -function($, _, S, pgAdmin, pgBrowser) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'pgadmin.browser.collection'{% for c in constraints %}, 'pgadmin.node.{{ c|safe }}'{%endfor%} +], function(gettext, $, _, S, pgAdmin, pgBrowser) { if (!pgBrowser.Nodes['coll-constraints']) { var databases = pgAdmin.Browser.Nodes['coll-constraints'] = pgAdmin.Browser.Collection.extend({ node: 'constraints', - label: '{{ _('Constraints') }}', + label: gettext('Constraints'), type: 'coll-constraints', columns: ['name', 'comment'] }); @@ -18,7 +16,7 @@ function($, _, S, pgAdmin, pgBrowser) { if (!pgBrowser.Nodes['constraints']) { pgAdmin.Browser.Nodes['constraints'] = pgBrowser.Node.extend({ type: 'constraints', - label: '{{ _('Constraints') }}', + label: gettext('Constraints'), collection_type: 'coll-constraints', parent_type: ['table'], Init: function() { @@ -37,13 +35,13 @@ function($, _, S, pgAdmin, pgBrowser) { comment: undefined }, schema: [{ - id: 'name', label: '{{ _('Name') }}', type: 'text', + id: 'name', label: gettext('Name'), type: 'text', mode: ['properties', 'create', 'edit'] },{ - id: 'oid', label:'{{ _('Oid') }}', cell: 'string', + id: 'oid', label: gettext('Oid'), cell: 'string', type: 'text' , mode: ['properties'] },{ - id: 'comment', label:'{{ _('Comment') }}', cell: 'string', + id: 'comment', label: gettext('Comment'), cell: 'string', type: 'multiline', mode: ['properties', 'create', 'edit'] }] }) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/templates/index/js/index.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/templates/index/js/index.js index f21163b4d..680e3a1ca 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/templates/index/js/index.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/templates/index/js/index.js @@ -1,13 +1,13 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', - 'backform', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'backform', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, Backform, alertify) { if (!pgBrowser.Nodes['coll-index']) { var databases = pgAdmin.Browser.Nodes['coll-index'] = pgAdmin.Browser.Collection.extend({ node: 'index', - label: '{{ _('Indexes') }}', + label: gettext('Indexes'), type: 'coll-index', sqlAlterHelp: 'sql-alterindex.html', sqlCreateHelp: 'sql-createindex.html', @@ -58,7 +58,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { }, schema: [ { - id: 'colname', label:'{{ _('Column') }}', cell: 'node-list-by-name', + id: 'colname', label: gettext('Column'), cell: 'node-list-by-name', type: 'text', disabled: 'inSchemaWithModelCheck', editable: function(m) { // Header cell then skip if (m instanceof Backbone.Collection) { @@ -68,7 +68,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { }, control: 'node-list-by-name', node: 'column' },{ - id: 'collspcname', label:'{{ _('Collation') }}', + id: 'collspcname', label: gettext('Collation'), cell: NodeAjaxOptionsDepsCell, type: 'text', disabled: 'inSchemaWithModelCheck', editable: function(m) { // Header cell then skip @@ -79,7 +79,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { }, control: 'node-ajax-options', url: 'get_collations', node: 'index' },{ - id: 'op_class', label:'{{ _('Operator class') }}', + id: 'op_class', label: gettext('Operator class'), cell: NodeAjaxOptionsDepsCell, tags: true, type: 'text', disabled: 'checkAccessMethod', editable: function(m) { @@ -111,7 +111,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return options; } },{ - id: 'sort_order', label:'{{ _('Sort order') }}', + id: 'sort_order', label: gettext('Sort order'), cell: Backgrid.Extension.TableChildSwitchCell, type: 'switch', editable: function(m) { // Header cell then skip @@ -134,7 +134,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { 'size': 'small' } },{ - id: 'nulls', label:'{{ _('NULLs') }}', + id: 'nulls', label: gettext('NULLs'), cell: Backgrid.Extension.TableChildSwitchCell, type: 'switch', editable: function(m) { // Header cell then skip @@ -163,7 +163,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { if (_.isUndefined(this.get('colname')) || String(this.get('colname')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Column Name cannot be empty.') }}'; + msg = gettext('Column Name cannot be empty.'); this.errorModel.set('colname', msg); return msg; } @@ -215,7 +215,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { sqlAlterHelp: 'sql-alterindex.html', sqlCreateHelp: 'sql-createindex.html', type: 'index', - label: '{{ _('Index') }}', + label: gettext('Index'), hasSQL: true, hasDepends: true, hasStatistics: true, @@ -230,25 +230,25 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { pgBrowser.add_menus([{ name: 'create_index_on_coll', node: 'coll-index', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Index...') }}', + category: 'create', priority: 4, label: gettext('Index...'), icon: 'wcTabIcon icon-index', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_index', node: 'index', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Index...') }}', + category: 'create', priority: 4, label: gettext('Index...'), icon: 'wcTabIcon icon-index', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_index_onTable', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Index...') }}', + category: 'create', priority: 4, label: gettext('Index...'), icon: 'wcTabIcon icon-index', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_index_onMatView', node: 'mview', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 5, label: '{{ _('Index...') }}', + category: 'create', priority: 5, label: gettext('Index...'), icon: 'wcTabIcon icon-index', data: {action: 'create', check: true}, enable: 'canCreate' } @@ -268,13 +268,13 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { amname: 'btree' }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', disabled: 'inSchema' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'int', disabled: true, mode: ['edit', 'properties'] },{ - id: 'spcname', label:'{{ _('Tablespace') }}', cell: 'string', + id: 'spcname', label: gettext('Tablespace'), cell: 'string', control: 'node-list-by-name', node: 'tablespace', select2: {'allowClear': true}, type: 'text', mode: ['properties', 'create', 'edit'], @@ -287,10 +287,10 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return true; } },{ - id: 'amname', label:'{{ _('Access Method') }}', cell: 'string', + id: 'amname', label: gettext('Access Method'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'inSchemaWithModelCheck', url: 'get_access_methods', - group: '{{ _('Definition') }}', select2: {'allowClear': true}, + group: gettext('Definition'), select2: {'allowClear': true}, control: Backform.NodeAjaxOptionsControl.extend({ // When access method changes we need to clear columns collection onChange: function() { @@ -301,7 +301,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { // previous access method previous_am = self.model.previous('amname'); if (current_am != previous_am && self.model.get('columns').length !== 0) { - var msg = '{{ _('Changing access method will clear columns collection') }}'; + var msg = gettext('Changing access method will clear columns collection'); alertify.confirm(msg, function (e) { // User clicks Ok, lets clear collection var column_collection = self.model.get('columns'), @@ -319,43 +319,43 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } }) },{ - id: 'cols', label:'{{ _('Columns') }}', cell: 'string', + id: 'cols', label: gettext('Columns'), cell: 'string', type: 'text', disabled: 'inSchema', mode: ['properties'], - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'fillfactor', label:'{{ _('Fill factor') }}', cell: 'string', + id: 'fillfactor', label: gettext('Fill factor'), cell: 'string', type: 'int', disabled: 'inSchema', mode: ['create', 'edit', 'properties'], - min: 10, max:100, group: '{{ _('Definition') }}' + min: 10, max:100, group: gettext('Definition') },{ - id: 'indisunique', label:'{{ _('Unique?') }}', cell: 'string', + id: 'indisunique', label: gettext('Unique?'), cell: 'string', type: 'switch', disabled: 'inSchemaWithModelCheck', - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'indisclustered', label:'{{ _('Clustered?') }}', cell: 'string', + id: 'indisclustered', label: gettext('Clustered?'), cell: 'string', type: 'switch', disabled: 'inSchema', - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'indisvalid', label:'{{ _('Valid?') }}', cell: 'string', + id: 'indisvalid', label: gettext('Valid?'), cell: 'string', type: 'switch', disabled: true, mode: ['properties'], - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'indisprimary', label:'{{ _('Primary?') }}', cell: 'string', + id: 'indisprimary', label: gettext('Primary?'), cell: 'string', type: 'switch', disabled: true, mode: ['properties'], - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'is_sys_idx', label:'{{ _('System index?') }}', cell: 'string', + id: 'is_sys_idx', label: gettext('System index?'), cell: 'string', type: 'switch', disabled: true, mode: ['properties'] },{ - id: 'isconcurrent', label:'{{ _('Concurrent build?') }}', cell: 'string', + id: 'isconcurrent', label: gettext('Concurrent build?'), cell: 'string', type: 'switch', disabled: 'inSchemaWithModelCheck', - mode: ['create', 'edit'], group: '{{ _('Definition') }}' + mode: ['create', 'edit'], group: gettext('Definition') },{ - id: 'indconstraint', label:'{{ _('Constraint') }}', cell: 'string', + id: 'indconstraint', label: gettext('Constraint'), cell: 'string', type: 'text', disabled: 'inSchemaWithModelCheck', mode: ['create', 'edit'], - control: 'sql-field', visible: true, group: '{{ _('Definition') }}' + control: 'sql-field', visible: true, group: gettext('Definition') },{ id: 'columns', label: 'Columns', type: 'collection', deps: ['amname'], - group: '{{ _('Definition') }}', model: ColumnModel, mode: ['edit', 'create'], + group: gettext('Definition'), model: ColumnModel, mode: ['edit', 'create'], canAdd: function(m) { // We will disable it if it's in 'edit' mode if (m.isNew()) { @@ -376,7 +376,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { control: 'unique-col-collection', uniqueCol : ['colname'], columns: ['colname', 'op_class', 'sort_order', 'nulls', 'collspcname'] },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', mode: ['properties', 'create', 'edit'], disabled: 'inSchema' } @@ -396,19 +396,19 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Name cannot be empty.') }}'; + msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; } if (_.isUndefined(this.get('spcname')) || String(this.get('spcname')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Tablespace cannot be empty.') }}'; + msg = gettext('Tablespace cannot be empty.'); this.errorModel.set('spcname', msg); return msg; } if (_.isUndefined(this.get('amname')) || String(this.get('amname')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Access method cannot be empty.') }}'; + msg = gettext('Access method cannot be empty.'); this.errorModel.set('amname', msg); return msg; } @@ -416,12 +416,12 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { var cols = this.get('columns'); if(cols && cols.length > 0) { if(!_.every(cols.pluck('colname'))) { - msg = '{{ _('You must specify column name.') }}'; + msg = gettext('You must specify column name.'); this.errorModel.set('columns', msg); return msg; } } else if(cols){ - msg = '{{ _('You must specify at least one column.') }}'; + msg = gettext('You must specify at least one column.'); this.errorModel.set('columns', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/templates/rules/js/rules.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/templates/rules/js/rules.js index d34e3ce32..719d1e49d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/templates/rules/js/rules.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/templates/rules/js/rules.js @@ -1,8 +1,7 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'codemirror'], - -function($, _, S, pgAdmin, pgBrowser, CodeMirror) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'codemirror' +], function(gettext, $, _, S, pgAdmin, pgBrowser, CodeMirror) { /** Create and add a rule collection into nodes @@ -15,7 +14,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { var rules = pgAdmin.Browser.Nodes['coll-rule'] = pgAdmin.Browser.Collection.extend({ node: 'rule', - label: '{{ _("Rules") }}', + label: gettext('Rules'), type: 'coll-rule', columns: ["name", "owner", "comment"] }); @@ -40,7 +39,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { sqlAlterHelp: 'sql-alterrule.html', sqlCreateHelp: 'sql-createrule.html', dialogHelp: '{{ url_for('help.static', filename='rule_dialog.html') }}', - label: '{{ _("rule") }}', + label: gettext('rule'), collection_type: 'coll-table', hasSQL: true, hasDepends: true, @@ -78,25 +77,25 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { pgBrowser.add_menus([{ name: 'create_rule_on_coll', node: 'coll-rule', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 1, label: '{{ _("Rule...") }}', + category: 'create', priority: 1, label: gettext('Rule...'), icon: 'wcTabIcon icon-rule', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_rule_onView', node: 'view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 5, label: '{{ _("Rule...") }}', + category: 'create', priority: 5, label: gettext('Rule...'), icon: 'wcTabIcon icon-rule', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_rule', node: 'rule', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 1, label: '{{ _("Rule...") }}', + category: 'create', priority: 1, label: gettext('Rule...'), icon: 'wcTabIcon icon-rule', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_rule', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _("Rule...") }}', + category: 'create', priority: 4, label: gettext('Rule...'), icon: 'wcTabIcon icon-rule', data: {action: 'create', check: true}, enable: 'canCreate' } @@ -109,7 +108,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { */ model: pgAdmin.Browser.Node.Model.extend({ schema: [{ - id: 'name', label: '{{ _("Name") }}', + id: 'name', label: gettext('Name'), type: 'text', disabled: function(m) { // disable name field it it is system rule if (m && m.get('name') == "_RETURN") { @@ -124,7 +123,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { } }, { - id: 'oid', label:'{{ _("OID") }}', + id: 'oid', label: gettext('OID'), type: 'text', disabled: true, mode: ['properties'] }, { @@ -143,8 +142,8 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { } }, { - id: 'event', label:'{{ _("Event") }}', control: 'select2', - group: '{{ _("Definition") }}', type: 'text', + id: 'event', label: gettext('Event'), control: 'select2', + group: gettext('Definition'), type: 'text', select2: { width: '100%', allowClear: false @@ -157,29 +156,29 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { ] }, { - id: 'do_instead', label:'{{ _("Do Instead") }}', group: '{{ _("Definition") }}', + id: 'do_instead', label: gettext('Do Instead'), group: gettext('Definition'), type: 'switch' }, { - id: 'condition', label:'{{ _("Condition") }}', - type: 'text', group: '{{ _("Definition") }}', + id: 'condition', label: gettext('Condition'), + type: 'text', group: gettext('Definition'), control: Backform.SqlFieldControl }, { - id: 'statements', label:'{{ _("Commands") }}', - type: 'text', group: '{{ _("Definition") }}', + id: 'statements', label: gettext('Commands'), + type: 'text', group: gettext('Definition'), control: Backform.SqlFieldControl }, { - id: 'system_rule', label:'{{ _("System rule?") }}', + id: 'system_rule', label: gettext('System rule?'), type: 'switch', mode: ['properties'] }, { - id: 'enabled', label:'{{ _("Enabled?") }}', + id: 'enabled', label: gettext('Enabled?'), type: 'switch', mode: ['properties'] }, { - id: 'comment', label:'{{ _("Comment") }}', cell: 'string', type: 'multiline' + id: 'comment', label: gettext('Comment'), cell: 'string', type: 'multiline' } ], validate: function() { @@ -191,7 +190,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { if (_.isUndefined(field_name) || _.isNull(field_name) || String(field_name).replace(/^\s+|\s+$/g, '') === '') { - err['name'] = '{{ _("Please specify name.") }}'; + err['name'] = gettext('Please specify name.'); errmsg = errmsg || err['name']; this.errorModel.set('name', errmsg); return errmsg; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js index bf6b76f54..f534fc825 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js @@ -1,16 +1,14 @@ -define( - [ - 'jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', - 'pgadmin.node.column', 'pgadmin.node.constraints' - ], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.node.column', 'pgadmin.node.constraints' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-table']) { var databases = pgBrowser.Nodes['coll-table'] = pgBrowser.Collection.extend({ node: 'table', - label: '{{ _('Tables') }}', + label: gettext('Tables'), type: 'coll-table', columns: ['name', 'relowner', 'description'], hasStatistics: true, @@ -23,7 +21,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['table']) { pgBrowser.Nodes['table'] = pgBrowser.Node.extend({ type: 'table', - label: '{{ _('Table') }}', + label: gettext('Table'), collection_type: 'coll-table', hasSQL: true, hasDepends: true, @@ -48,46 +46,46 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_table_on_coll', node: 'coll-table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 1, label: '{{ _('Table...') }}', + category: 'create', priority: 1, label: gettext('Table...'), icon: 'wcTabIcon icon-table', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_table', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 1, label: '{{ _('Table...') }}', + category: 'create', priority: 1, label: gettext('Table...'), icon: 'wcTabIcon icon-table', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_table__on_schema', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Table...') }}', + category: 'create', priority: 4, label: gettext('Table...'), icon: 'wcTabIcon icon-table', data: {action: 'create', check: false}, enable: 'canCreate' },{ name: 'truncate_table', node: 'table', module: this, applies: ['object', 'context'], callback: 'truncate_table', - category: 'Truncate', priority: 3, label: '{{ _('Truncate') }}', + category: 'Truncate', priority: 3, label: gettext('Truncate'), icon: 'fa fa-eraser', enable : 'canCreate' },{ name: 'truncate_table_cascade', node: 'table', module: this, applies: ['object', 'context'], callback: 'truncate_table_cascade', - category: 'Truncate', priority: 3, label: '{{ _('Truncate Cascade') }}', + category: 'Truncate', priority: 3, label: gettext('Truncate Cascade'), icon: 'fa fa-eraser', enable : 'canCreate' },{ // To enable/disable all triggers for the table name: 'enable_all_triggers', node: 'table', module: this, applies: ['object', 'context'], callback: 'enable_triggers_on_table', - category: 'Trigger(s)', priority: 4, label: '{{ _('Enable All') }}', + category: 'Trigger(s)', priority: 4, label: gettext('Enable All'), icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable' },{ name: 'disable_all_triggers', node: 'table', module: this, applies: ['object', 'context'], callback: 'disable_triggers_on_table', - category: 'Trigger(s)', priority: 4, label: '{{ _('Disable All') }}', + category: 'Trigger(s)', priority: 4, label: gettext('Disable All'), icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable' },{ name: 'reset_table_stats', node: 'table', module: this, applies: ['object', 'context'], callback: 'reset_table_stats', - category: 'Reset', priority: 4, label: '{{ _('Reset Statistics') }}', + category: 'Reset', priority: 4, label: gettext('Reset Statistics'), icon: 'fa fa-bar-chart', enable : 'canCreate' } ]); @@ -123,7 +121,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success("{{ _('" + res.info + "') }}"); + alertify.success(res.info); t.unload(i); t.setInode(i); t.deselect(i); @@ -136,8 +134,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - msg = S('{{ _(' + err.errormsg + ')}}').value(); - alertify.error("{{ _('" + err.errormsg + "') }}"); + alertify.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -165,7 +162,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return false; alertify.confirm( - S('{{ _('Are you sure you want to truncate table %s?') }}').sprintf(d.label).value(), + S(gettext('Are you sure you want to truncate table %s?')).sprintf(d.label).value(), function (e) { if (e) { var data = d; @@ -176,7 +173,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success("{{ _('" + res.info + "') }}"); + alertify.success(res.info); t.removeIcon(i); data.icon = 'icon-table'; t.addIcon(i, {icon: data.icon}); @@ -193,8 +190,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - msg = S('{{ _(' + err.errormsg + ')}}').value(); - alertify.error("{{ _('" + err.errormsg + "') }}"); + alertify.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -214,8 +210,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return false; alertify.confirm( - '{{ _('Reset statistics') }}', - S('{{ _('Are you sure you want to reset the statistics for table %s?') }}').sprintf(d._label).value(), + gettext('Reset statistics'), + S(gettext('Are you sure you want to reset the statistics for table %s?')).sprintf(d._label).value(), function (e) { if (e) { var data = d; @@ -224,7 +220,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { type:'DELETE', success: function(res) { if (res.success == 1) { - alertify.success("{{ _('" + res.info + "') }}"); + alertify.success(res.info); t.removeIcon(i); data.icon = 'icon-table'; t.addIcon(i, {icon: data.icon}); @@ -241,8 +237,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - msg = S('{{ _(' + err.errormsg + ')}}').value(); - alertify.error("{{ _('" + err.errormsg + "') }}"); + alertify.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -299,16 +294,16 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, schema: [{ - id: 'name', label: '{{ _('Name') }}', type: 'text', + id: 'name', label: gettext('Name'), type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'inSchema' },{ - id: 'oid', label:'{{ _('OID') }}', type: 'text', mode: ['properties'] + id: 'oid', label: gettext('OID'), type: 'text', mode: ['properties'] },{ - id: 'relowner', label:'{{ _('Owner') }}', type: 'text', node: 'role', + id: 'relowner', label: gettext('Owner'), type: 'text', node: 'role', mode: ['properties', 'create', 'edit'], select2: {allowClear: false}, disabled: 'inSchema', control: 'node-list-by-name' },{ - id: 'schema', label:'{{_('Schema')}}', type: 'text', node: 'schema', + id: 'schema', label: gettext('Schema'), type: 'text', node: 'schema', control: 'node-list-by-name', mode: ['create', 'edit'], disabled: 'inSchema', filter: function(d) { // If schema name start with pg_* then we need to exclude them @@ -319,7 +314,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return true; }, cache_node: 'database', cache_level: 'database' },{ - id: 'spcname', label:'{{ _('Tablespace') }}', node: 'tablespace', + id: 'spcname', label: gettext('Tablespace'), node: 'tablespace', type: 'text', control: 'node-list-by-name', disabled: 'inSchema', mode: ['properties', 'create', 'edit'], filter: function(d) { @@ -327,15 +322,15 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return (!(d && d.label.match(/pg_global/))) } },{ - id: 'description', label:'{{ _('Comment') }}', type: 'multiline', + id: 'description', label: gettext('Comment'), type: 'multiline', mode: ['properties', 'create', 'edit'], disabled: 'inSchema' },{ - id: 'coll_inherits', label: '{{ _('Inherited from table(s)') }}', - url: 'get_inherits', type: 'array', group: '{{ _('Columns') }}', + id: 'coll_inherits', label: gettext('Inherited from table(s)'), + url: 'get_inherits', type: 'array', group: gettext('Columns'), disabled: 'checkInheritance', deps: ['typname'], mode: ['create', 'edit'], select2: { multiple: true, allowClear: true, - placeholder: '{{ _('Select to inherit from...') }}'}, + placeholder: gettext('Select to inherit from...')}, transform: function(data, cell) { var control = cell || this, m = control.model; @@ -416,16 +411,16 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } }) },{ - id: 'coll_inherits', label: '{{ _('Inherited from table(s)') }}', - type: 'text', group: '{{ _('Advanced') }}', mode: ['properties'] + id: 'coll_inherits', label: gettext('Inherited from table(s)'), + type: 'text', group: gettext('Advanced'), mode: ['properties'] },{ - id: 'inherited_tables_cnt', label:'{{ _('Inherited tables count') }}', - type: 'text', mode: ['properties'], group: '{{ _('Advanced') }}', + id: 'inherited_tables_cnt', label: gettext('Inherited tables count'), + type: 'text', mode: ['properties'], group: gettext('Advanced'), disabled: 'inSchema' },{ // Tab control for columns - id: 'columns', label:'{{ _('Columns') }}', type: 'collection', - group: '{{ _('Columns') }}', + id: 'columns', label: gettext('Columns'), type: 'collection', + group: gettext('Columns'), model: pgBrowser.Nodes['column'].model, subnode: pgBrowser.Nodes['column'].model, mode: ['create', 'edit'], @@ -524,14 +519,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { allowMultipleEmptyRow: false },{ // Here we will create tab control for constraints - type: 'nested', control: 'tab', group: '{{ _('Constraints') }}', + type: 'nested', control: 'tab', group: gettext('Constraints'), mode: ['edit', 'create'], schema: [{ - id: 'primary_key', label: '{{ _('Primary key') }}', + id: 'primary_key', label: gettext('Primary key'), model: pgBrowser.Nodes['primary_key'].model, subnode: pgBrowser.Nodes['primary_key'].model, editable: false, type: 'collection', - group: '{{ _('Primary Key') }}', mode: ['edit', 'create'], + group: gettext('Primary Key'), mode: ['edit', 'create'], canEdit: true, canDelete: true, control: 'unique-col-collection', columns : ['name', 'columns'], @@ -545,11 +540,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { _.some(columns.pluck('name'))); } },{ - id: 'foreign_key', label: '{{ _('Foreign key') }}', + id: 'foreign_key', label: gettext('Foreign key'), model: pgBrowser.Nodes['foreign_key'].model, subnode: pgBrowser.Nodes['foreign_key'].model, editable: false, type: 'collection', - group: '{{ _('Foreign Key') }}', mode: ['edit', 'create'], + group: gettext('Foreign Key'), mode: ['edit', 'create'], canEdit: true, canDelete: true, control: 'unique-col-collection', canAdd: true, @@ -560,21 +555,21 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return _.some(columns.pluck('name')); } },{ - id: 'check_constraint', label: '{{ _('Check constraint') }}', + id: 'check_constraint', label: gettext('Check constraint'), model: pgBrowser.Nodes['check_constraints'].model, subnode: pgBrowser.Nodes['check_constraints'].model, editable: false, type: 'collection', - group: '{{ _('Check') }}', mode: ['edit', 'create'], + group: gettext('Check'), mode: ['edit', 'create'], canEdit: true, canDelete: true, control: 'unique-col-collection', canAdd: true, columns : ['name', 'consrc'] },{ - id: 'unique_constraint', label: '{{ _('Unique Constraint') }}', + id: 'unique_constraint', label: gettext('Unique Constraint'), model: pgBrowser.Nodes['unique_constraint'].model, subnode: pgBrowser.Nodes['unique_constraint'].model, editable: false, type: 'collection', - group: '{{ _('Unique') }}', mode: ['edit', 'create'], + group: gettext('Unique'), mode: ['edit', 'create'], canEdit: true, canDelete: true, control: 'unique-col-collection', columns : ['name', 'columns'], @@ -585,11 +580,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return _.some(columns.pluck('name')); } },{ - id: 'exclude_constraint', label: '{{ _('Exclude constraint') }}', + id: 'exclude_constraint', label: gettext('Exclude constraint'), model: pgBrowser.Nodes['exclusion_constraint'].model, subnode: pgBrowser.Nodes['exclusion_constraint'].model, editable: false, type: 'collection', - group: '{{ _('Exclude') }}', mode: ['edit', 'create'], + group: gettext('Exclude'), mode: ['edit', 'create'], canEdit: true, canDelete: true, control: 'unique-col-collection', columns : ['name', 'columns', 'constraint'], @@ -601,9 +596,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } }] },{ - id: 'typname', label:'{{ _('Of type') }}', type: 'text', + id: 'typname', label: gettext('Of type'), type: 'text', control: 'node-ajax-options', mode: ['properties', 'create', 'edit'], - disabled: 'checkOfType', url: 'get_oftype', group: '{{ _('Advanced') }}', + disabled: 'checkOfType', url: 'get_oftype', group: gettext('Advanced'), deps: ['coll_inherits'], transform: function(data, cell) { var control = cell || this, m = control.model; @@ -623,7 +618,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (!_.isUndefined(tbl_name) && tbl_name !== '' && column_collection.length !== 0) { - var msg = '{{ _('Changing of type table will clear columns collection') }}'; + var msg = gettext('Changing of type table will clear columns collection'); alertify.confirm(msg, function (e) { if (e) { // User clicks Ok, lets clear columns collection @@ -646,91 +641,91 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } }) },{ - id: 'fillfactor', label:'{{ _('Fill factor') }}', type: 'int', + id: 'fillfactor', label: gettext('Fill factor'), type: 'int', mode: ['create', 'edit'], min: 10, max: 100, - disabled: 'inSchema',group: '{{ _('Advanced') }}' + disabled: 'inSchema',group: gettext('Advanced') },{ - id: 'relhasoids', label:'{{ _('Has OIDs?') }}', cell: 'switch', + id: 'relhasoids', label: gettext('Has OIDs?'), cell: 'switch', type: 'switch', mode: ['properties', 'create', 'edit'], - disabled: 'inSchema', group: '{{ _('Advanced') }}' + disabled: 'inSchema', group: gettext('Advanced') },{ - id: 'relpersistence', label:'{{ _('Unlogged?') }}', cell: 'switch', + id: 'relpersistence', label: gettext('Unlogged?'), cell: 'switch', type: 'switch', mode: ['properties', 'create', 'edit'], disabled: 'inSchemaWithModelCheck', - group: '{{ _('Advanced') }}' + group: gettext('Advanced') },{ - id: 'conname', label:'{{ _('Primary key') }}', cell: 'string', - type: 'text', mode: ['properties'], group: '{{ _('Advanced') }}', + id: 'conname', label: gettext('Primary key'), cell: 'string', + type: 'text', mode: ['properties'], group: gettext('Advanced'), disabled: 'inSchema' },{ - id: 'reltuples', label:'{{ _('Rows (estimated)') }}', cell: 'string', - type: 'text', mode: ['properties'], group: '{{ _('Advanced') }}', + id: 'reltuples', label: gettext('Rows (estimated)'), cell: 'string', + type: 'text', mode: ['properties'], group: gettext('Advanced'), disabled: 'inSchema' },{ - id: 'rows_cnt', label:'{{ _('Rows (counted)') }}', cell: 'string', - type: 'text', mode: ['properties'], group: '{{ _('Advanced') }}', + id: 'rows_cnt', label: gettext('Rows (counted)'), cell: 'string', + type: 'text', mode: ['properties'], group: gettext('Advanced'), disabled: 'inSchema' },{ - id: 'relhassubclass', label:'{{ _('Inherits tables?') }}', cell: 'switch', - type: 'switch', mode: ['properties'], group: '{{ _('Advanced') }}', + id: 'relhassubclass', label: gettext('Inherits tables?'), cell: 'switch', + type: 'switch', mode: ['properties'], group: gettext('Advanced'), disabled: 'inSchema' },{ - id: 'is_sys_table', label:'{{ _('System table?') }}', cell: 'switch', + id: 'is_sys_table', label: gettext('System table?'), cell: 'switch', type: 'switch', mode: ['properties'], disabled: 'inSchema' },{ - type: 'nested', control: 'fieldset', label: '{{ _('Like') }}', - group: '{{ _('Advanced') }}', + type: 'nested', control: 'fieldset', label: gettext('Like'), + group: gettext('Advanced'), schema:[{ - id: 'like_relation', label:'{{ _('Relation') }}', + id: 'like_relation', label: gettext('Relation'), type: 'text', mode: ['create', 'edit'], deps: ['typname'], control: 'node-ajax-options', url: 'get_relations', - disabled: 'isLikeDisable', group: '{{ _('Like') }}' + disabled: 'isLikeDisable', group: gettext('Like') },{ - id: 'like_default_value', label:'{{ _('With default values?') }}', + id: 'like_default_value', label: gettext('With default values?'), type: 'switch', mode: ['create', 'edit'], deps: ['typname'], - disabled: 'isLikeDisable', group: '{{ _('Like') }}' + disabled: 'isLikeDisable', group: gettext('Like') },{ - id: 'like_constraints', label:'{{ _('With constraints?') }}', + id: 'like_constraints', label: gettext('With constraints?'), type: 'switch', mode: ['create', 'edit'], deps: ['typname'], - disabled: 'isLikeDisable', group: '{{ _('Like') }}' + disabled: 'isLikeDisable', group: gettext('Like') },{ - id: 'like_indexes', label:'{{ _('With indexes?') }}', + id: 'like_indexes', label: gettext('With indexes?'), type: 'switch', mode: ['create', 'edit'], deps: ['typname'], - disabled: 'isLikeDisable', group: '{{ _('Like') }}' + disabled: 'isLikeDisable', group: gettext('Like') },{ - id: 'like_storage', label:'{{ _('With storage?') }}', + id: 'like_storage', label: gettext('With storage?'), type: 'switch', mode: ['create', 'edit'], deps: ['typname'], - disabled: 'isLikeDisable', group: '{{ _('Like') }}' + disabled: 'isLikeDisable', group: gettext('Like') },{ - id: 'like_comments', label:'{{ _('With comments?') }}', + id: 'like_comments', label: gettext('With comments?'), type: 'switch', mode: ['create', 'edit'], deps: ['typname'], - disabled: 'isLikeDisable', group: '{{ _('Like') }}' + disabled: 'isLikeDisable', group: gettext('Like') }] },{ // Here - we will create tab control for storage parameters // (auto vacuum). - type: 'nested', control: 'tab', group: '{{ _('Parameter') }}', + type: 'nested', control: 'tab', group: gettext('Parameter'), mode: ['edit', 'create'], schema: Backform.VacuumSettingsSchema },{ - id: 'relacl_str', label:'{{ _('Privileges') }}', disabled: 'inSchema', - type: 'text', mode: ['properties'], group: '{{ _('Security') }}' + id: 'relacl_str', label: gettext('Privileges'), disabled: 'inSchema', + type: 'text', mode: ['properties'], group: gettext('Security') }, pgBrowser.SecurityGroupUnderSchema,{ - id: 'relacl', label: '{{ _('Privileges') }}', type: 'collection', + id: 'relacl', label: gettext('Privileges'), type: 'collection', group: 'security', control: 'unique-col-collection', model: pgBrowser.Node.PrivilegeRoleModel.extend({ privileges: ['a','r','w','d','D','x','t']}), mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['grantee'] },{ - id: 'seclabels', label: '{{ _('Security labels') }}', canEdit: false, + id: 'seclabels', label: gettext('Security labels'), canEdit: false, model: pgBrowser.SecLabelModel, editable: false, canAdd: true, type: 'collection', min_version: 90100, mode: ['edit', 'create'], group: 'security', canDelete: true, control: 'unique-col-collection' },{ - id: 'vacuum_settings_str', label: '{{ _('Storage settings') }}', - type: 'multiline', group: '{{ _('Advanced') }}', mode: ['properties'] + id: 'vacuum_settings_str', label: gettext('Storage settings'), + type: 'multiline', group: gettext('Advanced'), mode: ['properties'] }], validate: function(keys) { var err = {}, @@ -753,17 +748,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Table name cannot be empty.') }}'; + msg = gettext('Table name cannot be empty.'); this.errorModel.set('name', msg); return msg; } else if (_.isUndefined(schema) || _.isNull(schema) || String(schema).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Table schema cannot be empty.') }}'; + msg = gettext('Table schema cannot be empty.'); this.errorModel.set('schema', msg); return msg; } else if (_.isUndefined(relowner) || _.isNull(relowner) || String(relowner).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Table owner cannot be empty.') }}'; + msg = gettext('Table owner cannot be empty.'); this.errorModel.set('relowner', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js index 852b4f8ed..ec9960ef2 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/templates/trigger/js/trigger.js @@ -1,8 +1,7 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', - 'backform', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { - +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'backform', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, Backform, alertify) { var CustomSwitchControl = Backform.CustomSwitchControl = Backform.SwitchControl.extend({ template: _.template([ @@ -27,7 +26,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { var triggers = pgAdmin.Browser.Nodes['coll-trigger'] = pgAdmin.Browser.Collection.extend({ node: 'trigger', - label: '{{ _('Triggers') }}', + label: gettext('Triggers'), type: 'coll-trigger', columns: ['name', 'description'] }); @@ -38,7 +37,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { parent_type: ['table', 'view'], collection_type: ['coll-table', 'coll-view'], type: 'trigger', - label: '{{ _('Trigger') }}', + label: gettext('Trigger'), hasSQL: true, hasDepends: true, width: '650px', @@ -55,35 +54,35 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { pgBrowser.add_menus([{ name: 'create_trigger_on_coll', node: 'coll-trigger', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Trigger...') }}', + category: 'create', priority: 4, label: gettext('Trigger...'), icon: 'wcTabIcon icon-trigger', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_trigger', node: 'trigger', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Trigger...') }}', + category: 'create', priority: 4, label: gettext('Trigger...'), icon: 'wcTabIcon icon-trigger', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_trigger_onTable', node: 'table', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Trigger...') }}', + category: 'create', priority: 4, label: gettext('Trigger...'), icon: 'wcTabIcon icon-trigger', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'enable_trigger', node: 'trigger', module: this, applies: ['object', 'context'], callback: 'enable_trigger', - category: 'connect', priority: 3, label: '{{ _('Enable trigger') }}', + category: 'connect', priority: 3, label: gettext('Enable trigger'), icon: 'fa fa-check', enable : 'canCreate_with_trigger_enable' },{ name: 'disable_trigger', node: 'trigger', module: this, applies: ['object', 'context'], callback: 'disable_trigger', - category: 'drop', priority: 3, label: '{{ _('Disable trigger') }}', + category: 'drop', priority: 3, label: gettext('Disable trigger'), icon: 'fa fa-times', enable : 'canCreate_with_trigger_disable' },{ name: 'create_trigger_onView', node: 'view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Trigger...') }}', + category: 'create', priority: 4, label: gettext('Trigger...'), icon: 'wcTabIcon icon-trigger', data: {action: 'create', check: true}, enable: 'canCreate' } @@ -109,7 +108,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success("{{ _('" + res.info + "') }}"); + alertify.success(res.info); t.removeIcon(i); data.icon = 'icon-trigger'; t.addIcon(i, {icon: data.icon}); @@ -126,8 +125,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - msg = S('{{ _(' + err.errormsg + ')}}').value(); - alertify.error("{{ _('" + err.errormsg + "') }}"); + alertify.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -153,7 +151,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { dataType: "json", success: function(res) { if (res.success == 1) { - alertify.success("{{ _('" + res.info + "') }}"); + alertify.success(res.info); t.removeIcon(i); data.icon = 'icon-trigger-bad'; t.addIcon(i, {icon: data.icon}); @@ -170,8 +168,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { try { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - msg = S('{{ _(' + err.errormsg + ')}}').value(); - alertify.error("{{ _('" + err.errormsg + "') }}"); + alertify.error(err.errormsg); } } catch (e) {} t.unload(i); @@ -188,18 +185,18 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { fires: 'BEFORE' }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', disabled: 'inSchema' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'int', disabled: true, mode: ['properties'] },{ - id: 'is_enable_trigger', label:'{{ _('Trigger enabled?') }}', + id: 'is_enable_trigger', label: gettext('Trigger enabled?'), type: 'switch', disabled: 'inSchema', mode: ['edit', 'properties'], - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'is_row_trigger', label:'{{ _('Row trigger?') }}', - type: 'switch', group: '{{ _('Definition') }}', + id: 'is_row_trigger', label: gettext('Row trigger?'), + type: 'switch', group: gettext('Definition'), mode: ['create','edit', 'properties'], deps: ['is_constraint_trigger'], disabled: function(m) { @@ -226,13 +223,13 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } } },{ - id: 'is_constraint_trigger', label:'{{ _('Constraint trigger?') }}', + id: 'is_constraint_trigger', label: gettext('Constraint trigger?'), type: 'switch', disabled: 'inSchemaWithModelCheck', mode: ['create','edit', 'properties'], - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'tgdeferrable', label:'{{ _('Deferrable?') }}', - type: 'switch', group: '{{ _('Definition') }}', + id: 'tgdeferrable', label: gettext('Deferrable?'), + type: 'switch', group: gettext('Definition'), mode: ['create','edit', 'properties'], deps: ['is_constraint_trigger'], disabled: function(m) { @@ -255,8 +252,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } } },{ - id: 'tginitdeferred', label:'{{ _('Deferred?') }}', - type: 'switch', group: '{{ _('Definition') }}', + id: 'tginitdeferred', label: gettext('Deferred?'), + type: 'switch', group: gettext('Definition'), mode: ['create','edit', 'properties'], deps: ['tgdeferrable', 'is_constraint_trigger'], disabled: function(m) { @@ -280,14 +277,14 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } } },{ - id: 'tfunction', label:'{{ _('Trigger Function') }}', + id: 'tfunction', label: gettext('Trigger Function'), type: 'text', disabled: 'inSchemaWithModelCheck', - mode: ['create','edit', 'properties'], group: '{{ _('Definition') }}', + mode: ['create','edit', 'properties'], group: gettext('Definition'), control: 'node-ajax-options', url: 'get_triggerfunctions', cache_node: 'trigger_function' },{ - id: 'tgargs', label:'{{ _('Arguments') }}', cell: 'string', - group: '{{ _('Definition') }}', + id: 'tgargs', label: gettext('Arguments'), cell: 'string', + group: gettext('Definition'), type: 'text',mode: ['create','edit', 'properties'], deps: ['tfunction'], disabled: function(m) { // We will disable it when EDB PPAS and trigger function is @@ -310,8 +307,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } } },{ - id: 'fires', label:'{{ _('Fires') }}', deps: ['is_constraint_trigger'], - mode: ['create','edit', 'properties'], group: '{{ _('Events') }}', + id: 'fires', label: gettext('Fires'), deps: ['is_constraint_trigger'], + mode: ['create','edit', 'properties'], group: gettext('Events'), options: function(control) { var table_options = [ {label: "BEFORE", value: "BEFORE"}, @@ -352,11 +349,11 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } },{ type: 'nested', control: 'fieldset', mode: ['create','edit', 'properties'], - label: '{{ _('Events') }}', group: '{{ _('Events') }}', + label: gettext('Events'), group: gettext('Events'), schema:[{ - id: 'evnt_insert', label:'{{ _('INSERT') }}', + id: 'evnt_insert', label: gettext('INSERT'), type: 'switch', mode: ['create','edit', 'properties'], - group: '{{ _('Events') }}', + group: gettext('Events'), control: Backform.CustomSwitchControl, disabled: function(m) { var evn_insert = m.get('evnt_insert'); @@ -365,9 +362,9 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return m.inSchemaWithModelCheck.apply(this, [m]); } },{ - id: 'evnt_update', label:'{{ _('UPDATE') }}', + id: 'evnt_update', label: gettext('UPDATE'), type: 'switch', mode: ['create','edit', 'properties'], - group: '{{ _('Events') }}', + group: gettext('Events'), control: Backform.CustomSwitchControl, disabled: function(m) { var evn_update = m.get('evnt_update'); @@ -376,9 +373,9 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return m.inSchemaWithModelCheck.apply(this, [m]); } },{ - id: 'evnt_delete', label:'{{ _('DELETE') }}', + id: 'evnt_delete', label: gettext('DELETE'), type: 'switch', mode: ['create','edit', 'properties'], - group: '{{ _('Events') }}', + group: gettext('Events'), control: Backform.CustomSwitchControl, disabled: function(m) { var evn_delete = m.get('evnt_delete'); @@ -387,8 +384,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return m.inSchemaWithModelCheck.apply(this, [m]); } },{ - id: 'evnt_truncate', label:'{{ _('TRUNCATE') }}', - type: 'switch', group: '{{ _('Events') }}', + id: 'evnt_truncate', label: gettext('TRUNCATE'), + type: 'switch', group: gettext('Events'), control: Backform.CustomSwitchControl, disabled: function(m) { var is_constraint_trigger = m.get('is_constraint_trigger'), @@ -413,15 +410,15 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } }] },{ - id: 'whenclause', label:'{{ _('When') }}', + id: 'whenclause', label: gettext('When'), type: 'text', disabled: 'inSchemaWithModelCheck', mode: ['create', 'edit', 'properties'], - control: 'sql-field', visible: true, group: '{{ _('Events') }}' + control: 'sql-field', visible: true, group: gettext('Events') },{ - id: 'columns', label: '{{ _('Columns') }}', url: 'nodes', + id: 'columns', label: gettext('Columns'), url: 'nodes', control: 'node-list-by-name', cache_node: 'column', type: 'array', select2: {'multiple': true}, - deps: ['evnt_update'], node: 'column', group: '{{ _('Events') }}', + deps: ['evnt_update'], node: 'column', group: gettext('Events'), disabled: function(m) { if(this.node_info && 'catalog' in this.node_info) { return true; @@ -438,7 +435,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return true; } },{ - id: 'prosrc', label:'{{ _('Code') }}', group: '{{ _('Code') }}', + id: 'prosrc', label: gettext('Code'), group: gettext('Code'), type: 'text', mode: ['create', 'edit'], deps: ['tfunction'], control: 'sql-field', visible: true, disabled: function(m) { @@ -455,14 +452,14 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return true; } },{ - id: 'is_sys_trigger', label:'{{ _('System trigger?') }}', cell: 'string', + id: 'is_sys_trigger', label: gettext('System trigger?'), cell: 'string', type: 'switch', disabled: 'inSchemaWithModelCheck', mode: ['properties'] },{ - id: 'is_constarint', label:'{{ _('Constraint?') }}', cell: 'string', + id: 'is_constarint', label: gettext('Constraint?'), cell: 'string', type: 'switch', disabled: 'inSchemaWithModelCheck', mode: ['properties'], - group: '{{ _('Definition') }}' + group: gettext('Definition') },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', mode: ['properties', 'create', 'edit'], disabled: 'inSchema' }], @@ -478,20 +475,20 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { if(_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Name cannot be empty.') }}'; + msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; } if(_.isUndefined(this.get('tfunction')) || String(this.get('tfunction')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Trigger function cannot be empty.') }}'; + msg = gettext('Trigger function cannot be empty.'); this.errorModel.set('tfunction', msg); return msg; } if(!this.get('evnt_truncate') && !this.get('evnt_delete') && !this.get('evnt_update') && !this.get('evnt_insert')) { - msg = '{{ _('Specify at least one event.') }}'; + msg = gettext('Specify at least one event.'); this.errorModel.set('evnt_truncate', " "); this.errorModel.set('evnt_delete', " "); this.errorModel.set('evnt_update', " "); @@ -504,7 +501,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { (_.isUndefined(this.get('prosrc')) || String(this.get('prosrc')).replace(/^\s+|\s+$/g, '') == '')) { - msg = '{{ _('Trigger code cannot be empty.') }}'; + msg = gettext('Trigger code cannot be empty.'); this.errorModel.set('prosrc', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/js/catalog.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/js/catalog.js index 9e7ff08df..5ed830af8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/js/catalog.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/catalog/js/catalog.js @@ -1,14 +1,14 @@ - define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'backform', 'alertify', 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'backform', 'alertify', 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, Backform, alertify) { // Extend the browser's collection class for catalog collection if (!pgBrowser.Nodes['coll-catalog']) { var databases = pgBrowser.Nodes['coll-catalog'] = pgBrowser.Collection.extend({ node: 'catalog', - label: '{{ _('Catalogs') }}', + label: gettext('Catalogs'), type: 'coll-catalog', columns: ['name', 'namespaceowner', 'description'] }); @@ -18,7 +18,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { pgBrowser.Nodes['catalog'] = pgBrowser.Node.extend({ parent_type: 'database', type: 'catalog', - label: '{{ _('Catalog') }}', + label: gettext('Catalog'), hasSQL: true, hasDepends: true, Init: function() { @@ -48,24 +48,24 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { pgBrowser.Node.Model.prototype.initialize.apply(this, arguments); }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', disabled: true },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', mode: ['properties'], + id: 'oid', label: gettext('OID'), cell: 'string', mode: ['properties'], type: 'text', disabled: true },{ - id: 'namespaceowner', label:'{{ _('Owner') }}', cell: 'string', + id: 'namespaceowner', label: gettext('Owner'), cell: 'string', type: 'text', disabled: true },{ - id: 'acl', label: '{{ _('Privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'acl', label: gettext('Privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline' },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', + id: 'seclabels', label: gettext('Security Labels'), model: pgBrowser.SecLabelModel, editable: false, type: 'collection', - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: gettext('Security'), mode: ['edit', 'create'], min_version: 90200, canAdd: true, canEdit: false, canDelete: true, control: 'unique-col-collection' } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js index cd55e0bc1..8af509420 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js @@ -1,10 +1,8 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'backform', 'alertify', - 'pgadmin.browser.collection', - 'pgadmin.browser.server.privilege'], -function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { - +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'backform', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, Backform, alertify) { // VacuumSettings Collection to display all settings parameters as Grid var VacuumCollectionControl = Backform.VacuumCollectionControl = @@ -109,7 +107,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { }; pgBrowser.SecurityGroupUnderSchema = { - id: 'security', label: '{{ _("Security") }}', type: 'group', + id: 'security', label: gettext('Security'), type: 'group', // Show/Hide security group for nodes under the catalog visible: function(args) { if (args && 'node_info' in args) { @@ -143,8 +141,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { // Extend the browser's collection class for VacuumSettingsModel var VacuumSettingsSchema = Backform.VacuumSettingsSchema = [{ - id: 'autovacuum_custom', label: '{{ _("Custom auto-vacuum?") }}', - group: '{{ _("Table") }}', mode: ['edit', 'create'], + id: 'autovacuum_custom', label: gettext('Custom auto-vacuum?'), + group: gettext('Table'), mode: ['edit', 'create'], type: 'switch', disabled: function(m) { if(!m.top.inSchema.apply(this, [m])) { @@ -153,8 +151,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return true; } },{ - id: 'autovacuum_enabled', label: '{{ _("Enabled?") }}', - group: '{{ _("Table") }}', mode: ['edit', 'create'], + id: 'autovacuum_enabled', label: gettext('Enabled?'), + group: gettext('Table'), mode: ['edit', 'create'], type: 'switch', deps: ['autovacuum_custom'], disabled: function(m) { @@ -170,26 +168,26 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return true; } },{ - id: 'vacuum_table', label: '{{ _("Vacuum Table") }}', + id: 'vacuum_table', label: gettext('Vacuum Table'), model: Backform.VacuumTableModel, editable: false, type: 'collection', - canEdit: true, group: '{{ _("Table") }}', + canEdit: true, group: gettext('Table'), mode: ['edit', 'create'], url: 'get_table_vacuum', control: Backform.VacuumCollectionControl.extend({ grid_columns :[ { - name: 'label', label: '{{ _("Label") }}', + name: 'label', label: gettext('Label'), headerCell: Backgrid.Extension.CustomHeaderCell, cell: 'string', editable: false, cellHeaderClasses:'width_percent_40' }, { - name: 'value', label: '{{ _("Value") }}', + name: 'value', label: gettext('Value'), cellHeaderClasses:'width_percent_30', cellFunction: Backform.cellFunction, editable: function(m) { return m.handler.get('autovacuum_enabled'); }, headerCell: Backgrid.Extension.CustomHeaderCell }, { - name: 'setting', label: '{{ _("Default value") }}', + name: 'setting', label: gettext('Default value'), cellHeaderClasses:'width_percent_30', headerCell: Backgrid.Extension.CustomHeaderCell, cellFunction: Backform.cellFunction, editable: false @@ -198,8 +196,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { }), deps: ['autovacuum_enabled'] },{ - id: 'toast_autovacuum', label: '{{ _("Custom auto-vacuum?") }}', - group: '{{ _("Toast Table") }}', mode: ['edit', 'create'], + id: 'toast_autovacuum', label: gettext('Custom auto-vacuum?'), + group: gettext('Toast Table'), mode: ['edit', 'create'], type: 'switch', disabled: function(m) { // We need to check additional condition to toggle enable/disable @@ -214,8 +212,8 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return true; } },{ - id: 'toast_autovacuum_enabled', label: '{{ _("Enabled?") }}', - group: '{{ _("Toast Table") }}', mode: ['edit', 'create'], + id: 'toast_autovacuum_enabled', label: gettext('Enabled?'), + group: gettext('Toast Table'), mode: ['edit', 'create'], type: 'switch', deps:['toast_autovacuum'], disabled: function(m) { @@ -234,21 +232,21 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return true; } },{ - id: 'vacuum_toast', label: '{{ _("Vacuum Toast Table") }}', + id: 'vacuum_toast', label: gettext('Vacuum Toast Table'), model: Backform.VacuumTableModel, type: 'collection', editable: function(m) { return m.isNew(); }, - canEdit: true, group: '{{ _("Toast Table") }}', + canEdit: true, group: gettext('Toast Table'), mode: ['properties', 'edit', 'create'], url: 'get_toast_table_vacuum', control: Backform.VacuumCollectionControl.extend({ grid_columns :[ { - name: 'label', label: '{{ _("Label") }}', + name: 'label', label: gettext('Label'), headerCell: Backgrid.Extension.CustomHeaderCell, cell: 'string', editable: false, cellHeaderClasses:'width_percent_40' }, { - name: 'value', label: '{{ _("Value") }}', + name: 'value', label: gettext('Value'), cellHeaderClasses:'width_percent_30', headerCell: Backgrid.Extension.CustomHeaderCell, cellFunction: Backform.cellFunction, editable: function(m) { @@ -256,7 +254,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { } }, { - name: 'setting', label: '{{ _("Default value") }}', + name: 'setting', label: gettext('Default value'), cellHeaderClasses:'width_percent_30', headerCell: Backgrid.Extension.CustomHeaderCell, cellFunction: Backform.cellFunction, editable: false @@ -271,7 +269,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { var databases = pgBrowser.Nodes['coll-schema'] = pgBrowser.Collection.extend({ node: 'schema', - label: '{{ _('Schemas') }}', + label: gettext('Schemas'), type: 'coll-schema', columns: ['name', 'namespaceowner', 'description'] }); @@ -284,7 +282,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { sqlAlterHelp: 'sql-alterschema.html', sqlCreateHelp: 'sql-createschema.html', dialogHelp: '{{ url_for('help.static', filename='schema_dialog.html') }}', - label: '{{ _('Schema') }}', + label: gettext('Schema'), hasSQL: true, canDrop: true, canDropCascade: true, @@ -299,17 +297,17 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { pgBrowser.add_menus([{ name: 'create_schema_on_coll', node: 'coll-schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Schema...') }}', + category: 'create', priority: 4, label: gettext('Schema...'), icon: 'wcTabIcon icon-schema', data: {action: 'create'} },{ name: 'create_schema', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Schema...') }}', + category: 'create', priority: 4, label: gettext('Schema...'), icon: 'wcTabIcon icon-schema', data: {action: 'create'} },{ name: 'create_schema', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Schema...') }}', + category: 'create', priority: 4, label: gettext('Schema...'), icon: 'wcTabIcon icon-schema', data: {action: 'create'}, enable: 'can_create_schema' } @@ -336,81 +334,81 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { pgBrowser.Node.Model.prototype.initialize.apply(this, arguments); }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text', disabled: true, mode: ['properties'] },{ - id: 'namespaceowner', label:'{{ _('Owner') }}', cell: 'string', + id: 'namespaceowner', label: gettext('Owner'), cell: 'string', type: 'text', control: 'node-list-by-name', node: 'role', select2: { allowClear: false } },{ - id: 'is_sys_object', label:'{{ _('System schema?') }}', + id: 'is_sys_object', label: gettext('System schema?'), cell: 'switch', type: 'switch', mode: ['properties'], disabled: true },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline' },{ - id: 'acl', label: '{{ _('Privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'acl', label: gettext('Privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'tblacl', label: '{{ _('Default TABLE privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'tblacl', label: gettext('Default TABLE privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'seqacl', label: '{{ _('Default SEQUENCE privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'seqacl', label: gettext('Default SEQUENCE privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'funcacl', label: '{{ _('Default FUNCTION privileges') }}', - group: '{{ _('Security') }}', type: 'text', mode: ['properties'], disabled: true + id: 'funcacl', label: gettext('Default FUNCTION privileges'), + group: gettext('Security'), type: 'text', mode: ['properties'], disabled: true },{ - id: 'typeacl', label: '{{ _('Default TYPE privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true, min_version: 90200, + id: 'typeacl', label: gettext('Default TYPE privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true, min_version: 90200, visible: function() { return this.version_compatible; } },{ - id: 'nspacl', label: '{{ _('Privileges') }}', + id: 'nspacl', label: gettext('Privileges'), model: pgBrowser.Node.PrivilegeRoleModel.extend( {privileges: ['C', 'U']}), uniqueCol : ['grantee', 'grantor'], - editable: false, type: 'collection', group: '{{ _('Security') }}', + editable: false, type: 'collection', group: gettext('Security'), mode: ['edit', 'create'], canAdd: true, canDelete: true, control: 'unique-col-collection', },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', + id: 'seclabels', label: gettext('Security Labels'), model: pgBrowser.SecLabelModel, editable: false, type: 'collection', - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: gettext('Security'), mode: ['edit', 'create'], min_version: 90200, canAdd: true, canEdit: false, canDelete: true, control: 'unique-col-collection' },{ - type: 'nested', control: 'tab', group: '{{ _('Default Privileges') }}', + type: 'nested', control: 'tab', group: gettext('Default Privileges'), mode: ['create','edit'], schema:[{ id: 'deftblacl', model: pgBrowser.Node.PrivilegeRoleModel.extend( {privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}), - label: '{{ _('Default Privileges: Tables') }}', - editable: false, type: 'collection', group: '{{ _('Tables') }}', + label: gettext('Default Privileges: Tables'), + editable: false, type: 'collection', group: gettext('Tables'), mode: ['edit', 'create'], control: 'unique-col-collection', canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor'] },{ id: 'defseqacl', model: pgBrowser.Node.PrivilegeRoleModel.extend( {privileges: ['r', 'w', 'U']}), - label: '{{ _('Default Privileges: Sequences') }}', - editable: false, type: 'collection', group: '{{ _('Sequences') }}', + label: gettext('Default Privileges: Sequences'), + editable: false, type: 'collection', group: gettext('Sequences'), mode: ['edit', 'create'], control: 'unique-col-collection', canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor'] },{ id: 'deffuncacl', model: pgBrowser.Node.PrivilegeRoleModel.extend( {privileges: ['X']}), - label: '{{ _('Default Privileges: Functions') }}', - editable: false, type: 'collection', group: '{{ _('Functions') }}', + label: gettext('Default Privileges: Functions'), + editable: false, type: 'collection', group: gettext('Functions'), mode: ['edit', 'create'], control: 'unique-col-collection', canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor'] },{ id: 'deftypeacl', model: pgBrowser.Node.PrivilegeRoleModel.extend( {privileges: ['U']}), - label: '{{ _('Default Privileges: Types') }}', - editable: false, type: 'collection', group: '{{ _('Types') }}', + label: gettext('Default Privileges: Types'), + editable: false, type: 'collection', group: gettext('Types'), mode: ['edit', 'create'], control: 'unique-col-collection', canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor'], min_version: 90200 @@ -425,13 +423,13 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { if (_.isUndefined(this.get('name')) || _.isNull(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - errmsg = '{{ _('Name cannot be empty.')}}'; + errmsg = gettext('Name cannot be empty.'); this.errorModel.set('name', errmsg); return errmsg; } else if (_.isUndefined(this.get('namespaceowner')) || _.isNull(this.get('namespaceowner')) || String(this.get('namespaceowner')).replace(/^\s+|\s+$/g, '') == '') { - errmsg = '{{ _('Owner cannot be empty.')}}'; + errmsg = gettext('Owner cannot be empty.'); this.errorModel.set('namespaceowner', errmsg); return errmsg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js index 775ef2d41..5d702bae6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js @@ -1,14 +1,14 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'backgrid', 'pgadmin.backgrid', - 'pgadmin.browser.collection'], -function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'backgrid', 'pgadmin.backgrid', + 'pgadmin.browser.collection' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { if (!pgBrowser.Nodes['coll-type']) { var databases = pgBrowser.Nodes['coll-type'] = pgBrowser.Collection.extend({ node: 'type', - label: '{{ _('Types') }}', + label: gettext('Types'), type: 'coll-type', columns: ['name', 'typeowner', 'description'] }); @@ -81,10 +81,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { type_options: undefined, subtypes: undefined, schema: [{ - id: 'member_name', label: '{{ _('Member Name') }}', + id: 'member_name', label: gettext('Member Name'), type: 'text', disabled: false, editable: true },{ - id: 'type', label: '{{ _('Type') }}', control: 'node-ajax-options', + id: 'type', label: gettext('Type'), control: 'node-ajax-options', type: 'text', url: 'get_types', disabled: false, node: 'type', cell: 'node-ajax-options', select2: {allowClear: false}, editable: true, @@ -96,7 +96,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { // Note: There are ambiguities in the PG catalogs and docs between // precision and scale. In the UI, we try to follow the docs as // closely as possible, therefore we use Length/Precision and Scale - id: 'tlength', label: '{{ _('Length/precision') }}', deps: ['type'], type: 'text', + id: 'tlength', label: gettext('Length/precision'), deps: ['type'], type: 'text', disabled: false, cell: IntegerDepCell, editable: function(m) { // We will store type from selected from combobox @@ -126,7 +126,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { // Note: There are ambiguities in the PG catalogs and docs between // precision and scale. In the UI, we try to follow the docs as // closely as possible, therefore we use Length/Precision and Scale - id: 'precision', label: '{{ _('Scale') }}', deps: ['type'], + id: 'precision', label: gettext('Scale'), deps: ['type'], type: 'text', disabled: false, cell: IntegerDepCell, editable: function(m) { // We will store type from selected from combobox @@ -153,7 +153,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { return m.get('is_precision'); } },{ - id: 'collation', label: '{{ _('Collation') }}', + id: 'collation', label: gettext('Collation'), cell: NodeAjaxOptionsDepsCell, deps: ['type'], select2: {allowClear: false}, control: 'node-ajax-options', editable: function(m) { @@ -189,14 +189,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { if ( _.isUndefined(this.get('member_name')) || _.isNull(this.get('member_name')) || String(this.get('member_name')).replace(/^\s+|\s+$/g, '') == '') { - errmsg = '{{ _('Please specify the value for member name.') }}'; + errmsg = gettext('Please specify the value for member name.'); this.errorModel.set('member_name', errmsg) return errmsg; } else if ( _.isUndefined(this.get('type')) || _.isNull(this.get('type')) || String(this.get('type')).replace(/^\s+|\s+$/g, '') == '') { - errmsg = '{{ _('Please specify the type.') }}'; + errmsg = gettext('Please specify the type.'); this.errorModel.set('type', errmsg) return errmsg; } @@ -204,9 +204,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { else if (this.get('is_tlength') && !_.isUndefined(this.get('tlength'))) { if (this.get('tlength') < this.get('min_val')) - errmsg = '{{ _('Length/precision should not be less than ') }}' + this.get('min_val'); + errmsg = gettext('Length/precision should not be less than %(value)s', {value: this.get('min_val')}); if (this.get('tlength') > this.get('max_val') ) - errmsg = '{{ _('Length/precision should not be greater than ') }}' + this.get('max_val'); + errmsg = gettext('Length/precision should not be greater than %(value)s', {value: this.get('max_val')}); // If we have any error set then throw it to user if(errmsg) { this.errorModel.set('tlength', errmsg) @@ -217,9 +217,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { else if (this.get('is_precision') && !_.isUndefined(this.get('precision'))) { if (this.get('precision') < this.get('min_val')) - errmsg = '{{ _('Scale should not be less than ') }}' + this.get('min_val'); + errmsg = gettext('Scale should not be less than %(value)s', {value: this.get('min_val')}); if (this.get('precision') > this.get('max_val')) - errmsg = '{{ _('Scale should not be greater than ') }}' + this.get('max_val'); + errmsg = gettext('Scale should not be greater than %(value)s', {value: this.get('max_val')}); // If we have any error set then throw it to user if(errmsg) { this.errorModel.set('precision', errmsg) @@ -235,7 +235,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { label: undefined, }, schema: [{ - id: 'label', label: '{{ _('Label') }}',type: 'text', disabled: false, + id: 'label', label: gettext('Label'),type: 'text', disabled: false, cellHeaderClasses: 'width_percent_99', editable: function(m) { return _.isUndefined(m.get('label')); } @@ -251,7 +251,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { sqlAlterHelp: 'sql-altertype.html', sqlCreateHelp: 'sql-createtype.html', dialogHelp: '{{ url_for('help.static', filename='type_dialog.html') }}', - label: '{{ _('Type') }}', + label: gettext('Type'), collection_type: 'coll-type', hasSQL: true, hasDepends: true, @@ -266,19 +266,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { pgBrowser.add_menus([{ name: 'create_type_on_coll', node: 'coll-type', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Type...') }}', + category: 'create', priority: 4, label: gettext('Type...'), icon: 'wcTabIcon icon-type', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_type', node: 'type', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Type...') }}', + category: 'create', priority: 4, label: gettext('Type...'), icon: 'wcTabIcon icon-type', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_type', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Type...') }}', + category: 'create', priority: 4, label: gettext('Type...'), icon: 'wcTabIcon icon-type', data: {action: 'create', check: false}, enable: 'canCreate' } @@ -310,19 +310,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'schemaCheck' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text' , mode: ['properties'], disabled: true },{ - id: 'typeowner', label:'{{ _('Owner') }}', cell: 'string', + id: 'typeowner', label: gettext('Owner'), cell: 'string', control: 'node-list-by-name', type: 'text', mode: ['properties', 'create', 'edit'], node: 'role', disabled: 'inSchema', select2: {allowClear: false} },{ - id: 'schema', label:'{{ _('Schema') }}', cell: 'string', + id: 'schema', label: gettext('Schema'), cell: 'string', type: 'text', mode: ['create', 'edit'], node: 'schema', disabled: 'schemaCheck', filter: function(d) { // If schema name start with pg_* then we need to exclude them @@ -334,9 +334,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { }, cache_node: 'database', cache_level: 'database', control: 'node-list-by-name', select2: {allowClear: false} },{ - id: 'typtype', label:'{{ _('Type') }}', + id: 'typtype', label: gettext('Type'), mode: ['create','edit'], disabled: 'inSchemaWithModelCheck', - group: '{{ _('Definition') }}', + group: gettext('Definition'), mode: ['edit', 'create'], select2: { width: "50%", allowClear: false }, options: function(obj) { @@ -361,9 +361,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { } }) },{ - id: 'composite', label: '{{ _('Composite Type') }}', + id: 'composite', label: gettext('Composite Type'), model: CompositeModel, editable: true, type: 'collection', - group: '{{ _('Definition') }}', mode: ['edit', 'create'], + group: gettext('Definition'), mode: ['edit', 'create'], control: 'unique-col-collection', uniqueCol : ['member_name'], canAdd: true, canEdit: false, canDelete: true, disabled: 'inSchema', deps: ['typtype'], @@ -371,9 +371,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { return m.get('typtype') === 'c'; } },{ - id: 'enum', label: '{{ _('Enumeration Type') }}', + id: 'enum', label: gettext('Enumeration Type'), model: EnumModel, editable: true, type: 'collection', - group: '{{ _('Definition') }}', mode: ['edit', 'create'], + group: gettext('Definition'), mode: ['edit', 'create'], canAdd: true, canEdit: false, canDelete: function(m) { // We will disable it if it's in 'edit' mode if (m.isNew()) { @@ -389,24 +389,24 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { } },{ // We will disable range type control in edit mode - type: 'nested', control: 'plain-fieldset', group: '{{ _('Definition') }}', + type: 'nested', control: 'plain-fieldset', group: gettext('Definition'), mode: ['edit', 'create'], visible: function(m) { return m.get('typtype') === 'r'; }, deps: ['typtype'], label: '', schema:[{ - id: 'typname', label:'{{ _('Subtype') }}', cell: 'string', + id: 'typname', label: gettext('Subtype'), cell: 'string', control: 'node-ajax-options', select2: { allowClear: true, placeholder: "", width: "100%" }, url: 'get_stypes', type: 'text', mode: ['properties', 'create', 'edit'], - group: '{{ _('Range Type') }}', disabled: 'inSchemaWithModelCheck', + group: gettext('Range Type'), disabled: 'inSchemaWithModelCheck', transform: function(d, self){ self.model.subtypes = d; return d; } },{ - id: 'opcname', label:'{{ _('Subtype operator class') }}', cell: 'string', - mode: ['properties', 'create', 'edit'], group: '{{ _('Range Type') }}', + id: 'opcname', label: gettext('Subtype operator class'), cell: 'string', + mode: ['properties', 'create', 'edit'], group: gettext('Range Type'), disabled: 'inSchemaWithModelCheck', deps: ['typname'], control: 'select', options: function() { var l_typname = this.model.get('typname'), @@ -437,9 +437,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { return result; } },{ - id: 'collname', label:'{{ _('Collation') }}', cell: 'string', + id: 'collname', label: gettext('Collation'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], - group: '{{ _('Range Type') }}', + group: gettext('Range Type'), deps: ['typname'], control: 'node-ajax-options', url: 'get_collations', select2: { allowClear: true, placeholder: "", width: "100%" }, disabled: function(m) { @@ -471,9 +471,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { return is_collate ? false : true; } },{ - id: 'rngcanonical', label:'{{ _('Canonical function') }}', cell: 'string', + id: 'rngcanonical', label: gettext('Canonical function'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], - group: '{{ _('Range Type') }}', + group: gettext('Range Type'), disabled: 'inSchemaWithModelCheck', deps: ['name', 'typname'], control: 'select', options: function() { var name = this.model.get('name'), @@ -505,9 +505,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { return result; } },{ - id: 'rngsubdiff', label:'{{ _('Subtype diff function') }}', cell: 'string', + id: 'rngsubdiff', label: gettext('Subtype diff function'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], - group: '{{ _('Range Type') }}', + group: gettext('Range Type'), disabled: 'inSchemaWithModelCheck', deps: ['opcname'], control: 'select', options: function() { var l_typname = this.model.get('typname'), @@ -542,49 +542,49 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { } }] },{ - type: 'nested', control: 'tab', group: '{{ _('Definition') }}', - label: '{{ _('External Type') }}', deps: ['typtype'], + type: 'nested', control: 'tab', group: gettext('Definition'), + label: gettext('External Type'), deps: ['typtype'], mode: ['create', 'edit'], visible: function(m) { return m.get('typtype') === 'b'; }, schema:[{ - id: 'typinput', label:'{{ _('Input function') }}', + id: 'typinput', label: gettext('Input function'), cell: 'string',type: 'text', - mode: ['properties', 'create', 'edit'], group: 'Required', + mode: ['properties', 'create', 'edit'], group: gettext('Required'), disabled: 'inSchemaWithModelCheck', control: 'node-ajax-options', url: 'get_external_functions', transform: 'external_func_combo', select2: { allowClear: true, placeholder: "", width: "100%" } },{ - id: 'typoutput', label:'{{ _('Output function') }}', + id: 'typoutput', label: gettext('Output function'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], - group: 'Required', + group: gettext('Required'), disabled: 'inSchemaWithModelCheck' ,control: 'node-ajax-options', url: 'get_external_functions', transform: 'external_func_combo', select2: { allowClear: true, placeholder: "", width: "100%" } },{ - id: 'typreceive', label:'{{ _('Receive function') }}', - cell: 'string', type: 'text', group: 'Optional-1', + id: 'typreceive', label: gettext('Receive function'), + cell: 'string', type: 'text', group: gettext('Optional-1'), mode: ['properties', 'create', 'edit'], disabled: 'inSchemaWithModelCheck' ,control: 'node-ajax-options', url: 'get_external_functions', transform: 'external_func_combo', select2: { allowClear: true, placeholder: "", width: "100%" } },{ - id: 'typsend', label:'{{ _('Send function') }}', - cell: 'string', group: 'Optional-1', + id: 'typsend', label: gettext('Send function'), + cell: 'string', group: gettext('Optional-1'), type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'inSchemaWithModelCheck' ,control: 'node-ajax-options', url: 'get_external_functions', transform: 'external_func_combo', select2: { allowClear: true, placeholder: "", width: "100%" } },{ - id: 'typmodin', label:'{{ _('Typmod in function') }}', + id: 'typmodin', label: gettext('Typmod in function'), cell: 'string', type: 'text', - mode: ['properties', 'create', 'edit'], group: 'Optional-1', + mode: ['properties', 'create', 'edit'], group: gettext('Optional-1'), disabled: 'inSchemaWithModelCheck', control: 'node-ajax-options', url: 'get_external_functions', select2: { allowClear: true, placeholder: "", width: "100%" }, @@ -599,8 +599,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { return result; } },{ - id: 'typmodout', label:'{{ _('Typmod out function') }}', - cell: 'string', group: 'Optional-1', + id: 'typmodout', label: gettext('Typmod out function'), + cell: 'string', group: gettext('Optional-1'), type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'inSchemaWithModelCheck', control: 'node-ajax-options', url: 'get_external_functions', @@ -616,31 +616,31 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { return result; } },{ - id: 'typlen', label:'{{ _('Internal length') }}', - cell: 'integer', group: 'Optional-1', + id: 'typlen', label: gettext('Internal length'), + cell: 'integer', group: gettext('Optional-1'), type: 'int', mode: ['properties', 'create', 'edit'], disabled: 'inSchemaWithModelCheck' },{ - id: 'variable', label:'{{ _('Variable?') }}', cell: 'switch', - group: 'Optional-1', type: 'switch', + id: 'variable', label: gettext('Variable?'), cell: 'switch', + group: gettext('Optional-1'), type: 'switch', mode: ['create','edit'], disabled: 'inSchemaWithModelCheck' },{ - id: 'typdefault', label:'{{ _('Default?') }}', - cell: 'string', group: 'Optional-1', + id: 'typdefault', label: gettext('Default?'), + cell: 'string', group: gettext('Optional-1'), type: 'text', mode: ['properties', 'create','edit'], disabled: 'inSchemaWithModelCheck' },{ - id: 'typanalyze', label:'{{ _('Analyze function') }}', - cell: 'string', group: 'Optional-1', + id: 'typanalyze', label: gettext('Analyze function'), + cell: 'string', group: gettext('Optional-1'), type: 'text', mode: ['properties', 'create','edit'], disabled: 'inSchemaWithModelCheck' ,control: 'node-ajax-options', url: 'get_external_functions', transform: 'external_func_combo', select2: { allowClear: true, placeholder: "", width: "100%" } },{ - id: 'typcategory', label:'{{ _('Category type') }}', - cell: 'string', group: 'Optional-1', + id: 'typcategory', label: gettext('Category type'), + cell: 'string', group: gettext('Optional-1'), type: 'text', mode: ['properties', 'create','edit'], disabled: 'inSchemaWithModelCheck', control: 'select2', select2: { allowClear: true, placeholder: "", width: "100%" }, @@ -662,22 +662,22 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { {label :"unknown type", value : "X"} ] },{ - id: 'typispreferred', label:'{{ _('Preferred?') }}', cell: 'switch', + id: 'typispreferred', label: gettext('Preferred?'), cell: 'switch', type: 'switch', mode: ['properties', 'create','edit'], disabled: 'inSchemaWithModelCheck', - group: 'Optional-1' + group: gettext('Optional-1') },{ - id: 'element', label:'{{ _('Element type') }}', cell: 'string', - control: 'node-ajax-options', group: 'Optional-2', + id: 'element', label: gettext('Element type'), cell: 'string', + control: 'node-ajax-options', group: gettext('Optional-2'), type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'inSchemaWithModelCheck', url: 'get_types' },{ - id: 'typdelim', label:'{{ _('Delimiter') }}', cell: 'string', + id: 'typdelim', label: gettext('Delimiter'), cell: 'string', type: 'text', mode: ['properties', 'create', 'edit'], - group: 'Optional-2', disabled: 'inSchemaWithModelCheck' + group: gettext('Optional-2'), disabled: 'inSchemaWithModelCheck' },{ - id: 'typalign', label:'{{ _('Alignment type') }}', - cell: 'string', group: 'Optional-2', + id: 'typalign', label: gettext('Alignment type'), + cell: 'string', group: gettext('Optional-2'), type: 'text', mode: ['properties', 'create', 'edit'], disabled: 'inSchemaWithModelCheck', control: 'select2', select2: { allowClear: true, placeholder: "", width: "100%" }, @@ -689,9 +689,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { {label: "double", value: "d"}, ] },{ - id: 'typstorage', label:'{{ _('Storage type') }}', + id: 'typstorage', label: gettext('Storage type'), type: 'text', mode: ['properties', 'create', 'edit'], - group: 'Optional-2', cell: 'string', + group: gettext('Optional-2'), cell: 'string', disabled: 'inSchemaWithModelCheck', control: 'select2', select2: { allowClear: true, placeholder: "", width: "100%" }, options: [ @@ -702,28 +702,28 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { {label: "EXTENDED", value: "x"}, ] },{ - id: 'typbyval', label:'{{ _('Passed by value?') }}', + id: 'typbyval', label: gettext('Passed by value?'), cell: 'switch', type: 'switch', mode: ['properties', 'create', 'edit'], - disabled: 'inSchemaWithModelCheck', group: 'Optional-2', + disabled: 'inSchemaWithModelCheck', group: gettext('Optional-2'), },{ - id: 'is_collatable', label:'{{ _('Collatable?') }}', - cell: 'switch', min_version: 90100, group: 'Optional-2', + id: 'is_collatable', label: gettext('Collatable?'), + cell: 'switch', min_version: 90100, group: gettext('Optional-2'), type: 'switch', mode: ['properties', 'create', 'edit'], disabled: 'inSchemaWithModelCheck' // End of extension tab }] },{ - id: 'alias', label:'{{ _('Alias') }}', cell: 'string', + id: 'alias', label: gettext('Alias'), cell: 'string', type: 'text', mode: ['properties'], disabled: 'inSchema' }, pgBrowser.SecurityGroupUnderSchema,{ - id: 'type_acl', label:'{{ _('Privileges') }}', cell: 'string', + id: 'type_acl', label: gettext('Privileges'), cell: 'string', type: 'text', mode: ['properties'], group: 'security', disabled: 'inSchema' },{ - id: 'member_list', label:'{{ _('Members') }}', cell: 'string', - type: 'text', mode: ['properties'], group: '{{ _('Definition') }}', + id: 'member_list', label: gettext('Members'), cell: 'string', + type: 'text', mode: ['properties'], group: gettext('Definition'), disabled: 'inSchema', visible: function(m) { if(m.get('typtype') === 'c') { return true; @@ -731,8 +731,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { return false; } },{ - id: 'enum_list', label:'{{ _('Labels') }}', cell: 'string', - type: 'text', mode: ['properties'], group: '{{ _('Definition') }}', + id: 'enum_list', label: gettext('Labels'), cell: 'string', + type: 'text', mode: ['properties'], group: gettext('Definition'), disabled: 'inSchema', visible: function(m) { if(m.get('typtype') === 'e') { return true; @@ -740,15 +740,15 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { return false; } },{ - id: 'is_sys_type', label:'{{ _('System type?') }}', cell: 'switch', + id: 'is_sys_type', label: gettext('System type?'), cell: 'switch', type: 'switch', mode: ['properties'], disabled: 'inSchema' },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline', mode: ['properties', 'create', 'edit'], disabled: 'inSchema' },{ - id: 'typacl', label:'{{ _('Privileges') }}', type: 'collection', + id: 'typacl', label: gettext('Privileges'), type: 'collection', group: 'security', control: 'unique-col-collection', model: pgBrowser.Node.PrivilegeRoleModel.extend({ privileges: ['U'] @@ -766,7 +766,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { return !(m.get('typtype') === 'p'); } },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', + id: 'seclabels', label: gettext('Security Labels'), model: pgBrowser.SecLabelModel, editable: false, type: 'collection', group: 'security', mode: ['edit', 'create'], min_version: 90100, canEdit: false, canDelete: true, @@ -794,7 +794,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { _.isNull(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '' ) { - msg = '{{ _('Name cannot be empty.') }}'; + msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; } @@ -804,7 +804,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { _.isNull(this.get('schema')) || String(this.get('schema')).replace(/^\s+|\s+$/g, '') == '' ) { - msg = '{{ _('Schema cannot be empty.') }}'; + msg = gettext('Schema cannot be empty.'); this.errorModel.set('schema', msg); return msg; } @@ -814,7 +814,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { _.isNull(this.get('typtype')) || String(this.get('typtype')).replace(/^\s+|\s+$/g, '') == '' ) { - msg = '{{ _('Type cannot be empty.') }}'; + msg = gettext('Type cannot be empty.'); this.errorModel.set('typtype', msg); return msg; } @@ -826,7 +826,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { _.isNull(this.get('typname')) || String(this.get('typname')).replace(/^\s+|\s+$/g, '') == '' ) { - msg = '{{ _('Subtype name cannot be empty.') }}'; + msg = gettext('Subtype name cannot be empty.'); this.errorModel.set('typname', msg); return msg; } @@ -839,7 +839,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { _.isNull(this.get('typinput')) || String(this.get('typinput')).replace(/^\s+|\s+$/g, '') == '' ) { - msg = '{{ _('Input function cannot be empty.') }}'; + msg = gettext('Input function cannot be empty.'); this.errorModel.set('typinput', msg); return msg; } @@ -848,7 +848,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { _.isNull(this.get('typoutput')) || String(this.get('typoutput')).replace(/^\s+|\s+$/g, '') == '' ) { - msg = '{{ _('Output function cannot be empty.') }}'; + msg = gettext('Output function cannot be empty.'); this.errorModel.set('typoutput', msg); return msg; } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js index e32594caf..5c611c69e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js @@ -1,8 +1,8 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'alertify', - 'pgadmin.browser', 'codemirror', 'pgadmin.browser.server.privilege'], - -function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'alertify', 'pgadmin.browser', 'codemirror', + 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { /** Create and add a view collection into nodes @@ -15,7 +15,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { var mviews= pgBrowser.Nodes['coll-mview'] = pgBrowser.Collection.extend({ node: 'mview', - label: '{{ _("Materialized Views") }}', + label: gettext('Materialized Views'), type: 'coll-mview', columns: ['name', 'owner'] }); @@ -39,7 +39,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { sqlAlterHelp: 'sql-altermaterializedview.html', sqlCreateHelp: 'sql-creatematerializedview.html', dialogHelp: '{{ url_for('help.static', filename='materialized_view_dialog.html') }}', - label: '{{ _("Materialized View") }}', + label: gettext('Materialized View'), hasSQL: true, hasDepends: true, hasScriptTypes: ['create', 'select'], @@ -62,35 +62,35 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { system view nodes. */ pgAdmin.Browser.add_menu_category( - 'refresh_mview', '{{ _('Refresh View') }}', 18, 'fa fa-recycle'); + 'refresh_mview', gettext('Refresh View'), 18, 'fa fa-recycle'); pgBrowser.add_menus([{ name: 'create_mview_on_coll', node: 'coll-mview', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, icon: 'wcTabIcon icon-mview', data: {action: 'create', check: true}, enable: 'canCreate', - label: '{{ _("Materialized View...") }}' + label: gettext('Materialized View...') },{ name: 'create_mview', node: 'mview', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 1, icon: 'wcTabIcon icon-mview', data: {action: 'create', check: true}, enable: 'canCreate', - label: '{{ _("Materialized View...") }}', + label: gettext('Materialized View...'), },{ name: 'create_mview', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', category: 'create', priority: 18, icon: 'wcTabIcon icon-mview', data: {action: 'create', check: false}, enable: 'canCreate', - label: '{{ _("Materialized View...") }}' + label: gettext('Materialized View...') },{ name: 'refresh_mview_data', node: 'mview', module: this, priority: 1, callback: 'refresh_mview', category: 'refresh_mview', - applies: ['object', 'context'], label: '{{ _("With data") }}', + applies: ['object', 'context'], label: gettext('With data'), data: {concurrent: false, with_data: true}, icon: 'fa fa-recycle' },{ name: 'refresh_mview_nodata', node: 'mview', callback: 'refresh_mview', priority: 2, module: this, category: 'refresh_mview', applies: ['object', 'context'], - label: '{{ _("With no data") }}', data: { + label: gettext('With no data'), data: { concurrent: false, with_data: false }, icon: 'fa fa-refresh' },{ @@ -98,13 +98,13 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { category: 'refresh_mview', enable: 'is_version_supported', data: {concurrent: true, with_data: true}, priority: 3, applies: ['object', 'context'], callback: 'refresh_mview', - label: '{{ _("With data (concurrently)") }}', icon: 'fa fa-recycle' + label: gettext('With data (concurrently)'), icon: 'fa fa-recycle' },{ name: 'refresh_mview_concurrent_nodata', node: 'mview', module: this, category: 'refresh_mview', enable: 'is_version_supported', data: {concurrent: true, with_data: false}, priority: 4, applies: ['object', 'context'], callback: 'refresh_mview', - label: '{{ _("With no data (concurrently)") }}', + label: gettext('With no data (concurrently)'), icon: 'fa fa-refresh' }]); }, @@ -131,57 +131,57 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { autovacuum_enabled: false }, schema: [{ - id: 'name', label: '{{ _("Name") }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', disabled: 'inSchema' },{ - id: 'oid', label:'{{ _("OID") }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text', disabled: true, mode: ['properties'] },{ - id: 'owner', label:'{{ _("Owner") }}', cell: 'string', + id: 'owner', label: gettext('Owner'), cell: 'string', control: 'node-list-by-name', select2: { allowClear: false }, node: 'role', disabled: 'inSchema' },{ - id: 'schema', label:'{{ _("Schema") }}', cell: 'string', first_empty: false, + id: 'schema', label: gettext('Schema'), cell: 'string', first_empty: false, control: 'node-list-by-name', type: 'text', cache_level: 'database', node: 'schema', mode: ['create', 'edit'], cache_node: 'database', disabled: 'inSchema', select2: { allowClear: false } },{ - id: 'system_view', label:'{{ _("System view?") }}', cell: 'string', + id: 'system_view', label: gettext('System view?'), cell: 'string', type: 'switch', disabled: true, mode: ['properties'], }, pgBrowser.SecurityGroupUnderSchema, { - id: 'acl', label: '{{ _("Privileges") }}', - mode: ['properties'], type: 'text', group: '{{ _("Security") }}' + id: 'acl', label: gettext('Privileges'), + mode: ['properties'], type: 'text', group: gettext('Security') },{ - id: 'comment', label:'{{ _("Comment") }}', cell: 'string', + id: 'comment', label: gettext('Comment'), cell: 'string', type: 'multiline' },{ id: 'definition', label:'', cell: 'string', - type: 'text', mode: ['create', 'edit'], group: 'Definition', + type: 'text', mode: ['create', 'edit'], group: gettext('Definition'), control: Backform.SqlFieldControl, extraClasses:['sql_field_width_full'] },{ - id: 'with_data', label: '{{ _("With Data") }}', - group: '{{ _("Storage") }}', mode: ['edit', 'create'], + id: 'with_data', label: gettext('With Data'), + group: gettext('Storage'), mode: ['edit', 'create'], type: 'switch', },{ - id: 'spcname', label: '{{ _("Tablespace") }}', cell: 'string', - type: 'text', group: '{{ _("Storage") }}', first_empty: false, + id: 'spcname', label: gettext('Tablespace'), cell: 'string', + type: 'text', group: gettext('Storage'), first_empty: false, control: 'node-list-by-name', node: 'tablespace', select2: { allowClear: false }, filter: function(m) { if (m.label == "pg_global") return false; else return true; } },{ - id: 'fillfactor', label: '{{ _("Fill Factor") }}', - group: '{{ _("Storage") }}', mode: ['edit', 'create'], + id: 'fillfactor', label: gettext('Fill Factor'), + group: gettext('Storage'), mode: ['edit', 'create'], type: 'integer' },{ type: 'nested', control: 'tab', id: 'materialization', - label: '{{ _("Parameter") }}', mode: ['edit', 'create'], - group: '{{ _("Parameter") }}', + label: gettext('Parameter'), mode: ['edit', 'create'], + group: gettext('Parameter'), schema: Backform.VacuumSettingsSchema },{ // Add Privilege Control - id: 'datacl', label: '{{ _("Privileges") }}', type: 'collection', + id: 'datacl', label: gettext('Privileges'), type: 'collection', model: pgBrowser.Node.PrivilegeRoleModel.extend({ privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't'] }), uniqueCol : ['grantee'], editable: false, @@ -189,7 +189,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { mode: ['edit', 'create'], control: 'unique-col-collection' },{ // Add Security Labels Control - id: 'seclabels', label: '{{ _("Security Labels") }}', + id: 'seclabels', label: gettext('Security Labels'), model: pgBrowser.SecLabelModel, editable: false, type: 'collection', canEdit: false, group: "security", canDelete: true, mode: ['edit', 'create'], canAdd: true, @@ -208,7 +208,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { if (_.isUndefined(field_name) || _.isNull(field_name) || String(field_name).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _("Please specify name.") }}'; + err['name'] = gettext('Please specify name.'); errmsg = errmsg || err['name']; this.errorModel.set('name', errmsg); return errmsg; @@ -217,7 +217,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { } if (_.isUndefined(field_def) || _.isNull(field_def) || String(field_def).replace(/^\s+|\s+$/g, '') == '') { - err['definition'] = '{{ _("Please enter view definition.") }}'; + err['definition'] = gettext('Please enter view definition.'); errmsg = errmsg || err['definition']; this.errorModel.set('definition', errmsg); return errmsg; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js index 8e2000d2f..47b0792e1 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js @@ -1,8 +1,8 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'codemirror', 'pgadmin.browser.server.privilege', 'pgadmin.node.rule'], - -function($, _, S, pgAdmin, pgBrowser, CodeMirror) { +define([ + 'sources/gettext', + 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'codemirror', 'pgadmin.browser.server.privilege', 'pgadmin.node.rule' +], function(gettext, $, _, S, pgAdmin, pgBrowser, CodeMirror) { /** Create and add a view collection into nodes @@ -15,7 +15,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { var views= pgBrowser.Nodes['coll-view'] = pgBrowser.Collection.extend({ node: 'view', - label: '{{ _("Views") }}', + label: gettext('Views'), type: 'coll-view', columns: ["name", "owner"] }); @@ -39,7 +39,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { sqlAlterHelp: 'sql-alterview.html', sqlCreateHelp: 'sql-createview.html', dialogHelp: '{{ url_for('help.static', filename='view_dialog.html') }}', - label: '{{ _("View") }}', + label: gettext('View'), hasSQL: true, hasDepends: true, hasScriptTypes: ['create', 'select', 'insert'], @@ -64,19 +64,19 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { pgBrowser.add_menus([{ name: 'create_view_on_coll', node: 'coll-view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 1, label: '{{ _("View...") }}', + category: 'create', priority: 1, label: gettext('View...'), icon: 'wcTabIcon icon-view', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_view', node: 'view', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 1, label: '{{ _("View...") }}', + category: 'create', priority: 1, label: gettext('View...'), icon: 'wcTabIcon icon-view', data: {action: 'create', check: true}, enable: 'canCreate' },{ name: 'create_view', node: 'schema', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 17, label: '{{ _("View...") }}', + category: 'create', priority: 17, label: gettext('View...'), icon: 'wcTabIcon icon-view', data: {action: 'create', check: false}, enable: 'canCreate' } @@ -100,56 +100,56 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { pgBrowser.Node.Model.prototype.initialize.apply(this, arguments); }, schema: [{ - id: 'name', label: '{{ _("Name") }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', disabled: 'notInSchema' },{ - id: 'oid', label:'{{ _("OID") }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text', disabled: true, mode: ['properties'] },{ - id: 'owner', label:'{{ _("Owner") }}', cell: 'string', control: 'node-list-by-name', + id: 'owner', label: gettext('Owner'), cell: 'string', control: 'node-list-by-name', node: 'role', disabled: 'notInSchema', select2: { allowClear: false } },{ - id: 'schema', label:'{{ _("Schema") }}', cell: 'string', first_empty: false, + id: 'schema', label: gettext('Schema'), cell: 'string', first_empty: false, control: 'node-list-by-name', type: 'text', cache_level: 'database', node: 'schema', disabled: 'notInSchema', mode: ['create', 'edit'], select2: { allowClear: false }, cache_node: 'database', cache_level: 'database' },{ - id: 'system_view', label:'{{ _("System view?") }}', cell: 'string', + id: 'system_view', label: gettext('System view?'), cell: 'string', type: 'switch', disabled: true, mode: ['properties'] },{ - id: 'acl', label: '{{ _("Privileges") }}', - mode: ['properties'], type: 'text', group: '{{ _("Security") }}' + id: 'acl', label: gettext('Privileges'), + mode: ['properties'], type: 'text', group: gettext('Security') },{ - id: 'comment', label:'{{ _("Comment") }}', cell: 'string', + id: 'comment', label: gettext('Comment'), cell: 'string', type: 'multiline', disabled: 'notInSchema' },{ - id: 'security_barrier', label:'{{ _("Security barrier") }}', - type: 'switch', min_version: '90200', group: 'Definition', + id: 'security_barrier', label: gettext('Security barrier'), + type: 'switch', min_version: '90200', group: gettext('Definition'), disabled: 'notInSchema' },{ - id: 'check_option', label:'{{ _("Check options") }}', - control: 'select2', group: 'Definition', type: 'text', + id: 'check_option', label: gettext('Check options'), + control: 'select2', group: gettext('Definition'), type: 'text', min_version: '90400', mode:['properties', 'create', 'edit'], select2: { // Set select2 option width to 100% allowClear: false, }, disabled: 'notInSchema', options:[{ - label: "{{ _('No') }}", value: "no" + label: gettext("No"), value: "no" },{ - label: "{{ _('Local') }}", value: "local" + label: gettext("Local"), value: "local" },{ - label: "{{ _('Cascaded') }}", value: "cascaded" + label: gettext("Cascaded"), value: "cascaded" }] },{ - id: 'definition', label:'{{ _("Definition") }}', cell: 'string', - type: 'text', mode: ['create', 'edit'], group: 'Definition', + id: 'definition', label: gettext('Definition'), cell: 'string', + type: 'text', mode: ['create', 'edit'], group: gettext('Definition'), control: Backform.SqlFieldControl, disabled: 'notInSchema' }, pgBrowser.SecurityGroupUnderSchema, { // Add Privilege Control - id: 'datacl', label: '{{ _("Privileges") }}', type: 'collection', + id: 'datacl', label: gettext('Privileges'), type: 'collection', model: pgBrowser.Node.PrivilegeRoleModel.extend({ privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't'] }), uniqueCol : ['grantee'], editable: false, group: 'security', @@ -157,7 +157,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { control: 'unique-col-collection', disabled: 'notInSchema' },{ // Add Security Labels Control - id: 'seclabels', label: '{{ _("Security labels") }}', + id: 'seclabels', label: gettext('Security labels'), model: pgBrowser.SecLabelModel, editable: false, type: 'collection', canEdit: false, group: 'security', canDelete: true, mode: ['edit', 'create'], canAdd: true, disabled: 'notInSchema', @@ -171,7 +171,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { field_def = this.get('definition'); if (_.isUndefined(field_name) || _.isNull(field_name) || String(field_name).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _("Please specify name.") }}'; + err['name'] = gettext('Please specify name.'); errmsg = errmsg || err['name']; this.errorModel.set('name', errmsg); return errmsg; @@ -180,7 +180,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { } if (_.isUndefined(field_def) || _.isNull(field_def) || String(field_def).replace(/^\s+|\s+$/g, '') == '') { - err['definition'] = '{{ _("Please enter view definition.") }}'; + err['definition'] = gettext('Please enter view definition.'); errmsg = errmsg || err['definition']; this.errorModel.set('definition', errmsg); return errmsg; diff --git a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/js/databases.js b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/js/databases.js index bbe73fe55..0f362ae6e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/js/databases.js +++ b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/js/databases.js @@ -1,15 +1,14 @@ define([ - 'jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', - 'pgadmin.browser.server.privilege', 'pgadmin.browser.server.variable', - ], -function($, _, S, pgAdmin, pgBrowser, Alertify) { + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.browser.server.privilege', 'pgadmin.browser.server.variable', +], function(gettext, $, _, S, pgAdmin, pgBrowser, Alertify) { if (!pgBrowser.Nodes['coll-database']) { var databases = pgBrowser.Nodes['coll-database'] = pgBrowser.Collection.extend({ node: 'database', - label: '{{ _('Databases') }}', + label: gettext('Databases'), type: 'coll-database', columns: ['name', 'datowner', 'comments'], hasStatistics: true, @@ -31,7 +30,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { canDrop: function(node) { return node.canDrop; }, - label: '{{ _('Database') }}', + label: gettext('Database'), node_image: function() { return 'pg-icon-database'; }, @@ -45,30 +44,30 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { pgBrowser.add_menus([{ name: 'create_database_on_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Database...') }}', + category: 'create', priority: 4, label: gettext('Database...'), icon: 'wcTabIcon pg-icon-database', data: {action: 'create'}, enable: 'can_create_database' },{ name: 'create_database_on_coll', node: 'coll-database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Database...') }}', + category: 'create', priority: 4, label: gettext('Database...'), icon: 'wcTabIcon pg-icon-database', data: {action: 'create'}, enable: 'can_create_database' },{ name: 'create_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Database...') }}', + category: 'create', priority: 4, label: gettext('Database...'), icon: 'wcTabIcon pg-icon-database', data: {action: 'create'}, enable: 'can_create_database' },{ name: 'connect_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'connect_database', - category: 'connect', priority: 4, label: '{{ _('Connect Database...') }}', + category: 'connect', priority: 4, label: gettext('Connect Database...'), icon: 'fa fa-link', enable : 'is_not_connected' },{ name: 'disconnect_database', node: 'database', module: this, applies: ['object', 'context'], callback: 'disconnect_database', - category: 'drop', priority: 5, label: '{{ _('Disconnect Database...') }}', + category: 'drop', priority: 5, label: gettext('Disconnect Database...'), icon: 'fa fa-chain-broken', enable : 'is_connected' }]); @@ -136,8 +135,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { return; } Alertify.confirm( - '{{ _('Connection lost') }}', - '{{ _('Would you like to reconnect to the database?') }}', + gettext('Connection lost'), + gettext('Would you like to reconnect to the database?'), function() { connect(self, d, t, i, true); }, @@ -181,8 +180,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { return false; Alertify.confirm( - '{{ _('Disconnect the database') }}', - S('{{ _('Are you sure you want to disconnect the database - %s?') }}').sprintf(d.label).value(), + gettext('Disconnect the database'), + S(gettext('Are you sure you want to disconnect the database - %s?')).sprintf(d.label).value(), function(evt) { var data = d; $.ajax({ @@ -191,7 +190,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { success: function(res) { if (res.success == 1) { var prv_i = t.parent(i); - Alertify.success("{{ _('" + res.info + "') }}"); + Alertify.success(res.info); t.removeIcon(i); data.connected = false; data.icon = 'icon-database-not-connected'; @@ -301,41 +300,41 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { }, schema: [{ - id: 'name', label: '{{ _('Database') }}', cell: 'string', + id: 'name', label: gettext('Database'), cell: 'string', editable: false, type: 'text' },{ - id: 'did', label:'{{ _('OID') }}', cell: 'string', mode: ['properties'], + id: 'did', label: gettext('OID'), cell: 'string', mode: ['properties'], editable: false, type: 'text' },{ - id: 'datowner', label:'{{ _('Owner') }}', + id: 'datowner', label: gettext('Owner'), editable: false, type: 'text', node: 'role', control: Backform.NodeListByNameControl, select2: { allowClear: false } },{ - id: 'acl', label: '{{ _('Privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'acl', label: gettext('Privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'tblacl', label: '{{ _('Default TABLE privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'tblacl', label: gettext('Default TABLE privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'seqacl', label: '{{ _('Default SEQUENCE privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'seqacl', label: gettext('Default SEQUENCE privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'funcacl', label: '{{ _('Default FUNCTION privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'funcacl', label: gettext('Default FUNCTION privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'typeacl', label: '{{ _('Default TYPE privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true, min_version: 90200 + id: 'typeacl', label: gettext('Default TYPE privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true, min_version: 90200 },{ - id: 'comments', label:'{{ _('Comment') }}', + id: 'comments', label: gettext('Comment'), editable: false, type: 'multiline' },{ - id: 'encoding', label: '{{ _('Encoding') }}', - editable: false, type: 'text', group: 'Definition', + id: 'encoding', label: gettext('Encoding'), + editable: false, type: 'text', group: gettext('Definition'), disabled: function(m) { return !m.isNew(); }, url: 'get_encodings', control: 'node-ajax-options', cache_level: 'server' },{ - id: 'template', label: '{{ _('Template') }}', - editable: false, type: 'text', group: 'Definition', + id: 'template', label: gettext('Template'), + editable: false, type: 'text', group: gettext('Definition'), disabled: function(m) { return !m.isNew(); }, control: 'node-list-by-name', url: 'get_databases', cache_level: 'server', select2: { allowClear: false }, mode: ['create'], @@ -358,8 +357,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { return res; } },{ - id: 'spcname', label: '{{ _('Tablespace') }}', - editable: false, type: 'text', group: 'Definition', + id: 'spcname', label: gettext('Tablespace'), + editable: false, type: 'text', group: gettext('Definition'), control: 'node-list-by-name', node: 'tablespace', select2: { allowClear: false }, filter: function(m) { @@ -367,30 +366,30 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { else return true; } },{ - id: 'datcollate', label: '{{ _('Collation') }}', - editable: false, type: 'text', group: 'Definition', + id: 'datcollate', label: gettext('Collation'), + editable: false, type: 'text', group: gettext('Definition'), disabled: function(m) { return !m.isNew(); }, url: 'get_ctypes', control: 'node-ajax-options', cache_level: 'server' },{ - id: 'datctype', label: '{{ _('Character type') }}', - editable: false, type: 'text', group: 'Definition', + id: 'datctype', label: gettext('Character type'), + editable: false, type: 'text', group: gettext('Definition'), disabled: function(m) { return !m.isNew(); }, url: 'get_ctypes', control: 'node-ajax-options', cache_level: 'server' },{ - id: 'datconnlimit', label: '{{ _('Connection limit') }}', - editable: false, type: 'int', group: 'Definition', min: -1 + id: 'datconnlimit', label: gettext('Connection limit'), + editable: false, type: 'int', group: gettext('Definition'), min: -1 },{ - id: 'is_template', label: '{{ _('Template?') }}', - editable: false, type: 'switch', group: 'Definition', + id: 'is_template', label: gettext('Template?'), + editable: false, type: 'switch', group: gettext('Definition'), disabled: true, mode: ['properties', 'edit'], options: { - 'onText': 'Yes', 'offText': 'No', + 'onText': gettext('Yes'), 'offText': gettext('No'), 'onColor': 'success', 'offColor': 'primary', 'size': 'small' } },{ - id: 'datallowconn', label: '{{ _('Allow connections?') }}', - editable: false, type: 'switch', group: 'Definition', + id: 'datallowconn', label: gettext('Allow connections?'), + editable: false, type: 'switch', group: gettext('Definition'), mode: ['properties'], disabled: true, options: { 'onText': 'Yes', 'offText': 'No', @@ -398,56 +397,56 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { 'size': 'small' } },{ - id: 'datacl', label: '{{ _('Privileges') }}', type: 'collection', + id: 'datacl', label: gettext('Privileges'), type: 'collection', model: pgBrowser.Node.PrivilegeRoleModel.extend({ privileges: ['C', 'T', 'c'] }), uniqueCol : ['grantee', 'grantor'], editable: false, - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: gettext('Security'), mode: ['edit', 'create'], canAdd: true, canDelete: true, control: 'unique-col-collection', },{ - id: 'variables', label: '{{ _('Parameters') }}', type: 'collection', + id: 'variables', label: gettext('Parameters'), type: 'collection', model: pgBrowser.Node.VariableModel.extend({keys:['name', 'role']}), editable: false, - group: '{{ _('Parameters') }}', mode: ['edit', 'create'], + group: gettext('Parameters'), mode: ['edit', 'create'], canAdd: true, canEdit: false, canDelete: true, hasRole: true, control: Backform.VariableCollectionControl, node: 'role' },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', + id: 'seclabels', label: gettext('Security Labels'), model: pgBrowser.SecLabelModel, editable: false, type: 'collection', canEdit: false, - group: '{{ _('Security') }}', canDelete: true, + group: gettext('Security'), canDelete: true, mode: ['edit', 'create'], canAdd: true, control: 'unique-col-collection', uniqueCol : ['provider'], min_version: 90200 },{ - type: 'nested', control: 'tab', group: '{{ _('Default Privileges') }}', + type: 'nested', control: 'tab', group: gettext('Default Privileges'), mode: ['edit'], schema:[{ id: 'deftblacl', model: pgBrowser.Node.PrivilegeRoleModel.extend( - {privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}), label: '{{ _('Default Privileges: Tables') }}', - editable: false, type: 'collection', group: '{{ _('Tables') }}', + {privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}), label: gettext('Default Privileges: Tables'), + editable: false, type: 'collection', group: gettext('Tables'), mode: ['edit', 'create'], control: 'unique-col-collection', canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor'] },{ id: 'defseqacl', model: pgBrowser.Node.PrivilegeRoleModel.extend( - {privileges: ['r', 'w', 'U']}), label: '{{ _('Default Privileges: Sequences') }}', - editable: false, type: 'collection', group: '{{ _('Sequences') }}', + {privileges: ['r', 'w', 'U']}), label: gettext('Default Privileges: Sequences'), + editable: false, type: 'collection', group: gettext('Sequences'), mode: ['edit', 'create'], control: 'unique-col-collection', canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor'] },{ id: 'deffuncacl', model: pgBrowser.Node.PrivilegeRoleModel.extend( - {privileges: ['X']}), label: '{{ _('Default Privileges: Functions') }}', - editable: false, type: 'collection', group: '{{ _('Functions') }}', + {privileges: ['X']}), label: gettext('Default Privileges: Functions'), + editable: false, type: 'collection', group: gettext('Functions'), mode: ['edit', 'create'], control: 'unique-col-collection', canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor'] },{ id: 'deftypeacl', model: pgBrowser.Node.PrivilegeRoleModel.extend( - {privileges: ['U']}), label: '{{ _('Default Privileges: Types') }}', + {privileges: ['U']}), label: gettext('Default Privileges: Types'), editable: false, type: 'collection', group: 'deftypesacl_group', mode: ['edit', 'create'], control: 'unique-col-collection', canAdd: true, canDelete: true, uniqueCol : ['grantee', 'grantor'], min_version: 90200 },{ - id: 'deftypesacl_group', type: 'group', label: '{{ _('Types') }}', + id: 'deftypesacl_group', type: 'group', label: gettext('Types'), mode: ['edit', 'create'], min_version: 90200 } ] @@ -457,7 +456,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { var name = this.get('name'); if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name cannot be empty.') }}'; + var msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; } else { @@ -485,7 +484,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { Alertify.pgNotifier('error', xhr, error, function(msg) { setTimeout(function() { Alertify.dlgServerPass( - '{{ _('Connect to database') }}', + gettext('Connect to database'), msg, _model, _data, _tree, _item, _status, onSuccess, onFailure, onCancel ).resizeTo(); diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/schedules/templates/pga_schedule/js/pga_schedule.js b/web/pgadmin/browser/server_groups/servers/pgagent/schedules/templates/pga_schedule/js/pga_schedule.js index e08511ce6..0be70f2fa 100644 --- a/web/pgadmin/browser/server_groups/servers/pgagent/schedules/templates/pga_schedule/js/pga_schedule.js +++ b/web/pgadmin/browser/server_groups/servers/pgagent/schedules/templates/pga_schedule/js/pga_schedule.js @@ -1,14 +1,13 @@ define([ - 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'moment', - 'pgadmin.browser', 'alertify', 'backform', 'pgadmin.backform' - ], -function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'moment', + 'pgadmin.browser', 'alertify', 'backform', 'pgadmin.backform' +], function(gettext, $, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { if (!pgBrowser.Nodes['coll-pga_schedule']) { pgBrowser.Nodes['coll-pga_schedule'] = pgBrowser.Collection.extend({ node: 'pga_schedule', - label: '{{ _('Schedules') }}', + label: gettext('Schedules'), type: 'coll-pga_schedule', columns: ['jscid', 'jscname', 'jscenabled'], hasStatistics: false @@ -18,166 +17,166 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { if (!pgBrowser.Nodes['pga_schedule']) { var weekdays = [ - '{{ _("Sunday") }}', '{{ _("Monday") }}', '{{ _("Tuesday") }}', - '{{ _("Wednesday") }}', '{{ _("Thursday") }}', '{{ _("Friday") }}', - '{{ _("Saturday") }}' - ], - monthdays = [ - '{{ _("1st") }}', '{{ _("2nd") }}', '{{ _("3rd") }}', - '{{ _("4th") }}', '{{ _("5th") }}', '{{ _("6th") }}', - '{{ _("7th") }}', '{{ _("8th") }}', '{{ _("9th") }}', - '{{ _("10th") }}', '{{ _("11th") }}', '{{ _("12th") }}', - '{{ _("13th") }}', '{{ _("14th") }}', '{{ _("15th") }}', - '{{ _("16th") }}', '{{ _("17th") }}', '{{ _("18th") }}', - '{{ _("19th") }}', '{{ _("20th") }}', '{{ _("21st") }}', - '{{ _("22nd") }}', '{{ _("23rd") }}', '{{ _("24th") }}', - '{{ _("25th") }}', '{{ _("26th") }}', '{{ _("27th") }}', - '{{ _("28th") }}', '{{ _("29th") }}', '{{ _("30th") }}', - '{{ _("31st") }}', '{{ _("Last day") }}' - ], - months = [ - '{{ _("January") }}', '{{ _("February") }}', '{{ _("March") }}', - '{{ _("April") }}', '{{ _("May") }}', '{{ _("June") }}', - '{{ _("July") }}', '{{ _("August") }}', '{{ _("September") }}', - '{{ _("October") }}', '{{ _("November") }}', '{{ _("December") }}' - ], - hours = [ - '{{ _("00") }}', '{{ _("01") }}', '{{ _("02") }}', '{{ _("03") }}', - '{{ _("04") }}', '{{ _("05") }}', '{{ _("06") }}', '{{ _("07") }}', - '{{ _("08") }}', '{{ _("09") }}', '{{ _("10") }}', '{{ _("11") }}', - '{{ _("12") }}', '{{ _("13") }}', '{{ _("14") }}', '{{ _("15") }}', - '{{ _("16") }}', '{{ _("17") }}', '{{ _("18") }}', '{{ _("19") }}', - '{{ _("20") }}', '{{ _("21") }}', '{{ _("22") }}', '{{ _("23") }}' - ], - minutes = [ - '{{ _("00") }}', '{{ _("01") }}', '{{ _("02") }}', '{{ _("03") }}', - '{{ _("04") }}', '{{ _("05") }}', '{{ _("06") }}', '{{ _("07") }}', - '{{ _("08") }}', '{{ _("09") }}', '{{ _("10") }}', '{{ _("11") }}', - '{{ _("12") }}', '{{ _("13") }}', '{{ _("14") }}', '{{ _("15") }}', - '{{ _("16") }}', '{{ _("17") }}', '{{ _("18") }}', '{{ _("19") }}', - '{{ _("20") }}', '{{ _("21") }}', '{{ _("22") }}', '{{ _("23") }}', - '{{ _("24") }}', '{{ _("25") }}', '{{ _("26") }}', '{{ _("27") }}', - '{{ _("28") }}', '{{ _("29") }}', '{{ _("30") }}', '{{ _("31") }}', - '{{ _("32") }}', '{{ _("33") }}', '{{ _("34") }}', '{{ _("35") }}', - '{{ _("36") }}', '{{ _("37") }}', '{{ _("38") }}', '{{ _("39") }}', - '{{ _("40") }}', '{{ _("41") }}', '{{ _("42") }}', '{{ _("43") }}', - '{{ _("44") }}', '{{ _("45") }}', '{{ _("46") }}', '{{ _("47") }}', - '{{ _("48") }}', '{{ _("49") }}', '{{ _("50") }}', '{{ _("51") }}', - '{{ _("52") }}', '{{ _("53") }}', '{{ _("54") }}', '{{ _("55") }}', - '{{ _("56") }}', '{{ _("57") }}', '{{ _("58") }}', '{{ _("59") }}' - ], - AnyDatetimeCell = Backgrid.Extension.MomentCell.extend({ - editor: Backgrid.Extension.DatetimePickerEditor, - render: function() { - this.$el.empty(); - var model = this.model; - this.$el.text(this.formatter.fromRaw(model.get(this.column.get("name")), model) || '{{ _('') }}'); - this.delegateEvents(); + gettext('Sunday'), gettext('Monday'), gettext('Tuesday'), + gettext('Wednesday'), gettext('Thursday'), gettext('Friday'), + gettext('Saturday') + ], + monthdays = [ + gettext('1st'), gettext('2nd'), gettext('3rd'), + gettext('4th'), gettext('5th'), gettext('6th'), + gettext('7th'), gettext('8th'), gettext('9th'), + gettext('10th'), gettext('11th'), gettext('12th'), + gettext('13th'), gettext('14th'), gettext('15th'), + gettext('16th'), gettext('17th'), gettext('18th'), + gettext('19th'), gettext('20th'), gettext('21st'), + gettext('22nd'), gettext('23rd'), gettext('24th'), + gettext('25th'), gettext('26th'), gettext('27th'), + gettext('28th'), gettext('29th'), gettext('30th'), + gettext('31st'), gettext('Last day') + ], + months = [ + gettext('January'), gettext('February'), gettext('March'), + gettext('April'), gettext('May'), gettext('June'), + gettext('July'), gettext('August'), gettext('September'), + gettext('October'), gettext('November'), gettext('December') + ], + hours = [ + gettext('00'), gettext('01'), gettext('02'), gettext('03'), + gettext('04'), gettext('05'), gettext('06'), gettext('07'), + gettext('08'), gettext('09'), gettext('10'), gettext('11'), + gettext('12'), gettext('13'), gettext('14'), gettext('15'), + gettext('16'), gettext('17'), gettext('18'), gettext('19'), + gettext('20'), gettext('21'), gettext('22'), gettext('23') + ], + minutes = [ + gettext('00'), gettext('01'), gettext('02'), gettext('03'), + gettext('04'), gettext('05'), gettext('06'), gettext('07'), + gettext('08'), gettext('09'), gettext('10'), gettext('11'), + gettext('12'), gettext('13'), gettext('14'), gettext('15'), + gettext('16'), gettext('17'), gettext('18'), gettext('19'), + gettext('20'), gettext('21'), gettext('22'), gettext('23'), + gettext('24'), gettext('25'), gettext('26'), gettext('27'), + gettext('28'), gettext('29'), gettext('30'), gettext('31'), + gettext('32'), gettext('33'), gettext('34'), gettext('35'), + gettext('36'), gettext('37'), gettext('38'), gettext('39'), + gettext('40'), gettext('41'), gettext('42'), gettext('43'), + gettext('44'), gettext('45'), gettext('46'), gettext('47'), + gettext('48'), gettext('49'), gettext('50'), gettext('51'), + gettext('52'), gettext('53'), gettext('54'), gettext('55'), + gettext('56'), gettext('57'), gettext('58'), gettext('59') + ], + AnyDatetimeCell = Backgrid.Extension.MomentCell.extend({ + editor: Backgrid.Extension.DatetimePickerEditor, + render: function() { + this.$el.empty(); + var model = this.model; + this.$el.text(this.formatter.fromRaw(model.get(this.column.get("name")), model) || gettext('')); + this.delegateEvents(); - return this; - } - }), - BooleanArrayFormatter = function(selector, indexes) { - var self = this; + return this; + } + }), + BooleanArrayFormatter = function(selector, indexes) { + var self = this; - self.selector = selector; - self.indexes = indexes; + self.selector = selector; + self.indexes = indexes; - this.fromRaw = function(rawData) { - if (!_.isArray(rawData)) { - return rawData; - } - - var res = [], idx = 0, resIdx = []; - - for (; idx < rawData.length; idx++) { - if (!rawData[idx]) - continue; - res.push(self.selector[idx]); - resIdx.push(idx + 1); - } - - return self.indexes ? resIdx : res.join(', '); - } - this.toRaw = function(d) { - if (!self.indexes) - return d; - var res = [], i = 0, l = self.selector.length; - - for (; i < l; i++) { - res.push(_.indexOf(d, String(i + 1)) != -1); - } - return res; + this.fromRaw = function(rawData) { + if (!_.isArray(rawData)) { + return rawData; } - return self; - }, - BooleanArrayOptions = function(ctrl) { - var selector = ctrl.field.get('selector'), - val = ctrl.model.get(ctrl.field.get('name')), - res = []; + var res = [], idx = 0, resIdx = []; - if (selector) { - res = _.map( - selector, function(v, i) { - return {label: v, value: i + 1, selected: val[i]}; - } - ); + for (; idx < rawData.length; idx++) { + if (!rawData[idx]) + continue; + res.push(self.selector[idx]); + resIdx.push(idx + 1); + } + + return self.indexes ? resIdx : res.join(', '); + } + this.toRaw = function(d) { + if (!self.indexes) + return d; + var res = [], i = 0, l = self.selector.length; + + for (; i < l; i++) { + res.push(_.indexOf(d, String(i + 1)) != -1); } return res; - }, - ExceptionModel = pgBrowser.Node.Model.extend({ - defaults: { - jexid: undefined, - jexdate: null, - jextime: null - }, - idAttribute: 'jexid', - schema: [{ - id: 'jexdate', type: 'text', label: '{{ _('Date') }}', - editable: true, placeholder: '{{ _('') }}', - cell: AnyDatetimeCell, options: {format: 'YYYY-MM-DD'}, - displayFormat: 'YYYY-MM-DD', modelFormat: 'YYYY-MM-DD', - cellHeaderClasses:'width_percent_50', allowEmpty: true - },{ - id: 'jextime', type: 'text', placeholder: '{{ _('') }}', - label: '{{ _('Time') }}', editable: true, cell: AnyDatetimeCell, - options: {format: 'HH:mm'}, displayFormat: 'HH:mm', - modelFormat: 'HH:mm:ss', displayInUTC: false, allowEmpty: true, - cellHeaderClasses:'width_percent_50', modalInUTC: false - }], - validate: function() { - var self = this, exceptions = this.collection, - dates = {}, errMsg, hasExceptionErr = false, - d = (this.get('jexdate') || ''), - t = this.get('jextime') || '', - id = this.get('jexid') || this.cid; + } - self.errorModel.unset('jscdate'); - if (d == t && d == '') { - errMsg = '{{ _('Please specify date/time.') }}'; - self.errorModel.set('jscdate', errMsg); - return errMsg ; + return self; + }, + BooleanArrayOptions = function(ctrl) { + var selector = ctrl.field.get('selector'), + val = ctrl.model.get(ctrl.field.get('name')), + res = []; + + if (selector) { + res = _.map( + selector, function(v, i) { + return {label: v, value: i + 1, selected: val[i]}; } + ); + } + return res; + }, + ExceptionModel = pgBrowser.Node.Model.extend({ + defaults: { + jexid: undefined, + jexdate: null, + jextime: null + }, + idAttribute: 'jexid', + schema: [{ + id: 'jexdate', type: 'text', label: gettext('Date'), + editable: true, placeholder: gettext(''), + cell: AnyDatetimeCell, options: {format: 'YYYY-MM-DD'}, + displayFormat: 'YYYY-MM-DD', modelFormat: 'YYYY-MM-DD', + cellHeaderClasses:'width_percent_50', allowEmpty: true + },{ + id: 'jextime', type: 'text', placeholder: gettext(''), + label: gettext('Time'), editable: true, cell: AnyDatetimeCell, + options: {format: 'HH:mm'}, displayFormat: 'HH:mm', + modelFormat: 'HH:mm:ss', displayInUTC: false, allowEmpty: true, + cellHeaderClasses:'width_percent_50', modalInUTC: false + }], + validate: function() { + var self = this, exceptions = this.collection, + dates = {}, errMsg, hasExceptionErr = false, + d = (this.get('jexdate') || ''), + t = this.get('jextime') || '', + id = this.get('jexid') || this.cid; - exceptions.each(function(ex) { - if (hasExceptionErr || id == (ex.get('jexid') || ex.cid)) - return; - - if ( - d == (ex.get('jexdate') || '') && - t == (ex.get('jextime') || '') - ) { - errMsg = '{{ _('Please specify unique set of exceptions.') }}'; - if (ex.errorModel.get('jscdate') != errMsg) - self.errorModel.set('jscdate', errMsg); - hasExceptionErr = true; - } - }); - - return errMsg; + self.errorModel.unset('jscdate'); + if (d == t && d == '') { + errMsg = gettext('Please specify date/time.'); + self.errorModel.set('jscdate', errMsg); + return errMsg ; } - }); + + exceptions.each(function(ex) { + if (hasExceptionErr || id == (ex.get('jexid') || ex.cid)) + return; + + if ( + d == (ex.get('jexdate') || '') && + t == (ex.get('jextime') || '') + ) { + errMsg = gettext('Please specify unique set of exceptions.'); + if (ex.errorModel.get('jscdate') != errMsg) + self.errorModel.set('jscdate', errMsg); + hasExceptionErr = true; + } + }); + + return errMsg; + } + }); pgBrowser.Nodes['pga_schedule'] = pgBrowser.Node.extend({ parent_type: 'pga_job', @@ -189,7 +188,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { canDrop: function(node) { return true; }, - label: '{{ _('Schedule') }}', + label: gettext('Schedule'), node_image: 'icon-pga_schedule', Init: function() { /* Avoid mulitple registration of menus */ @@ -201,17 +200,17 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { pgBrowser.add_menus([{ name: 'create_pga_schedule_on_job', node: 'pga_job', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Schedule...') }}', + category: 'create', priority: 4, label: gettext('Schedule...'), icon: 'wcTabIcon icon-pga_schedule', data: {action: 'create'} },{ name: 'create_pga_schedule_on_coll', node: 'coll-pga_schedule', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Schedule...') }}', + category: 'create', priority: 4, label: gettext('Schedule...'), icon: 'wcTabIcon icon-pga_schedule', data: {action: 'create'} },{ name: 'create_pga_schedule', node: 'pga_schedule', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Schedule...') }}', + category: 'create', priority: 4, label: gettext('Schedule...'), icon: 'wcTabIcon icon-pga_schedule', data: {action: 'create'} }]); }, @@ -251,18 +250,18 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { return pgBrowser.Node.Model.prototype.parse.apply(this, arguments); }, schema: [{ - id: 'jscid', label: '{{ _('ID') }}', type: 'integer', + id: 'jscid', label: gettext('ID'), type: 'integer', cellHeaderClasses: 'width_percent_5', mode: ['properties'] },{ - id: 'jscname', label: '{{ _('Name') }}', type: 'text', + id: 'jscname', label: gettext('Name'), type: 'text', cellHeaderClasses: 'width_percent_45', disabled: function() { return false; } },{ - id: 'jscenabled', label: '{{ _('Enabled?') }}', type: 'switch', + id: 'jscenabled', label: gettext('Enabled?'), type: 'switch', disabled: function() { return false; }, cellHeaderClasses: 'width_percent_5' },{ - id: 'jscstart', label: '{{ _('Start') }}', type: 'text', + id: 'jscstart', label: gettext('Start'), type: 'text', control: 'datetimepicker', cell: 'moment', disabled: function() { return false; }, displayFormat: 'YYYY-MM-DD HH:mm:ss Z', @@ -270,7 +269,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { format: 'YYYY-MM-DD HH:mm:ss Z', }, cellHeaderClasses: 'width_percent_25' },{ - id: 'jscend', label: '{{ _('End') }}', type: 'text', + id: 'jscend', label: gettext('End'), type: 'text', control: 'datetimepicker', cell: 'moment', disabled: function() { return false; }, displayInUTC: false, displayFormat: 'YYYY-MM-DD HH:mm:ss Z', options: { @@ -278,32 +277,32 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { }, cellHeaderClasses: 'width_percent_25', modelFormat: 'YYYY-MM-DD HH:mm:ss Z' },{ - id: 'jscweekdays', label:'{{ _('Week days') }}', type: 'text', + id: 'jscweekdays', label: gettext('Week days'), type: 'text', control: Backform.Control.extend({ formatter: new BooleanArrayFormatter(weekdays, false) }), mode: ['properties'] },{ - id: 'jscmonthdays', label:'{{ _('Month days') }}', type: 'text', + id: 'jscmonthdays', label: gettext('Month days'), type: 'text', control: Backform.Control.extend({ formatter: new BooleanArrayFormatter(monthdays, false) }), mode: ['properties'] },{ - id: 'jscmonths', label:'{{ _('Months') }}', type: 'text', + id: 'jscmonths', label: gettext('Months'), type: 'text', control: Backform.Control.extend({ formatter: new BooleanArrayFormatter(months, false) }), mode: ['properties'] },{ - id: 'jschours', label:'{{ _('Hours') }}', type: 'text', + id: 'jschours', label: gettext('Hours'), type: 'text', control: Backform.Control.extend({ formatter: new BooleanArrayFormatter(hours, false) }), mode: ['properties'] },{ - id: 'jscminutes', label:'{{ _('Minutes') }}', type: 'text', + id: 'jscminutes', label: gettext('Minutes'), type: 'text', control: Backform.Control.extend({ formatter: new BooleanArrayFormatter(minutes, false) }), mode: ['properties'] },{ - id: 'jscexceptions', label:'{{ _('Exceptions') }}', type: 'text', + id: 'jscexceptions', label: gettext('Exceptions'), type: 'text', control: Backform.Control.extend({ formatter: new function() { this.fromRaw = function(rawData) { @@ -328,7 +327,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { } }), mode: ['properties'] },{ - type: 'nested', label: '{{ _('Days') }}', group: '{{ _('Repeat') }}', + type: 'nested', label: gettext('Days'), group: gettext('Repeat'), mode: ['create', 'edit'], control: Backform.FieldsetControl.extend({ render: function() { @@ -344,13 +343,13 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { } }), schema:[{ - id: 'jscweekdays', label:'{{ _('Week Days') }}', cell: 'select2', - group: '{{ _('Days') }}', control: 'select2', type: 'array', + id: 'jscweekdays', label: gettext('Week Days'), cell: 'select2', + group: gettext('Days'), control: 'select2', type: 'array', select2: { first_empty: false, multiple: true, allowClear: true, - placeholder: '{{ _("Select the weekdays...") }}', + placeholder: gettext('Select the weekdays...'), width: 'style', dropdownAdapter: $.fn.select2.amd.require( 'select2/selectAllAdapter' @@ -360,13 +359,13 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { formatter: new BooleanArrayFormatter(weekdays, true), options: BooleanArrayOptions },{ - id: 'jscmonthdays', label:'{{ _('Month Days') }}', cell: 'select2', - group: '{{ _('Days') }}', control: 'select2', type: 'array', + id: 'jscmonthdays', label: gettext('Month Days'), cell: 'select2', + group: gettext('Days'), control: 'select2', type: 'array', select2: { first_empty: false, multiple: true, allowClear: true, - placeholder: '{{ _("Select the month days...") }}', + placeholder: gettext('Select the month days...'), width: 'style', dropdownAdapter: $.fn.select2.amd.require( 'select2/selectAllAdapter' @@ -375,13 +374,13 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { formatter: new BooleanArrayFormatter(monthdays, true), selector: monthdays, options: BooleanArrayOptions },{ - id: 'jscmonths', label:'{{ _('Months') }}', cell: 'select2', - group: '{{ _('Days') }}', control: 'select2', type: 'array', + id: 'jscmonths', label: gettext('Months'), cell: 'select2', + group: gettext('Days'), control: 'select2', type: 'array', select2: { first_empty: false, multiple: true, allowClear: true, - placeholder: '{{ _("Select the months...") }}', + placeholder: gettext('Select the months...'), width: 'style', dropdownAdapter: $.fn.select2.amd.require( 'select2/selectAllAdapter' @@ -391,16 +390,16 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { selector: months, options: BooleanArrayOptions }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Times') }}', - group: '{{ _('Repeat') }}', mode: ['create', 'edit'], + type: 'nested', control: 'fieldset', label: gettext('Times'), + group: gettext('Repeat'), mode: ['create', 'edit'], schema:[{ - id: 'jschours', label:'{{ _('Hours') }}', cell: 'select2', - group: '{{ _('Times') }}', control: 'select2', type: 'array', + id: 'jschours', label: gettext('Hours'), cell: 'select2', + group: gettext('Times'), control: 'select2', type: 'array', select2: { first_empty: false, multiple: true, allowClear: true, - placeholder: '{{ _("Select the hours...") }}', + placeholder: gettext('Select the hours...'), width: 'style', dropdownAdapter: $.fn.select2.amd.require( 'select2/selectAllAdapter' @@ -409,13 +408,13 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { formatter: new BooleanArrayFormatter(hours, true), selector: hours, options: BooleanArrayOptions },{ - id: 'jscminutes', label:'{{ _('Minutes') }}', cell: 'select2', - group: '{{ _('Times') }}', control: 'select2', type: 'array', + id: 'jscminutes', label: gettext('Minutes'), cell: 'select2', + group: gettext('Times'), control: 'select2', type: 'array', select2: { first_empty: false, multiple: true, allowClear: true, - placeholder: '{{ _("Select the minutes...") }}', + placeholder: gettext('Select the minutes...'), width: 'style', dropdownAdapter: $.fn.select2.amd.require( 'select2/selectAllAdapter' @@ -427,10 +426,10 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { },{ id: 'jscexceptions', type: 'collection', mode: ['edit', 'create'], label: "", canEdit: false, model: ExceptionModel, canAdd: true, - group: '{{ _('Exceptions') }}', canDelete: true, + group: gettext('Exceptions'), canDelete: true, cols: ['jexdate', 'jextime'], control: 'sub-node-collection' },{ - id: 'jscdesc', label: '{{ _('Comment') }}', type: 'multiline' + id: 'jscdesc', label: gettext('Comment'), type: 'multiline' }], validate: function(keys) { var val = this.get('jscname'), @@ -438,7 +437,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { if (_.isUndefined(val) || _.isNull(val) || String(val).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name cannot be empty.') }}'; + var msg = gettext('Name cannot be empty.'); this.errorModel.set('jscname', msg); errMsg = msg; } else { @@ -448,7 +447,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { val = this.get('jscstart'); if (_.isUndefined(val) || _.isNull(val) || String(val).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Please enter the start time.') }}'; + var msg = gettext('Please enter the start time.'); this.errorModel.set('jscstart', msg); errMsg = errMsg || msg; } else { @@ -458,7 +457,7 @@ function($, _, S, pgAdmin, moment, pgBrowser, Alertify, Backform) { val = this.get('jscend'); if (_.isUndefined(val) || _.isNull(val) || String(val).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Please enter the end time.') }}'; + var msg = gettext('Please enter the end time.'); this.errorModel.set('jscend', msg); errMsg = errMsg || msg; } else { diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/steps/templates/pga_jobstep/js/pga_jobstep.js b/web/pgadmin/browser/server_groups/servers/pgagent/steps/templates/pga_jobstep/js/pga_jobstep.js index a38d33804..dc658c545 100644 --- a/web/pgadmin/browser/server_groups/servers/pgagent/steps/templates/pga_jobstep/js/pga_jobstep.js +++ b/web/pgadmin/browser/server_groups/servers/pgagent/steps/templates/pga_jobstep/js/pga_jobstep.js @@ -1,14 +1,13 @@ define([ - 'jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'backform', 'pgadmin.backform' - ], -function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) { + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'backform', 'pgadmin.backform' +], function(gettext, $, _, S, pgAdmin, pgBrowser, Alertify, Backform) { if (!pgBrowser.Nodes['coll-pga_jobstep']) { pgBrowser.Nodes['coll-pga_jobstep'] = pgBrowser.Collection.extend({ node: 'pga_jobstep', - label: '{{ _('Steps') }}', + label: gettext('Steps'), type: 'coll-pga_jobstep', columns: [ 'jstid', 'jstname', 'jstenabled', 'jstkind', 'jstconntype', @@ -32,9 +31,8 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) { canDrop: function(node) { return true; }, - label: '{{ _('Steps') }}', + label: gettext('Steps'), node_image: function() { - console.log(arguments); return 'icon-pga_jobstep'; }, Init: function() { @@ -47,17 +45,17 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) { pgBrowser.add_menus([{ name: 'create_pga_jobstep_on_job', node: 'pga_job', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Job Step...') }}', + category: 'create', priority: 4, label: gettext('Job Step...'), data: {'action': 'create'}, icon: 'wcTabIcon icon-pga_jobstep' },{ name: 'create_pga_jobstep_on_coll', node: 'coll-pga_jobstep', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Job Step...') }}', + category: 'create', priority: 4, label: gettext('Job Step...'), data: {'action': 'create'}, icon: 'wcTabIcon icon-pga_jobstep' },{ name: 'create_pga_jobstep', node: 'pga_jobstep', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Job Step...') }}', + category: 'create', priority: 4, label: gettext('Job Step...'), data: {'action': 'create'}, icon: 'wcTabIcon icon-pga_jobstep' }]); }, @@ -91,81 +89,81 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) { }, idAttribute: 'jstid', schema: [{ - id: 'jstid', label: '{{ _('ID') }}', type: 'integer', + id: 'jstid', label: gettext('ID'), type: 'integer', cellHeaderClasses: 'width_percent_5', mode: ['properties'] },{ - id: 'jstname', label: '{{ _('Name') }}', type: 'text', + id: 'jstname', label: gettext('Name'), type: 'text', disabled: function(m) { return false; }, cellHeaderClasses: 'width_percent_60' },{ - id: 'jstenabled', label: '{{ _('Enabled?') }}', type: 'switch', + id: 'jstenabled', label: gettext('Enabled?'), type: 'switch', disabled: function(m) { return false; } },{ - id: 'jstkind', label: '{{ _('Kind') }}', type: 'switch', + id: 'jstkind', label: gettext('Kind'), type: 'switch', options: { - 'onText': '{{ _('SQL') }}', 'offText': '{{ _('Batch') }}', + 'onText': gettext('SQL'), 'offText': gettext('Batch'), 'onColor': 'primary', 'offColor': 'primary' }, control: Backform.SwitchControl, disabled: function(m) { return false; } },{ - id: 'jstconntype', label: '{{ _('Connection type') }}', + id: 'jstconntype', label: gettext('Connection type'), type: 'switch', deps: ['jstkind'], mode: ['properties'], disabled: function(m) { return !m.get('jstkind'); }, options: { - 'onText': '{{ _('Local') }}', 'offText': '{{ _('Remote') }}', + 'onText': gettext('Local'), 'offText': gettext('Remote'), 'onColor': 'primary', 'offColor': 'primary' } },{ - id: 'jstconntype', label: '{{ _('Connection type') }}', + id: 'jstconntype', label: gettext('Connection type'), type: 'switch', deps: ['jstkind'], mode: ['create', 'edit'], disabled: function(m) { return !m.get('jstkind'); }, options: { - 'onText': '{{ _('Local') }}', 'offText': '{{ _('Remote') }}', + 'onText': gettext('Local'), 'offText': gettext('Remote'), 'onColor': 'primary', 'offColor': 'primary' - }, helpMessage: '{{ _('Select Local if the job step will execute on the local database server, or Remote to specify a remote database server.') }}' + }, helpMessage: gettext('Select Local if the job step will execute on the local database server, or Remote to specify a remote database server.') },{ - id: 'jstdbname', label: '{{ _('Database') }}', type: 'text', + id: 'jstdbname', label: gettext('Database'), type: 'text', mode: ['properties'], disabled: function(m) { return false; } },{ id: 'jstconnstr', type: 'text', mode: ['properties'], - label: '{{ _('Connection string') }}' + label: gettext('Connection string') },{ - id: 'jstdbname', label: '{{ _('Database') }}', type: 'text', + id: 'jstdbname', label: gettext('Database'), type: 'text', control: 'node-list-by-name', node: 'database', cache_node: 'database', select2: {allowClear: true, placeholder: ''}, disabled: function(m) { return !m.get('jstkind') || !m.get('jstconntype'); }, deps: ['jstkind', 'jstconntype'], mode: ['create', 'edit'], - helpMessage: '{{ _('Please select the database on which the job step will run.') }}' + helpMessage: gettext('Please select the database on which the job step will run.') },{ - id: 'jstconnstr', label: '{{ _('Connection string') }}', type: 'text', + id: 'jstconnstr', label: gettext('Connection string'), type: 'text', deps: ['jstkind', 'jstconntype'], disabled: function(m) { return !m.get('jstkind') || m.get('jstconntype'); }, helpMessage: S( - '{{ _("Please specify the connection string for the remote database server. Each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty value, or a value containing spaces, surround it with single quotes, e.g., keyword = \\'a value\\'. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \\\' and \\\\.
For more information, please see the documentation on %s") }}' + gettext("Please specify the connection string for the remote database server. Each parameter setting is in the form keyword = value. Spaces around the equal sign are optional. To write an empty value, or a value containing spaces, surround it with single quotes, e.g., keyword = 'a value'. Single quotes and backslashes within the value must be escaped with a backslash, i.e., \' and \\.
For more information, please see the documentation on %s") ).sprintf( 'libpq connection strings' ).value(), mode: ['create', 'edit'] },{ - id: 'jstonerror', label: '{{ _('On error') }}', cell: 'select2', + id: 'jstonerror', label: gettext('On error'), cell: 'select2', control: 'select2', options: [ - {'label': '{{ _("Fail") }}', 'value': "f"}, - {'label': '{{ _("Success") }}', 'value': "s"}, - {'label': '{{ _("Ignore") }}', 'value': "i"} + {'label': gettext('Fail'), 'value': "f"}, + {'label': gettext('Success'), 'value': "s"}, + {'label': gettext('Ignore'), 'value': "i"} ], select2: {allowClear: false}, disabled: function(m) { return false; } },{ - id: 'jstdesc', label: '{{ _('Comment') }}', type: 'multiline' + id: 'jstdesc', label: gettext('Comment'), type: 'multiline' },{ id: 'jstcode', label: '', cell: 'string', deps: ['jstkind'], - type: 'text', control: 'sql-field', group: '{{ _('Code') }}', + type: 'text', control: 'sql-field', group: gettext('Code'), control: Backform.SqlFieldControl.extend({ render: function() { if (this.model.get('jstkind')) { - this.field.set('label', '{{ _('SQL query') }}'); + this.field.set('label', gettext('SQL query')); } else { - this.field.set('label', '{{ _('Script') }}'); + this.field.set('label', gettext('Script')); } return Backform.SqlFieldControl.prototype.render.apply( this, arguments @@ -181,7 +179,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) { _.isUndefined(val) || _.isNull(val) || String(val).replace(/^\s+|\s+$/g, '') == '' ) { - errMsg = '{{ _('Name cannot be empty.') }}'; + errMsg = gettext('Name cannot be empty.'); this.errorModel.set('jstname', errMsg); } else { this.errorModel.unset('jstname'); @@ -194,7 +192,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) { _.isUndefined(val) || _.isNull(val) || String(val).replace(/^\s+|\s+$/g, '') == '' ) { - var msg = '{{ _('Please select a database.') }}'; + var msg = gettext('Please select a database.'); errMsg = errMsg || msg; this.errorModel.set('jstdbname', msg); } else { @@ -209,9 +207,9 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) { _.isUndefined(val) || _.isNull(val) || String(val).replace(/^\s+|\s+$/g, '') == '' ) { - msg = '{{ _("Please enter a connection string.") }}'; + msg = gettext('Please enter a connection string.'); } else if (String(val).replace(r, '') != '') { - msg = '{{ _("Please enter a valid connection string.") }}'; + msg = gettext('Please enter a valid connection string.'); } else { var m, params = { @@ -231,12 +229,12 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) { if (params[m[1]]) { if (m[2]) continue; - msg = '{{ _("Please enter a valid connection string.") }}'; + msg = gettext('Please enter a valid connection string.'); break; } msg = S( - '{{ _("Invalid parameter in the connection string - %s.") }}' + gettext('Invalid parameter in the connection string - %s.') ).sprintf(m[1]).value(); break; } @@ -259,7 +257,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify, Backform) { _.isUndefined(val) || _.isNull(val) || String(val).replace(/^\s+|\s+$/g, '') == '' ) { - var msg = '{{ _('Please specify code to execute.') }}'; + var msg = gettext('Please specify code to execute.'); errMsg = errMsg || msg; this.errorModel.set('jstcode', msg); } else { diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/templates/pga_job/js/pga_job.js b/web/pgadmin/browser/server_groups/servers/pgagent/templates/pga_job/js/pga_job.js index 51f418105..170ad9946 100644 --- a/web/pgadmin/browser/server_groups/servers/pgagent/templates/pga_job/js/pga_job.js +++ b/web/pgadmin/browser/server_groups/servers/pgagent/templates/pga_job/js/pga_job.js @@ -1,16 +1,14 @@ -define( - [ - 'jquery', 'underscore', 'underscore.string', 'pgadmin', - 'pgadmin.browser', 'alertify', 'pgadmin.node.pga_jobstep', - 'pgadmin.node.pga_schedule' - ], -function($, _, S, pgAdmin, pgBrowser, Alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.node.pga_jobstep', + 'pgadmin.node.pga_schedule' +], function(gettext, $, _, S, pgAdmin, pgBrowser, Alertify) { if (!pgBrowser.Nodes['coll-pga_job']) { var pga_jobs = pgBrowser.Nodes['coll-pga_job'] = pgBrowser.Collection.extend({ node: 'pga_job', - label: '{{ _('pga_jobs') }}', + label: gettext('pga_jobs'), type: 'coll-pga_job', columns: ['jobid', 'jobname', 'jobenabled', 'jlgstatus', 'jobnextrun', 'joblastrun', 'jobdesc'], hasStatistics: false @@ -31,7 +29,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { canDrop: function(node) { return true; }, - label: '{{ _('pgAgent Job') }}', + label: gettext('pgAgent Job'), node_image: function() { return 'icon-pga_job'; }, @@ -45,17 +43,17 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { pgBrowser.add_menus([{ name: 'create_pga_job_on_coll', node: 'coll-pga_job', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('pgAgent Job...') }}', + category: 'create', priority: 4, label: gettext('pgAgent Job...'), icon: 'wcTabIcon icon-pga_job', data: {action: 'create'} },{ name: 'create_pga_job', node: 'pga_job', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('pgAgent Job...') }}', + category: 'create', priority: 4, label: gettext('pgAgent Job...'), icon: 'wcTabIcon icon-pga_job', data: {action: 'create'} }, { name: 'run_now_pga_job', node: 'pga_job', module: this, applies: ['object', 'context'], callback: 'run_pga_job_now', - priority: 4, label: '{{ _('Run now') }}', data: {action: 'create'}, + priority: 4, label: gettext('Run now'), data: {action: 'create'}, icon: 'fa fa-play-circle' }]); }, @@ -81,59 +79,59 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { var d = pgBrowser.Node.Model.prototype.parse.apply(this, arguments); if (d) { - d.jobrunningat = d.jaghostagent || "{{ _('Not running currently.') }}"; - d.jlgstatus = d.jlgstatus || "{{ _('Unknown') }}"; + d.jobrunningat = d.jaghostagent || gettext("Not running currently."); + d.jlgstatus = d.jlgstatus || gettext("Unknown"); } return d; }, schema: [{ - id: 'jobname', label: '{{ _('Name') }}', type: 'text', + id: 'jobname', label: gettext('Name'), type: 'text', cellHeaderClasses: 'width_percent_30' },{ - id: 'jobid', label:'{{ _('ID') }}', mode: ['properties'], + id: 'jobid', label: gettext('ID'), mode: ['properties'], type: 'int' },{ - id: 'jobenabled', label:'{{ _('Enabled?') }}', type: 'switch', + id: 'jobenabled', label: gettext('Enabled?'), type: 'switch', cellHeaderClasses: 'width_percent_5' },{ - id: 'jobclass', label: '{{ _('Job class') }}', type: 'text', + id: 'jobclass', label: gettext('Job class'), type: 'text', mode: ['properties'] },{ - id: 'jobjclid', label: '{{ _('Job class') }}', type: 'integer', + id: 'jobjclid', label: gettext('Job class'), type: 'integer', control: 'node-ajax-options', url: 'classes', url_with_id: false, cache_node: 'server', mode: ['create', 'edit'], select2: {allowClear: false}, - helpMessage: '{{ _('Please select a class to categorize the job. This option will not affect the way the job runs.') }}' + helpMessage: gettext('Please select a class to categorize the job. This option will not affect the way the job runs.') },{ - id: 'jobhostagent', label: '{{ _('Host agent') }}', type: 'text', + id: 'jobhostagent', label: gettext('Host agent'), type: 'text', mode: ['edit', 'create'], - helpMessage: '{{ _('Enter the hostname of a machine running pgAgent if you wish to ensure only that machine will run this job. Leave blank if any host may run the job.') }}' + helpMessage: gettext('Enter the hostname of a machine running pgAgent if you wish to ensure only that machine will run this job. Leave blank if any host may run the job.') },{ - id: 'jobhostagent', label: '{{ _('Host agent') }}', type: 'text', + id: 'jobhostagent', label: gettext('Host agent'), type: 'text', mode: ['properties'] },{ id: 'jobcreated', type: 'text', mode: ['properties'], - label: '{{ _('Created') }}' + label: gettext('Created') },{ id: 'jobchanged', type: 'text', mode: ['properties'], - label: '{{ _('Changed') }}' + label: gettext('Changed') },{ id: 'jobnextrun', type: 'text', mode: ['properties'], - label: '{{ _('Next run') }}', cellHeaderClasses: 'width_percent_20' + label: gettext('Next run'), cellHeaderClasses: 'width_percent_20' },{ id: 'joblastrun', type: 'text', mode: ['properties'], - label: '{{ _('Last run') }}', cellHeaderClasses: 'width_percent_20' + label: gettext('Last run'), cellHeaderClasses: 'width_percent_20' },{ - id: 'jlgstatus', type: 'text', label: '{{ _('Last result') }}', + id: 'jlgstatus', type: 'text', label: gettext('Last result'), cellHeaderClasses: 'width_percent_5', mode: ['properties'] },{ id: 'jobrunningat', type: 'text', mode: ['properties'], - label: '{{ _('Running at') }}' + label: gettext('Running at') },{ - id: 'jobdesc', label:'{{ _('Comment') }}', type: 'multiline', + id: 'jobdesc', label: gettext('Comment'), type: 'multiline', cellHeaderClasses: 'width_percent_15' },{ - id: 'jsteps', label: '', group: '{{ _("Steps") }}', + id: 'jsteps', label: '', group: gettext('Steps'), type: 'collection', mode: ['edit', 'create'], model: pgBrowser.Nodes['pga_jobstep'].model, canEdit: true, control: 'sub-node-collection', canAdd: true, canDelete: true, @@ -141,7 +139,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { 'jstname', 'jstenabled', 'jstkind', 'jstconntype', 'jstonerror' ] },{ - id: 'jschedules', label: '', group: '{{ _("Schedules") }}', + id: 'jschedules', label: '', group: gettext('Schedules'), type: 'collection', mode: ['edit', 'create'], control: 'sub-node-collection', canAdd: true, canDelete: true, canEdit: true, model: pgBrowser.Nodes['pga_schedule'].model, @@ -151,7 +149,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { var name = this.get('jobname'); if (_.isUndefined(name) || _.isNull(name) || String(name).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name cannot be empty.') }}'; + var msg = gettext('Name cannot be empty.'); this.errorModel.set('jobname', msg); return msg; } else { @@ -182,16 +180,16 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) { error: function(xhr, status, error) { var error_msg = "Unable to run pgagent job."; if (xhr.readyState == 0) { - alertify.error('{{ _('Not connected to the server or the connection to the server has been closed.') }}'); + alertify.error(gettext('Not connected to the server or the connection to the server has been closed.')); } else { if (_.isUndefined(xhr.responseText)) { - alertify.error("{{ _('" + error_msg + "') }}"); + alertify.error(error_msg); } else { var err = $.parseJSON(xhr.responseText); if (err.success == 0) { - alertify.error("{{ _('" + err.errormsg + "') }}"); + alertify.error(err.errormsg); } } } diff --git a/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/js/resource_groups.js b/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/js/resource_groups.js index 3cc822eb9..cec391799 100644 --- a/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/js/resource_groups.js +++ b/web/pgadmin/browser/server_groups/servers/resource_groups/templates/resource_groups/js/resource_groups.js @@ -1,32 +1,34 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection'], - function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'underscore', 'pgadmin.browser', + 'pgadmin.browser.collection' +], function(gettext, _, pgBrowser) { // Extend the browser's collection class for resource group collection if (!pgBrowser.Nodes['coll-resource_group']) { - var resourcegroups = pgAdmin.Browser.Nodes['coll-resource_group'] = - pgAdmin.Browser.Collection.extend({ + pgBrowser.Nodes['coll-resource_group'] = + pgBrowser.Collection.extend({ node: 'resource_group', - label: '{{ _('Resource Groups') }}', + label: gettext('Resource Groups'), type: 'coll-resource_group', columns: ['name', 'cpu_rate_limit', 'dirty_rate_limit'] }); - }; + } // Extend the browser's node class for resource group node if (!pgBrowser.Nodes['resource_group']) { - pgAdmin.Browser.Nodes['resource_group'] = pgAdmin.Browser.Node.extend({ + pgBrowser.Nodes['resource_group'] = pgBrowser.Node.extend({ parent_type: 'server', type: 'resource_group', - dialogHelp: '{{ url_for('help.static', filename='resource_group_dialog.html') }}', - label: '{{ _('Resource Group') }}', + dialogHelp: "{{ url_for('help.static', filename='resource_group_dialog.html') }}", + label: gettext('Resource Group'), hasSQL: true, canDrop: true, Init: function() { // Avoid multiple registration of menus - if (this.initialized) + if (this.initialized) { return; + } this.initialized = true; @@ -34,7 +36,7 @@ define( pgBrowser.add_menus([{ name: 'create_resourcegroup_on_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Resource Group...') }}', + category: 'create', priority: 4, label: gettext('Resource Group...'), icon: 'wcTabIcon icon-resource_group', data: {action: 'create'}, /* Function is used to check the server type and version. * Resource Group only supported in PPAS 9.4 and above. @@ -48,19 +50,19 @@ define( },{ name: 'create_resource_group_on_coll', node: 'coll-resource_group', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Resource Group...') }}', + category: 'create', priority: 4, label: gettext('Resource Group...'), icon: 'wcTabIcon icon-resource_group', data: {action: 'create'} },{ name: 'create_resource_group', node: 'resource_group', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Resource Group...') }}', + category: 'create', priority: 4, label: gettext('Resource Group...'), icon: 'wcTabIcon icon-resource_group', data: {action: 'create'} } ]); }, // Defining model for resource group node - model: pgAdmin.Browser.Node.Model.extend({ + model: pgBrowser.Node.Model.extend({ defaults: { name: undefined, cpu_rate_limit: 0.0, @@ -69,13 +71,13 @@ define( // Defining schema for the resource group node schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text', },{ - id: 'cpu_rate_limit', label:'{{ _('CPU rate limit (%%)') }}', cell: 'string', + id: 'cpu_rate_limit', label: gettext('CPU rate limit (%%)'), cell: 'string', type: 'numeric', min:0, max:16777216 },{ - id: 'dirty_rate_limit', label:'{{ _('Dirty rate limit (KB)') }}', cell: 'string', + id: 'dirty_rate_limit', label: gettext('Dirty rate limit (KB)'), cell: 'string', type: 'numeric', min:0, max:16777216 }], @@ -84,21 +86,21 @@ define( * the GUI for the respective control. */ validate: function(keys) { + var msg, cpu_rate_limit, dirty_rate_limit, name; /* Check whether 'name' is present in 'keys', if it is present * it means there is a change in that field from the GUI, so we * need to validate it. */ if (_.indexOf(keys, 'name') >= 0) { - var name = this.get('name'); + name = this.get('name'); if (_.isUndefined(name) || _.isNull(name) || - String(name).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Name cannot be empty.') }}'; + String(name).replace(/^\s+|\s+$/g, '') === '') { + msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); return msg; - } else { - this.errorModel.unset('name'); } + this.errorModel.unset('name'); } /* Check whether 'cpu_rate_limit' is present in 'keys', if it is present @@ -106,15 +108,14 @@ define( * need to validate it. */ if (_.indexOf(keys, 'cpu_rate_limit') >= 0) { - var cpu_rate_limit = this.get('cpu_rate_limit'); + cpu_rate_limit = this.get('cpu_rate_limit'); if (_.isUndefined(cpu_rate_limit) || _.isNull(cpu_rate_limit) || - String(cpu_rate_limit).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('CPU rate limit cannot be empty.') }}'; + String(cpu_rate_limit).replace(/^\s+|\s+$/g, '') === '') { + msg = gettext('CPU rate limit cannot be empty.'); this.errorModel.set('cpu_rate_limit', msg); return msg; - } else { - this.errorModel.unset('cpu_rate_limit'); } + this.errorModel.unset('cpu_rate_limit'); } /* Check whether 'dirty_rate_limit' is present in 'keys', if it is present @@ -122,21 +123,20 @@ define( * need to validate it. */ if (_.indexOf(keys, 'dirty_rate_limit') >= 0) { - var dirty_rate_limit = this.get('dirty_rate_limit'); + dirty_rate_limit = this.get('dirty_rate_limit'); if (_.isUndefined(dirty_rate_limit) || _.isNull(dirty_rate_limit) || - String(dirty_rate_limit).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Dirty rate limit cannot be empty.') }}'; + String(dirty_rate_limit).replace(/^\s+|\s+$/g, '') === '') { + msg = gettext('Dirty rate limit cannot be empty.'); this.errorModel.set('dirty_rate_limit', msg); return msg; - } else { - this.errorModel.unset('dirty_rate_limit'); } + this.errorModel.unset('dirty_rate_limit'); } return null; } }) - }) + }); } return pgBrowser.Nodes['coll-resource_group']; diff --git a/web/pgadmin/browser/server_groups/servers/roles/templates/role/js/role.js b/web/pgadmin/browser/server_groups/servers/roles/templates/role/js/role.js index a85416cd9..97f073803 100644 --- a/web/pgadmin/browser/server_groups/servers/roles/templates/role/js/role.js +++ b/web/pgadmin/browser/server_groups/servers/roles/templates/role/js/role.js @@ -1,10 +1,9 @@ -define( - [ - 'jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', - 'alertify', 'pgadmin.backform', 'select2', 'pgadmin.browser.collection', - 'pgadmin.browser.node.ui', 'pgadmin.browser.server.variable' - ], -function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.backform', 'select2', + 'pgadmin.browser.collection', 'pgadmin.browser.node.ui', + 'pgadmin.browser.server.variable' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify, Backform) { if (!pgBrowser.Nodes['coll-role']) { var role = pgAdmin.Browser.Nodes['coll-role'] = @@ -26,11 +25,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { label: null }, schema: [{ - id: 'provider', label: '{{ _('Provider') }}', + id: 'provider', label: gettext('Provider'), type: 'text', disabled: false, cellHeaderClasses:'width_percent_50' },{ - id: 'label', label: '{{ _('Security Label') }}', + id: 'label', label: gettext('Security Label'), type: 'text', disabled: false, cellHeaderClasses:'width_percent_50' }], @@ -42,7 +41,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { if (_.isUndefined(data.provider) || _.isNull(data.provider) || String(data.provider).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Please specify the value for all the security providers.') }}'; + var msg = gettext('Please specify the value for all the security providers.'); this.errorModel.set('provider', msg); return msg; @@ -53,7 +52,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { if (_.isUndefined(data.label) || _.isNull(data.label) || String(data.label).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Please specify the value for all the security providers.') }}' ; + var msg = gettext('Please specify the value for all the security providers.') ; this.errorModel.set('label', msg); return msg; @@ -252,7 +251,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { multiple: true, tags: true, allowClear: data.disabled ? false : true, - placeholder: data.disabled ? "" : "{{ _('Select members') }}", + placeholder: data.disabled ? "" : gettext("Select members"), width: 'style' }).on("change", function(e) { $(e.target).find(':selected').each(function() { @@ -313,7 +312,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { sqlAlterHelp: 'sql-alterrole.html', sqlCreateHelp: 'sql-createrole.html', dialogHelp: '{{ url_for('help.static', filename='role_dialog.html') }}', - label: '{{ _('Login/Group Role') }}', + label: gettext('Login/Group Role'), hasSQL: true, canDrop: function(node, item) { var treeData = this.getTreeNodeHierarchy(item), @@ -345,9 +344,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { return this.label; } if (d.can_login) { - return '{{ _('Login Role') }}' + ' - ' + d.label; + return gettext('Login Role') + ' - ' + d.label; } - return '{{ _('Group Role') }}' + ' - ' + d.label; + return gettext('Group Role') + ' - ' + d.label; }, Init: function() { /* Avoid mulitple registration of menus */ @@ -359,19 +358,19 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { pgBrowser.add_menus([{ name: 'create_role_on_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Login/Group Role...') }}', + category: 'create', priority: 4, label: gettext('Login/Group Role...'), icon: 'wcTabIcon icon-role', data: {action: 'create'}, enable: 'can_create_role' },{ name: 'create_role_on_roles', node: 'coll-role', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Login/Group Role...') }}', + category: 'create', priority: 4, label: gettext('Login/Group Role...'), icon: 'wcTabIcon icon-role', data: {action: 'create'}, enable: 'can_create_role' },{ name: 'create_role', node: 'role', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Login/Group Role...') }}', + category: 'create', priority: 4, label: gettext('Login/Group Role...'), icon: 'wcTabIcon icon-role', data: {action: 'create'}, enable: 'can_create_role' }]); @@ -402,14 +401,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { variables: [] }, schema: [{ - id: 'rolname', label: '{{ _('Name') }}', type: 'text', + id: 'rolname', label: gettext('Name'), type: 'text', disabled: 'readonly' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', mode: ['properties'], + id: 'oid', label: gettext('OID'), cell: 'string', mode: ['properties'], editable: false, type: 'text', visible: true, disabled: true },{ - id: 'rolpassword', label: '{{ _('Password') }}', type: 'password', - group: '{{ _('Definition') }}', mode: ['edit', 'create'], + id: 'rolpassword', label: gettext('Password'), type: 'password', + group: gettext('Definition'), mode: ['edit', 'create'], control: 'input', deps: ['rolcanlogin'], retype: true, cell: 'string', disabled: function(m) { if (!m.isNew()) { @@ -422,20 +421,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { } },{ id: 'rolvaliduntil', disabled: 'readonly', type: 'text', - group: '{{ _('Definition') }}', label: '{{ _('Account expires') }}', + group: gettext('Definition'), label: gettext('Account expires'), mode: ['properties', 'edit', 'create'], control: 'datetimepicker', deps: ['rolcanlogin'], options: {format: 'YYYY-MM-DD HH:mm:ss Z'} },{ - id: 'rolconnlimit', type: 'int', group: '{{ _('Definition') }}', - label: '{{ _('Connection limit') }}', cell: 'number', + id: 'rolconnlimit', type: 'int', group: gettext('Definition'), + label: gettext('Connection limit'), cell: 'number', mode: ['properties', 'edit', 'create'], disabled: 'readonly' },{ - id: 'rolcanlogin', label:'{{ _('Can login?') }}', type: 'switch', - group: '{{ _('Privileges') }}', options: switchOptions, + id: 'rolcanlogin', label: gettext('Can login?'), type: 'switch', + group: gettext('Privileges'), options: switchOptions, disabled: 'readonly', control: RoleCustomSwitchControl },{ - id: 'rolsuper', label:'{{ _('Superuser') }}', type: 'switch', - group: '{{ _('Privileges') }}', options: switchOptions, + id: 'rolsuper', label: gettext('Superuser'), type: 'switch', + group: gettext('Privileges'), options: switchOptions, control: RoleCustomSwitchControl.extend({ onChange: function() { Backform.SwitchControl.prototype.onChange.apply(this, arguments); @@ -447,39 +446,39 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { }), disabled: 'readonly' },{ - id: 'rolcreaterole', label:'{{ _('Create roles?') }}', - group: '{{ _('Privileges') }}', type: 'switch', + id: 'rolcreaterole', label: gettext('Create roles?'), + group: gettext('Privileges'), type: 'switch', options: switchOptions, disabled: 'readonly', control: RoleCustomSwitchControl },{ - id: 'description', label:'{{ _('Comments') }}', type: 'multiline', + id: 'description', label: gettext('Comments'), type: 'multiline', group: null, mode: ['properties', 'edit', 'create'], options: switchOptions, disabled: 'readonly' },{ - id: 'rolcreatedb', label:'{{ _('Create databases?') }}', - group: '{{ _('Privileges') }}', type: 'switch', + id: 'rolcreatedb', label: gettext('Create databases?'), + group: gettext('Privileges'), type: 'switch', options: switchOptions, disabled: 'readonly', control: RoleCustomSwitchControl },{ - id: 'rolcatupdate', label:'{{ _('Update catalog?') }}', + id: 'rolcatupdate', label: gettext('Update catalog?'), type: 'switch', max_version: 90400, options: switchOptions, control: RoleCustomSwitchControl, - group: '{{ _('Privileges') }}', disabled: function(m) { + group: gettext('Privileges'), disabled: function(m) { return (m.get('read_only') || (!m.get('rolsuper'))); } },{ - id: 'rolinherit', group: '{{ _('Privileges') }}', - label:'{{ _('Inherit rights from the parent roles?') }}', + id: 'rolinherit', group: gettext('Privileges'), + label: gettext('Inherit rights from the parent roles?'), type: 'switch', options: switchOptions, disabled: 'readonly', control: RoleCustomSwitchControl },{ - id: 'rolreplication', group: '{{ _('Privileges') }}', - label:'{{ _('Can initiate streaming replication and backups?') }}', + id: 'rolreplication', group: gettext('Privileges'), + label: gettext('Can initiate streaming replication and backups?'), type: 'switch', min_version: 90100, options: switchOptions, disabled: 'readonly', control: RoleCustomSwitchControl },{ - id: 'rolmembership', label: '{{ _('Roles') }}', - group: '{{ _('Membership') }}', type: 'collection', + id: 'rolmembership', label: gettext('Roles'), + group: gettext('Membership'), type: 'collection', cell: 'string', disabled: 'readonly', mode: ['properties', 'edit', 'create'], control: RoleMembersControl, model: pgBrowser.Node.Model.extend({ @@ -497,22 +496,22 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { }, helpMessage: function(m) { if (m.has('read_only') && m.get('read_only') == false) { - return '{{ _('Select the checkbox for roles to include WITH ADMIN OPTION.') }}'; + return gettext('Select the checkbox for roles to include WITH ADMIN OPTION.'); } else { - return '{{ _('Roles shown with a check mark have the WITH ADMIN OPTION set.') }}'; + return gettext('Roles shown with a check mark have the WITH ADMIN OPTION set.'); } } },{ - id: 'variables', label: '{{ _('Parameters') }}', type: 'collection', - group: '{{ _('Parameters') }}', hasDatabase: true, url: 'variables', + id: 'variables', label: gettext('Parameters'), type: 'collection', + group: gettext('Parameters'), hasDatabase: true, url: 'variables', model: pgBrowser.Node.VariableModel.extend({keys:['name', 'database']}), control: 'variable-collection', mode: [ 'edit', 'create'], canAdd: true, canDelete: true, url: "variables", disabled: 'readonly' },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', + id: 'seclabels', label: gettext('Security Labels'), model: SecurityModel, editable: false, type: 'collection', - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: gettext('Security'), mode: ['edit', 'create'], min_version: 90200, disabled: 'readonly', canAdd: true, canEdit: false, canDelete: true, control: 'unique-col-collection' }], @@ -532,7 +531,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backform) { seclabels = this.get('seclabels'); if (_.isUndefined(this.get('rolname')) || String(this.get('rolname')).replace(/^\s+|\s+$/g, '') == '') { - err['name'] = '{{ _('Name cannot be empty.') }}'; + err['name'] = gettext('Name cannot be empty.'); errmsg = errmsg || err['name']; } diff --git a/web/pgadmin/browser/server_groups/servers/static/js/privilege.js b/web/pgadmin/browser/server_groups/servers/static/js/privilege.js index 6b7efb63f..e89fdbfa4 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/privilege.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/privilege.js @@ -1,11 +1,11 @@ (function(root, factory) { // Set up Backform appropriately for the environment. Start with AMD. if (typeof define === 'function' && define.amd) { - define(['underscore', 'jquery', 'backbone', 'backform', 'backgrid', 'alertify', 'pgadmin.browser.node'], - function(_, $, Backbone, Backform, Backgrid, Alertify, pgNode) { + define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform', 'backgrid', 'alertify', 'pgadmin.browser.node'], + function(gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgNode) { // Export global even in AMD case in case this script is loaded with // others that may still expect a global Backform. - return factory(root, _, $, Backbone, Backform, Backgrid, Alertify, pgNode); + return factory(root, gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgNode); }); // Next for Node.js or CommonJS. jQuery may not be needed as a module. @@ -16,14 +16,15 @@ Backform = require('backform') || root.Backform; Backgrid = require('backgrid') || root.Backgrid; Alertify = require('alertify') || root.Alertify; - pgAdmin = require('pgadmin.browser.node') || root.pgAdmin.Browser.Node; - factory(root, _, $, Backbone, Backform, Alertify, pgNode); + pgAdmin = require('pgadmin.browser.node') || root.pgAdmin.Browser.Node, + gettext = require('sources/gettext') || root.gettext; + factory(root, gettext, _, $, Backbone, Backform, Alertify, pgNode); // Finally, as a browser global. } else { - factory(root, root._, (root.jQuery || root.Zepto || root.ender || root.$), root.Backbone, root.Backform, root.Backgrid, root.alertify, root.pgAdmin.Browser.Node); + factory(root, root.gettext, root._, (root.jQuery || root.Zepto || root.ender || root.$), root.Backbone, root.Backform, root.Backgrid, root.alertify, root.pgAdmin.Browser.Node); } -} (this, function(root, _, $, Backbone, Backform, Backgrid, Alertify, pgNode) { +} (this, function(root, gettext, _, $, Backbone, Backform, Backgrid, Alertify, pgNode) { /** * Each Privilege, supporeted by an database object, will be represented @@ -285,7 +286,7 @@ msg = undefined; if (_.isUndefined(this.get('grantee'))) { - msg = window.pgAdmin.Browser.messages.PRIV_GRANTEE_NOT_SPECIFIED; + msg = gettext('A grantee must be selected.'); this.errorModel.set('grantee', msg); errmsg = msg; } else { @@ -304,7 +305,7 @@ }); if (!anyPrivSelected) { - msg = window.pgAdmin.Browser.messages.NO_PRIV_SELECTED; + msg = gettext('At least one privilege should be selected.'); this.errorModel.set('privileges', msg); errmsg = errmsg || msg; } else { @@ -584,9 +585,9 @@ } } else { this.model.errorModel.set( - 'privileges', window.pgAdmin.Browser.messages.NO_PRIV_SELECTED + 'privileges', gettext('At least one privilege should be selected.') ); - msg = window.pgAdmin.Browser.messages.NO_PRIV_SELECTED; + msg = gettext('At least one privilege should be selected.'); } if (msg) { this.model.collection.trigger( diff --git a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/js/tablespaces.js b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/js/tablespaces.js index 14feb8060..2691640f6 100644 --- a/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/js/tablespaces.js +++ b/web/pgadmin/browser/server_groups/servers/tablespaces/templates/tablespaces/js/tablespaces.js @@ -1,12 +1,14 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', 'pgadmin.browser.node.ui', 'pgadmin.browser.server.privilege'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify', 'pgadmin.browser.collection', + 'pgadmin.browser.node.ui', 'pgadmin.browser.server.privilege' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['coll-tablespace']) { var databases = pgBrowser.Nodes['coll-tablespace'] = pgBrowser.Collection.extend({ node: 'tablespace', - label: '{{ _('Tablespaces') }}', + label: gettext('Tablespaces'), type: 'coll-tablespace', columns: ['name', 'spcuser', 'description'], hasStatistics: true, @@ -21,7 +23,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { sqlAlterHelp: 'sql-altertablespace.html', sqlCreateHelp: 'sql-createtablespace.html', dialogHelp: '{{ url_for('help.static', filename='tablespace_dialog.html') }}', - label: '{{ _('Tablespace') }}', + label: gettext('Tablespace'), hasSQL: true, canDrop: true, hasDepends: true, @@ -37,26 +39,26 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_tablespace_on_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Tablespace...') }}', + category: 'create', priority: 4, label: gettext('Tablespace...'), icon: 'wcTabIcon icon-tablespace', data: {action: 'create'}, enable: 'can_create_tablespace' },{ name: 'create_tablespace_on_coll', node: 'coll-tablespace', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Tablespace...') }}', + category: 'create', priority: 4, label: gettext('Tablespace...'), icon: 'wcTabIcon pg-icon-tablespace', data: {action: 'create'}, enable: 'can_create_tablespace' },{ name: 'create_tablespace', node: 'tablespace', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 4, label: '{{ _('Tablespace...') }}', + category: 'create', priority: 4, label: gettext('Tablespace...'), icon: 'wcTabIcon pg-icon-tablespace', data: {action: 'create'}, enable: 'can_create_tablespace' },{ name: 'move_tablespace', node: 'tablespace', module: this, applies: ['object', 'context'], callback: 'move_objects', category: 'move_tablespace', priority: 5, - label: '{{ _('Move objects to...') }}', + label: gettext('Move objects to...'), icon: 'fa fa-exchange', data: {action: 'create'}, enable: 'can_move_objects' } @@ -100,14 +102,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { user: undefined }, schema: [{ - id: 'tblspc', label: '{{ _('New tablespace') }}', + id: 'tblspc', label: gettext('New tablespace'), type: 'text', disabled: false, control: 'node-list-by-name', node: 'tablespace', select2: {allowClear: false}, filter: function(o) { return o && (o.label != d.label); } },{ - id: 'obj_type', label: '{{ _('Object type') }}', + id: 'obj_type', label: gettext('Object type'), type: 'text', disabled: false, control: 'select2', select2: { allowClear: false, width: "100%" }, options: [ @@ -117,11 +119,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { {label: "Materialized views", value: 'materialized_views'}, ] },{ - id: 'user', label: '{{ _('Object owner') }}', + id: 'user', label: gettext('Object owner'), type: 'text', disabled: false, control: 'node-list-by-name', node: 'role', select2: {allowClear: false} },{ - id: 'sqltab', label: '{{ _('SQL') }}', group: '{{ _('SQL') }}', + id: 'sqltab', label: gettext('SQL'), group: gettext('SQL'), type: 'text', disabled: false, control: Backform.SqlTabControl.extend({ initialize: function() { // Initialize parent class @@ -165,7 +167,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { alertify.dialog('move_objects_dlg' ,function factory() { return { main: function() { - var title = '{{ _('Move objects to another tablespace') }} '; + var title = gettext('Move objects to another tablespace '); this.set('title', title); }, build: function() { @@ -175,12 +177,12 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return { buttons: [{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question', - attrs:{name:'dialog_help', type:'button', label: '{{ _('Users') }}', + attrs:{name:'dialog_help', type:'button', label: gettext('Users'), url: '{{ url_for('help.static', filename='move_objects.html') }}'} },{ - text: '{{ _('OK') }}', key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button' + text: gettext('OK'), key: 27, className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button' },{ - text: '{{ _('Cancel') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button' + text: gettext('Cancel'), key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button' }], // Set options for dialog options: { @@ -245,7 +247,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { self.__internal.buttons[1].element.disabled = false; } else { self.__internal.buttons[1].element.disabled = true; - this.errorModel.set('tblspc', '{{ _('Please select tablespace') }}') + this.errorModel.set('tblspc', gettext('Please select tablespace')) } }); }, @@ -257,16 +259,17 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { null, null, e.button.element.getAttribute('label')); return; } - if (e.button.text === '{{ _('OK') }}') { + if (e.button.text === gettext('OK')) { var self = this, args = this.view.model.toJSON(); args.old_tblspc = d.label; e.cancel = true; - alertify.confirm('{{ _('Move objects...') }}', - '{{ _('Are you sure you wish to move objects ') }}' - + '"' + args.old_tblspc + '"' - + '{{ _(' to ') }}' - + '"' + args.tblspc + '"?', + alertify.confirm( + gettext('Move objects...'), + gettext( + 'Are you sure you wish to move objects %(old_tablespace)s to %s(new_tablespace)s', + {old_tablespace: args.old_tblspc, new_tablespace: args.tblspc} + ), function() { $.ajax({ url: url, @@ -325,46 +328,46 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }, schema: [{ - id: 'name', label: '{{ _('Name') }}', cell: 'string', + id: 'name', label: gettext('Name'), cell: 'string', type: 'text' },{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', + id: 'oid', label: gettext('OID'), cell: 'string', type: 'text', disabled: true, mode: ['properties'] },{ - id: 'spclocation', label:'{{ _('Location') }}', cell: 'string', - group: '{{ _('Definition') }}', type: 'text', mode: ['properties', 'edit','create'], + id: 'spclocation', label: gettext('Location'), cell: 'string', + group: gettext('Definition'), type: 'text', mode: ['properties', 'edit','create'], disabled: function(m) { // To disabled it in edit mode, // We'll check if model is new if yes then disabled it return !m.isNew(); } },{ - id: 'spcuser', label:'{{ _('Owner') }}', cell: 'string', + id: 'spcuser', label: gettext('Owner'), cell: 'string', type: 'text', control: 'node-list-by-name', node: 'role', select2: {allowClear: false} },{ - id: 'acl', label: '{{ _('Privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + id: 'acl', label: gettext('Privileges'), type: 'text', + group: gettext('Security'), mode: ['properties'], disabled: true },{ - id: 'description', label:'{{ _('Comment') }}', cell: 'string', + id: 'description', label: gettext('Comment'), cell: 'string', type: 'multiline' },{ - id: 'spcoptions', label: '{{ _('Parameters') }}', type: 'collection', - group: "Parameters", control: 'variable-collection', + id: 'spcoptions', label: gettext('Parameters'), type: 'collection', + group: gettext("Parameters"), control: 'variable-collection', model: pgBrowser.Node.VariableModel, mode: ['edit', 'create'], canAdd: true, canEdit: false, canDelete: true },{ - id: 'spcacl', label: '{{ _('Privileges') }}', type: 'collection', - group: '{{ _('Security') }}', control: 'unique-col-collection', + id: 'spcacl', label: gettext('Privileges'), type: 'collection', + group: gettext('Security'), control: 'unique-col-collection', model: pgBrowser.Node.PrivilegeRoleModel.extend({privileges: ['C']}), mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['grantee'], columns: ['grantee', 'grantor', 'privileges'] },{ - id: 'seclabels', label: '{{ _('Security Labels') }}', + id: 'seclabels', label: gettext('Security Labels'), model: pgBrowser.SecLabelModel, editable: false, type: 'collection', - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: gettext('Security'), mode: ['edit', 'create'], min_version: 90200, canAdd: true, canEdit: false, canDelete: true, control: 'unique-col-collection' } @@ -376,11 +379,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { msg = undefined; if (_.isUndefined(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Name cannot be empty.') }}'; + msg = gettext('Name cannot be empty.'); this.errorModel.set('name', msg); } else if (_.isUndefined(this.get('spclocation')) || String(this.get('spclocation')).replace(/^\s+|\s+$/g, '') == '') { - msg = '{{ _('Location cannot be empty.') }}'; + msg = gettext('Location cannot be empty.'); this.errorModel.set('spclocation', msg); } else { this.errorModel.unset('name'); diff --git a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js index 9eb82b820..5ff911b6f 100644 --- a/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js +++ b/web/pgadmin/browser/server_groups/servers/templates/servers/servers.js @@ -1,6 +1,7 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser', 'alertify'], -function($, _, S, pgAdmin, pgBrowser, alertify) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser', 'alertify' +], function(gettext, $, _, S, pgAdmin, pgBrowser, alertify) { if (!pgBrowser.Nodes['server']) { @@ -10,11 +11,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { label: undefined }, schema: [{ - id: 'provider', label: '{{ _('Provider') }}', + id: 'provider', label: gettext('Provider'), type: 'text', editable: true, cellHeaderClasses:'width_percent_50' },{ - id: 'label', label: '{{ _('Security Label') }}', + id: 'label', label: gettext('Security Label'), type: 'text', editable: true, cellHeaderClasses:'width_percent_50' }], @@ -26,7 +27,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (_.isUndefined(this.get('label')) || _.isNull(this.get('label')) || String(this.get('label')).replace(/^\s+|\s+$/g, '') == '') { - errmsg = '{{ _('Label must be specified.') }}'; + errmsg = gettext('Label must be specified.'); this.errorModel.set('label', errmsg); return errmsg; } @@ -39,7 +40,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { parent_type: 'server-group', type: 'server', dialogHelp: '{{ url_for('help.static', filename='server_dialog.html') }}', - label: '{{ _('Server') }}', + label: gettext('Server'), canDrop: true, hasStatistics: true, hasCollectiveStatistics: true, @@ -57,55 +58,50 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgBrowser.add_menus([{ name: 'create_server_on_sg', node: 'server-group', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 1, label: '{{ _('Server...') }}', + category: 'create', priority: 1, label: gettext('Server...'), data: {action: 'create'}, icon: 'wcTabIcon icon-server' },{ name: 'create_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 3, label: '{{ _('Server...') }}', + category: 'create', priority: 3, label: gettext('Server...'), data: {action: 'create'}, icon: 'wcTabIcon icon-server' },{ name: 'connect_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'connect_server', - category: 'connect', priority: 4, label: '{{ _('Connect Server') }}', + category: 'connect', priority: 4, label: gettext('Connect Server'), icon: 'fa fa-link', enable : 'is_not_connected' },{ name: 'disconnect_server', node: 'server', module: this, applies: ['object', 'context'], callback: 'disconnect_server', - category: 'drop', priority: 5, label: '{{ _('Disconnect Server') }}', + category: 'drop', priority: 5, label: gettext('Disconnect Server'), icon: 'fa fa-chain-broken', enable : 'is_connected' },{ name: 'reload_configuration', node: 'server', module: this, applies: ['tools', 'context'], callback: 'reload_configuration', - category: 'reload', priority: 6, label: '{{ _('Reload Configuration') }}', + category: 'reload', priority: 6, label: gettext('Reload Configuration'), icon: 'fa fa-repeat', enable : 'enable_reload_config' },{ name: 'restore_point', node: 'server', module: this, applies: ['tools', 'context'], callback: 'restore_point', - category: 'restore', priority: 9, label: '{{ _('Add Named Restore Point...') }}', + category: 'restore', priority: 9, label: gettext('Add Named Restore Point...'), icon: 'fa fa-anchor', enable : 'is_applicable' },{ name: 'change_password', node: 'server', module: this, applies: ['file'], callback: 'change_password', - label: '{{ _('Change Password...') }}', + label: gettext('Change Password...'), icon: 'fa fa-lock', enable : 'is_connected' },{ name: 'wal_replay_pause', node: 'server', module: this, applies: ['tools', 'context'], callback: 'pause_wal_replay', - category: 'wal_replay_pause', priority: 7, label: '{{ _('Pause Replay of WAL') }}', + category: 'wal_replay_pause', priority: 7, label: gettext('Pause Replay of WAL'), icon: 'fa fa-pause-circle', enable : 'wal_pause_enabled' },{ name: 'wal_replay_resume', node: 'server', module: this, applies: ['tools', 'context'], callback: 'resume_wal_replay', - category: 'wal_replay_resume', priority: 8, label: '{{ _('Resume Replay of WAL') }}', + category: 'wal_replay_resume', priority: 8, label: gettext('Resume Replay of WAL'), icon: 'fa fa-play-circle', enable : 'wal_resume_enabled' }]); - pgBrowser.messages['PRIV_GRANTEE_NOT_SPECIFIED'] = - '{{ _('A grantee must be selected.') }}'; - pgBrowser.messages['NO_PRIV_SELECTED'] = - '{{ _('At least one privilege should be selected.') }}'; - _.bindAll(this, 'connection_lost'); pgBrowser.Events.on( 'pgadmin:server:connection:lost', this.connection_lost @@ -226,16 +222,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (notify) { alertify.confirm( - '{{ _('Disconnect server') }}', - S('{{ _('Are you sure you want to disconnect the server %s?') }}').sprintf( - d.label - ).value(), - function(evt) { - disconnect(); - }, - function(evt) { - return true; - }); + gettext('Disconnect server'), + gettext( + 'Are you sure you want to disconnect the server %(server)s?', + {server: d.label} + ), + function(evt) { disconnect(); }, + function(evt) { return true;} + ); } else { disconnect(); } @@ -278,8 +272,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return false; alertify.confirm( - '{{ _('Reload server configuration') }}', - S('{{ _('Are you sure you want to reload the server configuration on %s?') }}').sprintf(d.label).value(), + gettext('Reload server configuration'), + S( gettext('Are you sure you want to reload the server configuration on %s?')).sprintf(d.label).value(), function(evt) { $.ajax({ url: obj.generate_url(i, 'reload', d, true), @@ -320,7 +314,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { if (!d) return false; - alertify.prompt('{{ _('Enter the name of the restore point to add') }}', '', + alertify.prompt( gettext('Enter the name of the restore point to add'), '', // We will execute this function when user clicks on the OK button function(evt, value) { // If user has provided a value, send it to the server @@ -345,7 +339,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { }); } else { evt.cancel = true; - alertify.error('{{ _('Please enter a valid name.') }}', 10); + alertify.error( gettext('Please enter a valid name.'), 10); } }, // We will execute this function when user clicks on the Cancel button @@ -382,18 +376,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } }), passwordChangeFields = [{ - name: 'user_name', label: '{{ _('User') }}', + name: 'user_name', label: gettext('User'), type: 'text', disabled: true, control: 'input' },{ - name: 'password', label: '{{ _('Current Password') }}', + name: 'password', label: gettext('Current Password'), type: 'password', disabled: false, control: 'input', required: true },{ - name: 'newPassword', label: '{{ _('New Password') }}', + name: 'newPassword', label: gettext('New Password'), type: 'password', disabled: false, control: 'input', required: true },{ - name: 'confirmPassword', label: '{{ _('Confirm Password') }}', + name: 'confirmPassword', label: gettext('Confirm Password'), type: 'password', disabled: false, control: 'input', required: true }]; @@ -402,16 +396,16 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { alertify.dialog('changeServerPassword' ,function factory() { return { main: function(params) { - var title = '{{ _('Change Password') }} '; + var title = gettext('Change Password '); this.set('title', title); this.user_name = params.user.name; }, setup:function() { return { buttons: [{ - text: '{{ _('Ok') }}', key: 27, className: 'btn btn-primary', attrs:{name:'submit'} + text: gettext('Ok'), key: 27, className: 'btn btn-primary', attrs:{name:'submit'} },{ - text: '{{ _('Cancel') }}', key: 27, className: 'btn btn-danger', attrs:{name:'cancel'} + text: gettext('Cancel'), key: 27, className: 'btn btn-danger', attrs:{name:'cancel'} }], // Set options for dialog options: { @@ -465,7 +459,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { this.errorTimeout && clearTimeout(this.errorTimeout); this.errorTimeout = setTimeout(function() { - that.errorModel.set('confirmPassword', '{{ _('Passwords do not match.') }}'); + that.errorModel.set('confirmPassword', gettext('Passwords do not match.')); } ,400); }else { that.errorModel.clear(); @@ -621,57 +615,57 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments); }, schema: [{ - id: 'id', label: '{{ _('ID') }}', type: 'int', mode: ['properties'] + id: 'id', label: gettext('ID'), type: 'int', mode: ['properties'] },{ - id: 'name', label:'{{ _('Name') }}', type: 'text', + id: 'name', label: gettext('Name'), type: 'text', mode: ['properties', 'edit', 'create'] },{ - id: 'gid', label: '{{ _('Server group') }}', type: 'int', + id: 'gid', label: gettext('Server group'), type: 'int', control: 'node-list-by-id', node: 'server-group', mode: ['create', 'edit'], select2: {allowClear: false} },{ - id: 'server_type', label: '{{ _('Server type') }}', type: 'options', + id: 'server_type', label: gettext('Server type'), type: 'options', mode: ['properties'], visible: 'isConnected', 'options': [{% for st in server_types %} {label: '{{ st.description }}', value: '{{ st.server_type }}'},{% endfor %} - {label: '{{ _('Unknown') }}', value: ''} + {label: gettext('Unknown'), value: ''} ] },{ - id: 'connected', label:'{{ _('Connected?') }}', type: 'switch', - mode: ['properties'], group: "{{ 'Connection' }}", 'options': { + id: 'connected', label: gettext('Connected?'), type: 'switch', + mode: ['properties'], group: gettext('Connection'), 'options': { 'onText': 'True', 'offText': 'False', 'onColor': 'success', 'offColor': 'danger', 'size': 'small' } },{ - id: 'version', label:'{{ _('Version') }}', type: 'text', group: null, + id: 'version', label: gettext('Version'), type: 'text', group: null, mode: ['properties'], visible: 'isConnected' },{ - id: 'connect_now', controlLabel:'{{ _('Connect now?') }}', type: 'checkbox', + id: 'connect_now', controlLabel: gettext('Connect now?'), type: 'checkbox', group: null, mode: ['create'] },{ - id: 'comment', label:'{{ _('Comments') }}', type: 'multiline', group: null, + id: 'comment', label: gettext('Comments'), type: 'multiline', group: null, mode: ['properties', 'edit', 'create'] },{ - id: 'host', label:'{{ _('Host name/address') }}', type: 'text', group: "{{ 'Connection' }}", + id: 'host', label: gettext('Host name/address'), type: 'text', group: gettext('Connection'), mode: ['properties', 'edit', 'create'], disabled: 'isConnected' },{ - id: 'port', label:'{{ _('Port') }}', type: 'int', group: "{{ 'Connection' }}", + id: 'port', label: gettext('Port'), type: 'int', group: gettext('Connection'), mode: ['properties', 'edit', 'create'], disabled: 'isConnected', min: 1024, max: 65535 },{ - id: 'db', label:'{{ _('Maintenance database') }}', type: 'text', group: "{{ 'Connection' }}", + id: 'db', label: gettext('Maintenance database'), type: 'text', group: gettext('Connection'), mode: ['properties', 'edit', 'create'], disabled: 'isConnected' },{ - id: 'username', label:'{{ _('Username') }}', type: 'text', group: "{{ 'Connection' }}", + id: 'username', label: gettext('Username'), type: 'text', group: gettext('Connection'), mode: ['properties', 'edit', 'create'], disabled: 'isConnected' },{ - id: 'password', label:'{{ _('Password') }}', type: 'password', - group: "{{ 'Connection' }}", control: 'input', mode: ['create'], deps: ['connect_now'], + id: 'password', label: gettext('Password'), type: 'password', + group: gettext('Connection'), control: 'input', mode: ['create'], deps: ['connect_now'], visible: function(m) { return m.get('connect_now') && m.isNew(); } },{ - id: 'save_password', controlLabel:'{{ _('Save password?') }}', type: 'checkbox', - group: "{{ 'Connection' }}", mode: ['create'], deps: ['connect_now'], + id: 'save_password', controlLabel: gettext('Save password?'), type: 'checkbox', + group: gettext('Connection'), mode: ['create'], deps: ['connect_now'], visible: function(m) { return m.get('connect_now') && m.isNew(); }, @@ -679,10 +673,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return {% if config.ALLOW_SAVE_PASSWORD %}false{% else %}true{% endif %}; } },{ - id: 'role', label:'{{ _('Role') }}', type: 'text', group: "{{ 'Connection' }}", + id: 'role', label: gettext('Role'), type: 'text', group: gettext('Connection'), mode: ['properties', 'edit', 'create'], disabled: 'isConnected' },{ - id: 'sslmode', label:'{{ _('SSL mode') }}', type: 'options', group: "{{ 'Connection' }}", + id: 'sslmode', label: gettext('SSL mode'), type: 'options', group: gettext('Connection'), mode: ['properties', 'edit', 'create'], disabled: 'isConnected', 'options': [ {label: 'Allow', value: 'allow'}, @@ -711,21 +705,21 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { } if (!self.isNew() && 'id' in self.sessAttrs) { - err['id'] = '{{ _('The ID cannot be changed.') }}';; + err['id'] = gettext('The ID cannot be changed.');; errmsg = err['id']; } else { self.errorModel.unset('id'); } - check_for_empty('name', '{{ _('Name must be specified.') }}'); + check_for_empty('name', gettext('Name must be specified.')); check_for_empty( - 'host', '{{ _('Hostname or address must be specified.') }}' + 'host', gettext('Hostname or address must be specified.') ); check_for_empty( - 'db', '{{ _('Maintenance database must be specified.') }}' + 'db', gettext('Maintenance database must be specified.') ); check_for_empty( - 'username', '{{ _('Username must be specified.') }}' + 'username', gettext('Username must be specified.') ); this.errorModel.set(err); @@ -783,8 +777,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { 'pgadmin:server:connect:cancelled', disconnect ); alertify.confirm( - '{{ _('Connection lost') }}', - '{{ _('Would you like to reconnect to the database?') }}', + gettext('Connection lost'), + gettext('Would you like to reconnect to the database?'), function() { connect_to_server(self, d, t, i, true); }, @@ -820,7 +814,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { alertify.pgNotifier('error', xhr, error, function(msg) { setTimeout(function() { alertify.dlgServerPass( - '{{ _('Connect to Server') }}', + gettext('Connect to Server'), msg, _node, _data, _tree, _item, _wasConnected ).resizeTo(); }, 100); @@ -894,10 +888,10 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { return { buttons:[ { - text: "{{ _('OK') }}", key: 13, className: "btn btn-primary" + text: gettext("OK"), key: 13, className: "btn btn-primary" }, { - text: "{{ _('Cancel') }}", className: "btn btn-danger" + text: gettext("Cancel"), className: "btn btn-danger" } ], focus: { element: '#password', select: true }, @@ -920,7 +914,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { _onFailure = this.onFailure, _onCancel = this.onCancel; - if (closeEvent.button.text == "{{ _('OK') }}") { + if (closeEvent.button.text == gettext("OK")) { var _url = _node.generate_url(_item, 'connect', _data, true); diff --git a/web/pgadmin/browser/server_groups/templates/server_groups/server_groups.js b/web/pgadmin/browser/server_groups/templates/server_groups/server_groups.js index bbb657510..508033865 100644 --- a/web/pgadmin/browser/server_groups/templates/server_groups/server_groups.js +++ b/web/pgadmin/browser/server_groups/templates/server_groups/server_groups.js @@ -1,13 +1,14 @@ -define( - ['jquery', 'underscore', 'pgadmin', 'backbone', 'pgadmin.browser', 'pgadmin.browser.node'], -function($, _, pgAdmin, Backbone) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'pgadmin', 'backbone', + 'pgadmin.browser', 'pgadmin.browser.node' +], function(gettext, $, _, pgAdmin, Backbone) { if (!pgAdmin.Browser.Nodes['server-group']) { pgAdmin.Browser.Nodes['server-group'] = pgAdmin.Browser.Node.extend({ parent_type: null, type: 'server-group', dialogHelp: '{{ url_for('help.static', filename='server_group_dialog.html') }}', - label: '{{ _('Server Group') }}', + label: gettext('Server Group'), width: '350px', height: '250px', is_collection: true, @@ -21,7 +22,7 @@ function($, _, pgAdmin, Backbone) { pgAdmin.Browser.add_menus([{ name: 'create_server_group', node: 'server-group', module: this, applies: ['object', 'context'], callback: 'show_obj_properties', - category: 'create', priority: 1, label: '{{ _('Server Group...') }}', + category: 'create', priority: 1, label: gettext('Server Group...'), data: {'action': 'create'}, icon: 'wcTabIcon icon-server-group' }]); }, @@ -32,10 +33,10 @@ function($, _, pgAdmin, Backbone) { }, schema: [ { - id: 'id', label: '{{ _('ID') }}', type: 'int', group: null, + id: 'id', label: gettext('ID'), type: 'int', group: null, mode: ['properties'] },{ - id: 'name', label:'{{ _('Name') }}', type: 'text', group: null, + id: 'name', label: gettext('Name'), type: 'text', group: null, mode: ['properties', 'edit', 'create'] } ], @@ -45,14 +46,14 @@ function($, _, pgAdmin, Backbone) { this.errorModel.clear(); if (!this.isNew() && 'id' in this.changed) { - errmsg = '{{ _('The ID cannot be changed.') }}'; + errmsg = gettext('The ID cannot be changed.'); this.errorModel.set('id', errmsg); return errmsg; } if (_.isUndefined(this.get('name')) || _.isNull(this.get('name')) || String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') { - errmsg = '{{ _('Name cannot be empty.') }}'; + errmsg = gettext('Name cannot be empty.'); this.errorModel.set('name', errmsg); return errmsg; } diff --git a/web/pgadmin/browser/static/js/node.ui.js b/web/pgadmin/browser/static/js/node.ui.js index 8e9ffceb5..954aacc6f 100644 --- a/web/pgadmin/browser/static/js/node.ui.js +++ b/web/pgadmin/browser/static/js/node.ui.js @@ -1,8 +1,8 @@ define([ - 'jquery', 'underscore', 'pgadmin', 'backbone', 'backform', 'alertify', - 'pgadmin.browser.node', 'pgadmin.browser.messages' + 'sources/gettext', 'jquery', 'underscore', 'pgadmin', 'backbone', 'backform', 'alertify', + 'pgadmin.browser.node' ], -function($, _, pgAdmin, Backbone, Backform, Alertify, Node) { +function(gettext, $, _, pgAdmin, Backbone, Backform, Alertify, Node) { var pgBrowser = pgAdmin.Browser; @@ -27,14 +27,14 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) { ' style="width: 49%;margin: 0 0.5%;">', '', '', - pgAdmin.Browser.messages['SELECT_ALL'], + gettext("Select All"), '' ].join('')), $unselectAll = $([ '' ].join('')), $btnContainer = $( diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js index 613b766aa..8252b5cd3 100644 --- a/web/pgadmin/browser/templates/browser/js/browser.js +++ b/web/pgadmin/browser/templates/browser/js/browser.js @@ -1,17 +1,16 @@ -define('pgadmin.browser', - ['require', 'jquery', 'underscore', 'underscore.string', 'bootstrap', - 'pgadmin', 'alertify', 'codemirror', 'sources/check_node_visibility', - 'codemirror/mode/sql/sql', 'wcdocker', - 'jquery.contextmenu', 'jquery.aciplugin', 'jquery.acitree', - 'pgadmin.alertifyjs', 'pgadmin.browser.messages', - 'pgadmin.browser.menu', 'pgadmin.browser.panel', - 'pgadmin.browser.error', 'pgadmin.browser.frame', - 'pgadmin.browser.node', 'pgadmin.browser.collection' - - ], -function( - require, $, _, S, Bootstrap, pgAdmin, Alertify, - CodeMirror, checkNodeVisibility +define( + 'pgadmin.browser', [ + 'sources/gettext', 'require', 'jquery', 'underscore', 'underscore.string', + 'bootstrap', 'pgadmin', 'alertify', 'codemirror', + 'sources/check_node_visibility', 'codemirror/mode/sql/sql', 'wcdocker', + 'jquery.contextmenu', 'jquery.aciplugin', 'jquery.acitree', + 'pgadmin.alertifyjs', 'pgadmin.browser.messages', + 'pgadmin.browser.menu', 'pgadmin.browser.panel', + 'pgadmin.browser.error', 'pgadmin.browser.frame', + 'pgadmin.browser.node', 'pgadmin.browser.collection' + ], function( + gettext, require, $, _, S, Bootstrap, pgAdmin, Alertify, + CodeMirror, checkNodeVisibility ) { // Some scripts do export their object in the window only. @@ -105,7 +104,7 @@ function( // Panel to keep the left hand browser tree 'browser': new pgAdmin.Browser.Panel({ name: 'browser', - title: '{{ _('Browser') }}', + title: gettext('Browser'), showTitle: true, isCloseable: false, isPrivate: true, @@ -115,7 +114,7 @@ function( // Properties of the object node 'properties': new pgAdmin.Browser.Panel({ name: 'properties', - title: '{{ _('Properties') }}', + title: gettext('Properties'), icon: 'fa fa-cogs', width: 500, isCloseable: false, @@ -130,7 +129,7 @@ function( // Statistics of the object 'statistics': new pgAdmin.Browser.Panel({ name: 'statistics', - title: '{{ _('Statistics') }}', + title: gettext('Statistics'), icon: 'fa fa-line-chart', width: 500, isCloseable: false, @@ -141,7 +140,7 @@ function( // Reversed engineered SQL for the object 'sql': new pgAdmin.Browser.Panel({ name: 'sql', - title: '{{ _('SQL') }}', + title: gettext('SQL'), icon: 'fa fa-file-text-o', width: 500, isCloseable: false, @@ -151,7 +150,7 @@ function( // Dependencies of the object 'dependencies': new pgAdmin.Browser.Panel({ name: 'dependencies', - title: '{{ _('Dependencies') }}', + title: gettext('Dependencies'), icon: 'fa fa-hand-o-up', width: 500, isCloseable: false, @@ -162,7 +161,7 @@ function( // Dependents of the object 'dependents': new pgAdmin.Browser.Panel({ name: 'dependents', - title: '{{ _('Dependents') }}', + title: gettext('Dependents'), icon: 'fa fa-hand-o-down', width: 500, isCloseable: false, @@ -454,14 +453,14 @@ function( console.log(err); obj.report_error( - '{{ _('Error initializing script - ') }}' + s.path, err); - } + gettext('Error initializing script - ') + s.path, err); + } } }, function() { console.log("Error loading script - " + s.path); console.log(arguments); obj.report_error( - '{{ _('Error loading script - ') }}' + s.path); + gettext('Error loading script - ') + s.path); }).bind(s); } }); @@ -573,16 +572,14 @@ function( } catch (e) { // Log this exception on console to understand the issue properly. console.log(e); - obj.report_error( - '{{ _('Error loading script - ') }}' + path); + obj.report_error(gettext('Error loading script - ') + path); } if (c) c.loaded += 1; }, function() { // Log the arguments on console to understand the issue properly. console.log(arguments); - obj.report_error( - '{{ _('Error loading script - ') }}' + path); + obj.report_error(gettext('Error loading script - ') + path); }); }, add_menu_category: function( @@ -1675,7 +1672,7 @@ function( } Alertify.pgNotifier( - error, xhr, "{{ _("Error retrieving details for the node.") }}", + error, xhr, gettext("Error retrieving details for the node."), function() { console.log(arguments); } diff --git a/web/pgadmin/browser/templates/browser/js/collection.js b/web/pgadmin/browser/templates/browser/js/collection.js index 5b7f4fb00..cb438f6f1 100644 --- a/web/pgadmin/browser/templates/browser/js/collection.js +++ b/web/pgadmin/browser/templates/browser/js/collection.js @@ -1,9 +1,8 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', - 'backbone', 'alertify', 'backform', 'pgadmin.backform', - 'pgadmin.backgrid', 'pgadmin.browser.node' - ], -function($, _, S, pgAdmin, Backbone, Alertify, Backform) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'backbone', 'alertify', 'backform', 'pgadmin.backform', 'pgadmin.backgrid', + 'pgadmin.browser.node' +], function(gettext, $, _, S, pgAdmin, Backbone, Alertify, Backform) { var pgBrowser = pgAdmin.Browser = pgAdmin.Browser || {}; @@ -33,7 +32,7 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) { pgAdmin.Browser.add_menus([{ name: 'refresh', node: this.type, module: this, applies: ['object', 'context'], callback: 'refresh', - priority: 1, label: '{{ _("Refresh...") }}', + priority: 1, label: gettext('Refresh...'), icon: 'fa fa-refresh' }]); @@ -43,7 +42,7 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) { pgAdmin.Browser.add_menus([{ name: 'show_query_tool', node: this.type, module: this, applies: ['context'], callback: 'show_query_tool', - priority: 998, label: '{{ _("Query Tool...") }}', + priority: 998, label: gettext('Query Tool...'), icon: 'fa fa-bolt' }]); } @@ -125,7 +124,7 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) { Alertify.pgNotifier( error, xhr, S( - "{{ _("Error retrieving properties - %s.") }}" + gettext("Error retrieving properties - %s.") ).sprintf(message || that.label).value(), function() { console.log(arguments); diff --git a/web/pgadmin/browser/templates/browser/js/messages.js b/web/pgadmin/browser/templates/browser/js/messages.js index 06873ce90..ee22b7237 100644 --- a/web/pgadmin/browser/templates/browser/js/messages.js +++ b/web/pgadmin/browser/templates/browser/js/messages.js @@ -1,6 +1,7 @@ -define('pgadmin.browser.messages', - ['underscore', 'underscore.string', 'pgadmin'], -function(_, S, pgAdmin) { +define( + 'pgadmin.browser.messages', + ['sources/gettext', 'underscore', 'underscore.string', 'pgadmin'], + function(gettext, S, _, pgAdmin) { var pgBrowser = pgAdmin.Browser = pgAdmin.Browser || {}; @@ -8,29 +9,29 @@ function(_, S, pgAdmin) { return pgBrowser.messages; var messages = pgBrowser.messages = { - 'SERVER_LOST': '{{ _('Connection to the server has been lost.') }}', - 'CLICK_FOR_DETAILED_MSG': '{{ _('Click here for details.')|safe }}', - 'GENERAL_CATEGORY': '{{ _("General")|safe }}', - 'SQL_TAB': '{{ _('SQL') }}', - 'SQL_INCOMPLETE': '{{ _('Definition incomplete') }}', - 'SQL_NO_CHANGE': '{{ _('Nothing changed')|safe }}', - 'MUST_BE_INT' : "{{ _("'%s' must be an integer.") }}", - 'MUST_BE_NUM' : "{{ _("'%s' must be a numeric.") }}", - 'MUST_GR_EQ' : "{{ _("'%s' must be greater than or equal to %d.")|safe }}", - 'MUST_LESS_EQ' : "{{ _("'%s' must be less than or equal to %d.")|safe }}", - 'STATISTICS_LABEL': "{{ _("Statistics") }}", - 'STATISTICS_VALUE_LABEL': "{{ _("Value") }}", - 'NODE_HAS_NO_SQL': "{{ _("No SQL could be generated for the selected object.") }}", - 'NODE_HAS_NO_STATISTICS': "{{ _("No statistics are available for the selected object.") }}", - 'TRUE': "{{ _("True") }}", - 'FALSE': "{{ _("False") }}", - 'NOTE_CTRL_LABEL': "{{ _("Note") }}", - 'ERR_RETRIEVAL_INFO': "{{ _("Error retrieving the information - %s") }}", - 'CONNECTION_LOST': "{{ _("Connection to the server has been lost.") }}", - 'SELECT_ALL': "{{ _("Select All") }}", - 'UNSELECT_ALL': "{{ _("Unselect All") }}", - 'LOADING_MESSAGE': "{{ _("Retrieving data from the server...") }}", - 'LOADING_FAILED': "{{ _("Failed to retrieve data from the server.") }}" + 'SERVER_LOST': gettext('Connection to the server has been lost.'), + 'CLICK_FOR_DETAILED_MSG': gettext('Click here for details.'), + 'GENERAL_CATEGORY': gettext('General'), + 'SQL_TAB': gettext('SQL'), + 'SQL_INCOMPLETE': gettext('Definition incomplete'), + 'SQL_NO_CHANGE': gettext('Nothing changed'), + 'MUST_BE_INT' : gettext("'%s' must be an integer."), + 'MUST_BE_NUM' : gettext("'%s' must be a numeric."), + 'MUST_GR_EQ' : gettext("%s' must be greater than or equal to %d."), + 'MUST_LESS_EQ' : gettext("'%s' must be less than or equal to %d."), + 'STATISTICS_LABEL': gettext("Statistics"), + 'STATISTICS_VALUE_LABEL': gettext("Value"), + 'NODE_HAS_NO_SQL': gettext("No SQL could be generated for the selected object."), + 'NODE_HAS_NO_STATISTICS': gettext("No statistics are available for the selected object."), + 'TRUE': gettext("True"), + 'FALSE': gettext("False"), + 'NOTE_CTRL_LABEL': gettext("Note"), + 'ERR_RETRIEVAL_INFO': gettext("Error retrieving the information - %s"), + 'CONNECTION_LOST': gettext("Connection to the server has been lost."), + 'SELECT_ALL': gettext("Select All"), + 'UNSELECT_ALL': gettext("Unselect All"), + 'LOADING_MESSAGE': gettext("Retrieving data from the server..."), + 'LOADING_FAILED': gettext("Failed to retrieve data from the server.") }; {% for key in current_app.messages.keys() %} diff --git a/web/pgadmin/browser/templates/browser/js/node.js b/web/pgadmin/browser/templates/browser/js/node.js index ff8bc09fe..416691185 100644 --- a/web/pgadmin/browser/templates/browser/js/node.js +++ b/web/pgadmin/browser/templates/browser/js/node.js @@ -1,8 +1,8 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'pgadmin', 'pgadmin.browser.menu', - 'backbone', 'alertify', 'pgadmin.browser.datamodel', 'backform', - 'pgadmin.backform', 'wcdocker', 'pgadmin.alertifyjs'], -function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'pgadmin', + 'pgadmin.browser.menu', 'backbone', 'alertify', 'pgadmin.browser.datamodel', + 'backform', 'pgadmin.backform', 'wcdocker', 'pgadmin.alertifyjs' +], function(gettext, $, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { var wcDocker = window.wcDocker; @@ -83,7 +83,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { pgAdmin.Browser.add_menus([{ name: 'refresh', node: self.type, module: self, applies: ['object', 'context'], callback: 'refresh', - priority: 1, label: '{{ _("Refresh...") }}', + priority: 1, label: gettext('Refresh...'), icon: 'fa fa-refresh' }]); @@ -91,7 +91,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { pgAdmin.Browser.add_menus([{ name: 'show_obj_properties', node: self.type, module: self, applies: ['object', 'context'], callback: 'show_obj_properties', - priority: 999, label: '{{ _("Properties...") }}', + priority: 999, label: gettext('Properties...'), data: {'action': 'edit'}, icon: 'fa fa-pencil-square-o' }]); } @@ -100,7 +100,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { pgAdmin.Browser.add_menus([{ name: 'delete_object', node: self.type, module: self, applies: ['object', 'context'], callback: 'delete_obj', - priority: 2, label: '{{ _("Delete/Drop") }}', + priority: 2, label: gettext('Delete/Drop'), data: {'url': 'drop'}, icon: 'fa fa-trash', enable: _.isFunction(self.canDrop) ? function() { @@ -111,7 +111,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { pgAdmin.Browser.add_menus([{ name: 'delete_object_cascade', node: self.type, module: self, applies: ['object', 'context'], callback: 'delete_obj', - priority: 3, label: '{{ _("Drop Cascade") }}', + priority: 3, label: gettext('Drop Cascade'), data: {'url': 'delete'}, icon: 'fa fa-trash', enable: _.isFunction(self.canDropCascade) ? function() { return self.canDropCascade.apply(self, arguments); } : (!!self.canDropCascade) @@ -125,7 +125,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { pgAdmin.Browser.add_menus([{ name: 'show_query_tool', node: self.type, module: self, applies: ['context'], callback: 'show_query_tool', - priority: 998, label: '{{ _("Query Tool...") }}', + priority: 998, label: gettext('Query Tool...'), icon: 'fa fa-bolt', enable: function(itemData, item, data) { if (itemData._type == 'database' && itemData.allowConn) @@ -297,7 +297,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { if (!newModel.isNew()) { // This is definetely not in create mode var msgDiv = '
'+ - pgBrowser.messages['LOADING_MESSAGE']+'
', + gettext("Retrieving data from the server...") + '', $msgDiv = $(msgDiv); var timer = setTimeout(function(ctx) { // notify user if request is taking longer than 1 second @@ -337,7 +337,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { Alertify.pgNotifier( error, xhr, S( - "{{ _("Error retrieving properties - %s") }}" + gettext("Error retrieving properties - %s") ).sprintf(message || _label).value(), function() { console.log(arguments); @@ -527,7 +527,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { if (!d) return; - l = S('{{ _("Create - %s") }}').sprintf( + l = S( gettext('Create - %s')).sprintf( [this.label]).value(); p = addPanel(); @@ -544,13 +544,13 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { **/ var mode = p.$container.attr('action-mode'); if (mode) { - var msg = '{{ _('Are you sure want to stop editing the properties of %s "%s"?') }}'; + var msg = gettext('Are you sure want to stop editing the properties of %s "%s"?'); if (args.action == 'edit') { - msg = '{{ _('Are you sure want to reset the current changes and re-open the panel for %s "%s"?') }}'; + msg = gettext('Are you sure want to reset the current changes and re-open the panel for %s "%s"?'); } Alertify.confirm( - '{{ _('Edit in progress?') }}', + gettext('Edit in progress?'), S(msg).sprintf(o.label.toLowerCase(), d.label).value(), function() { setTimeout(function() { @@ -599,9 +599,9 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { var msg, title; if (input.url == 'delete') { - msg = S('{{ _('Are you sure you want to drop %s "%s" and all the objects that depend on it?') }}') + msg = S( gettext('Are you sure you want to drop %s "%s" and all the objects that depend on it?')) .sprintf(obj.label.toLowerCase(), d.label).value(); - title = S('{{ _('DROP CASCADE %s?') }}').sprintf(obj.label).value(); + title = S( gettext('DROP CASCADE %s?')).sprintf(obj.label).value(); if (!(_.isFunction(obj.canDropCascade) ? obj.canDropCascade.apply(obj, [d, i]) : obj.canDropCascade)) { @@ -614,9 +614,9 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { return; } } else { - msg = S('{{ _('Are you sure you want to drop %s "%s"?') }}') + msg = S( gettext('Are you sure you want to drop %s "%s"?')) .sprintf(obj.label.toLowerCase(), d.label).value(); - title = S('{{ _('DROP %s?') }}').sprintf(obj.label).value(); + title = S( gettext('DROP %s?')).sprintf(obj.label).value(); if (!(_.isFunction(obj.canDrop) ? obj.canDrop.apply(obj, [d, i]) : obj.canDrop)) { @@ -662,7 +662,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { } catch (e) {} } pgBrowser.report_error( - S('{{ _('Error dropping %s: "%s"') }}') + S( gettext('Error dropping %s: "%s"')) .sprintf(obj.label, objName) .value(), msg); } @@ -979,7 +979,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { buttons.push({ label: '', type: 'edit', - tooltip: '{{ _("Edit") }}', + tooltip: gettext('Edit'), extraClasses: ['btn-default'], icon: 'fa fa-lg fa-pencil-square-o', disabled: !that.canEdit, @@ -992,7 +992,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { buttons.push({ label: '', type: 'help', - tooltip: '{{ _("SQL help for this object type.") }}', + tooltip: gettext('SQL help for this object type.'), extraClasses: ['btn-default', 'pull-right'], icon: 'fa fa-lg fa-info', disabled: (that.sqlAlterHelp == '' && that.sqlCreateHelp == '') ? true : false, @@ -1136,7 +1136,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { // Create proper buttons createButtons([{ label: '', type: 'help', - tooltip: '{{ _("SQL help for this object type.") }}', + tooltip: gettext('SQL help for this object type.'), extraClasses: ['btn-default', 'pull-left'], icon: 'fa fa-lg fa-info', disabled: (that.sqlAlterHelp == '' && that.sqlCreateHelp == '') ? true : false, @@ -1147,7 +1147,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { } },{ label: '', type: 'help', - tooltip: '{{ _("Help for this dialog.") }}', + tooltip: gettext('Help for this dialog.'), extraClasses: ['btn-default', 'pull-left'], icon: 'fa fa-lg fa-question', disabled: (that.dialogHelp == '') ? true : false, @@ -1157,8 +1157,8 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { }); } },{ - label: '{{ _("Save") }}', type: 'save', - tooltip: '{{ _("Save this object.") }}', + label: gettext('Save'), type: 'save', + tooltip: gettext('Save this object.'), extraClasses: ['btn-primary'], icon: 'fa fa-lg fa-save', disabled: true, @@ -1207,7 +1207,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { Alertify.pgNotifier( "error", jqxhr, S( - "{{ _("Error saving properties: %s") }}" + gettext("Error saving properties: %s") ).sprintf(jqxhr.statusText).value() ); @@ -1220,8 +1220,8 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { }); } },{ - label: '{{ _('Cancel') }}', type: 'cancel', - tooltip: '{{ _("Cancel changes to this object.") }}', + label: gettext('Cancel'), type: 'cancel', + tooltip: gettext('Cancel changes to this object.'), extraClasses: ['btn-danger'], icon: 'fa fa-lg fa-close', disabled: false, @@ -1233,8 +1233,8 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { }); } },{ - label: '{{ _('Reset') }}', type: 'reset', - tooltip: '{{ _("Reset the fields on this dialog.") }}', + label: gettext('Reset'), type: 'reset', + tooltip: gettext('Reset the fields on this dialog.'), extraClasses: ['btn-warning'], icon: 'fa fa-lg fa-recycle', disabled: true, diff --git a/web/pgadmin/misc/bgprocess/__init__.py b/web/pgadmin/misc/bgprocess/__init__.py index 80dbcfbed..234490aaf 100644 --- a/web/pgadmin/misc/bgprocess/__init__.py +++ b/web/pgadmin/misc/bgprocess/__init__.py @@ -46,16 +46,7 @@ class BGProcessModule(PgAdminModule): dict: the i18n messages used by this module """ return { - 'bgprocess.index': url_for("bgprocess.index"), - 'seconds': _('seconds'), - 'started': _('Started'), - 'START_TIME': _('Start time'), - 'STATUS': _('Status'), - 'EXECUTION_TIME': _('Execution time'), - 'running': _('Running...'), - 'successfully_finished': _("Successfully completed."), - 'failed_with_exit_code': _("Failed (exit code: %s)."), - 'BG_TOO_MANY_LOGS': _("Too many logs generated!") + 'bgprocess.index': url_for("bgprocess.index") } diff --git a/web/pgadmin/misc/bgprocess/static/js/bgprocess.js b/web/pgadmin/misc/bgprocess/static/js/bgprocess.js index f88aa2926..ae02cb748 100644 --- a/web/pgadmin/misc/bgprocess/static/js/bgprocess.js +++ b/web/pgadmin/misc/bgprocess/static/js/bgprocess.js @@ -1,7 +1,7 @@ define([ - 'pgadmin', 'underscore', 'underscore.string', 'jquery', 'pgadmin.browser', + 'pgadmin', 'sources/gettext', 'underscore', 'underscore.string', 'jquery', 'pgadmin.browser', 'alertify', 'pgadmin.browser.messages' -], function(pgAdmin, _, S, $, pgBrowser, alertify, pgMessages) { +], function(pgAdmin, gettext, _, S, $, pgBrowser, alertify, pgMessages) { pgBrowser.BackgroundProcessObsorver = pgBrowser.BackgroundProcessObsorver || {}; @@ -155,18 +155,18 @@ define([ } if (self.stime) { - self.curr_status = pgMessages['started']; + self.curr_status = gettext('Started'); if (self.execution_time >= 2) { - self.curr_status = pgMessages['running']; + self.curr_status = gettext['Running...']; } if (!_.isNull(self.exit_code)) { if (self.exit_code == 0) { - self.curr_status = pgMessages['successfully_finished']; + self.curr_status = gettext('Successfully completed.'); } else { self.curr_status = S( - pgMessages['failed_with_exit_code'] + gettext("Failed (exit code: %s).") ).sprintf(String(self.exit_code)).value(); } } @@ -240,7 +240,7 @@ define([ for_details = $('
', { class: "col-xs-12 text-center pg-bg-click h6" }).append( - $('').text(pgMessages.CLICK_FOR_DETAILED_MSG) + $('').text(gettext('Click here for details.')) ).appendTo(content), status = $('
', { class: "pg-bg-status col-xs-12 h5 " + ((self.exit_code === 0) ? @@ -290,7 +290,7 @@ define([ String(self.execution_time) ) ).append( - $('').text(' ' + pgMessages['seconds']) + $('').text(' ' + gettext('seconds')) ); self.container.find('.pg-bg-status').empty().append( self.curr_status @@ -348,7 +348,7 @@ define([ String(self.execution_time) ) ).append( - $('').text(' ' + pgMessages['seconds']) + $('').text(' ' + gettext('seconds')) ); if (is_new) { @@ -499,7 +499,7 @@ define([ content: '
'+ '

'+ '
'+ - '' + pgMessages['START_TIME'] + ': '+ + '' + gettext('Start time') + ': '+ ''+ '
'+ '
'+ @@ -507,11 +507,11 @@ define([ ''+ '', diff --git a/web/pgadmin/misc/depends/static/js/depends.js b/web/pgadmin/misc/depends/static/js/depends.js index 1de9c6e27..b4319f11f 100644 --- a/web/pgadmin/misc/depends/static/js/depends.js +++ b/web/pgadmin/misc/depends/static/js/depends.js @@ -1,7 +1,7 @@ define([ - 'underscore', 'underscore.string', 'jquery', 'pgadmin.browser', - 'alertify', 'pgadmin.alertifyjs', 'pgadmin.browser.messages', -], function(_, S, $, pgBrowser, Alertify) { + 'sources/gettext', 'underscore', 'underscore.string', 'jquery', 'pgadmin.browser', + 'alertify', 'pgadmin.alertifyjs' +], function(gettext, _, S, $, pgBrowser, Alertify) { if (pgBrowser.ShowNodeDepends) return pgBrowser.ShowNodeDepends; @@ -241,7 +241,7 @@ define([ var timer = setTimeout(function(){ // notify user if request is taking longer than 1 second - $msgContainer.text(pgBrowser.messages['LOADING_MESSAGE']); + $msgContainer.text(gettext("Retrieving data from the server...")); $msgContainer.removeClass('hidden'); if ($gridContainer) { $gridContainer.addClass('hidden'); @@ -272,7 +272,7 @@ define([ Alertify.pgNotifier( error, xhr, S( - pgBrowser.messages['ERR_RETRIEVAL_INFO'] + gettext("Error retrieving the information - %s") ).sprintf(message || _label).value(), function() { console.log(arguments); @@ -280,7 +280,7 @@ define([ ); } // show failed message. - $msgContainer.text(pgBrowser.messages['LOADING_FAILED']); + $msgContainer.text(gettext("Failed to retrieve data from the server.")); } }); } diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js b/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js index 7c30df37c..aaee47877 100644 --- a/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js +++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/file_manager.js @@ -1,8 +1,7 @@ +// This defines File Manager dialog define([ - 'jquery', 'underscore', 'alertify'], - - // This defines File Manager dialog - function($, _, alertify) { + 'sources/gettext', 'jquery', 'underscore', 'alertify' +], function(gettext, $, _, alertify) { pgAdmin = pgAdmin || window.pgAdmin || {}; /* @@ -133,10 +132,10 @@ define([ return { buttons:[ { - text: "{{ _('Select') }}", className: "btn btn-primary fa fa-file file_manager_ok pg-alertify-button disabled" + text: gettext("Select"), className: "btn btn-primary fa fa-file file_manager_ok pg-alertify-button disabled" }, { - text: "{{ _('Cancel') }}", className: "btn btn-danger fa fa-times pg-alertify-button" + text: gettext("Cancel"), className: "btn btn-danger fa fa-times pg-alertify-button" } ], focus: { element: 0 }, @@ -147,7 +146,7 @@ define([ }; }, callback: function(closeEvent) { - if (closeEvent.button.text == "{{ _('Select') }}") { + if (closeEvent.button.text == gettext("Select")) { var newFile = $('.storage_dialog #uploader .input-path').val(), file_data = {'path': $('.currentpath').val()}; @@ -158,7 +157,7 @@ define([ $(innerbody).find('*').off(); innerbody.remove(); removeTransId(trans_id); - } else if (closeEvent.button.text == "{{ _('Cancel') }}") { + } else if (closeEvent.button.text == gettext("Cancel")) { var innerbody = $(this.elements.body).find('.storage_content') $(innerbody).find('*').off(); innerbody.remove(); @@ -255,10 +254,10 @@ define([ return { buttons:[ { - text: "{{ _('Select') }}", className: "btn btn-primary fa fa-file file_manager_ok pg-alertify-button disabled" + text: gettext("Select"), className: "btn btn-primary fa fa-file file_manager_ok pg-alertify-button disabled" }, { - text: "{{ _('Cancel') }}", key: 27, className: "btn btn-danger fa fa-times pg-alertify-button" + text: gettext("Cancel"), key: 27, className: "btn btn-danger fa fa-times pg-alertify-button" } ], focus: { element: 0 }, @@ -271,7 +270,7 @@ define([ }; }, callback: function(closeEvent) { - if (closeEvent.button.text == "{{ _('Select') }}") { + if (closeEvent.button.text == gettext("Select")) { var newFile = $('.storage_dialog #uploader .input-path').val(), file_data = {'path': $('.currentpath').val()}; @@ -283,7 +282,7 @@ define([ // Ajax call to store the last directory visited once user press select button set_last_traversed_dir(file_data, trans_id); - } else if (closeEvent.button.text == "{{ _('Cancel') }}") { + } else if (closeEvent.button.text == gettext("Cancel")) { var innerbody = $(this.elements.body).find('.storage_content') $(innerbody).find('*').off(); innerbody.remove(); @@ -380,10 +379,10 @@ define([ return { buttons:[ { - text: "{{ _('Select') }}", className: "btn btn-primary fa fa-file file_manager_ok pg-alertify-button disabled" + text: gettext("Select"), className: "btn btn-primary fa fa-file file_manager_ok pg-alertify-button disabled" }, { - text: "{{ _('Cancel') }}", key: 27, className: "btn btn-danger fa fa-times pg-alertify-button" + text: gettext("Cancel"), key: 27, className: "btn btn-danger fa fa-times pg-alertify-button" } ], focus: { element: 0 }, @@ -396,7 +395,7 @@ define([ }; }, callback: function(closeEvent) { - if (closeEvent.button.text == "{{ _('Select') }}") { + if (closeEvent.button.text == gettext("Select")) { var newFile = $('.storage_dialog #uploader .input-path').val(), file_data = {'path': $('.currentpath').val()}; pgAdmin.Browser.Events.trigger('pgadmin-storage:finish_btn:select_folder', newFile); @@ -406,7 +405,7 @@ define([ removeTransId(trans_id); // Ajax call to store the last directory visited once user press select button set_last_traversed_dir(file_data, trans_id); - } else if (closeEvent.button.text == "{{ _('Cancel') }}") { + } else if (closeEvent.button.text == gettext("Cancel")) { var innerbody = $(this.elements.body).find('.storage_content') $(innerbody).find('*').off(); innerbody.remove(); @@ -503,10 +502,10 @@ define([ return { buttons:[ { - text: "{{ _('Create') }}", className: "btn btn-primary fa fa-file file_manager_create file_manager_ok pg-alertify-button disabled" + text: gettext("Create"), className: "btn btn-primary fa fa-file file_manager_create file_manager_ok pg-alertify-button disabled" }, { - text: "{{ _('Cancel') }}", key: 27, className: "btn btn-danger fa fa-times file_manager_create_cancel pg-alertify-button" + text: gettext("Cancel"), key: 27, className: "btn btn-danger fa fa-times file_manager_create_cancel pg-alertify-button" } ], focus: { element: 0 }, @@ -601,13 +600,13 @@ define([ }, error: function() { $('.file_manager_ok').addClass('disabled'); - alertify.error('{{ _('Error occurred while checking access permission.') }}'); + alertify.error( gettext('Error occurred while checking access permission.')); } }); return permission; }, callback: function(closeEvent) { - if (closeEvent.button.text == "{{ _('Create') }}") { + if (closeEvent.button.text == gettext("Create")) { var newFile = $('.storage_dialog #uploader .input-path').val(), file_data = {'path': $('.currentpath').val()}; @@ -628,7 +627,7 @@ define([ } set_last_traversed_dir(file_data, trans_id); - } else if (closeEvent.button.text == "{{ _('Cancel') }}") { + } else if (closeEvent.button.text == gettext("Cancel")) { var innerbody = $(this.elements.body).find('.storage_content') $(innerbody).find('*').off(); innerbody.remove(); diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js index 2fb0c52b7..ea56b10c1 100755 --- a/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js +++ b/web/pgadmin/misc/file_manager/templates/file_manager/js/utility.js @@ -15,7 +15,8 @@ // use alertify and underscore js var alertify = require("alertify"), _ = require("underscore"), - S = require("underscore.string"); + S = require("underscore.string") + gettext = require("sources/gettext"); /*--------------------------------------------------------- Define functions used for various operations @@ -632,7 +633,7 @@ var checkPermission = function(path) { }, error: function() { $('.file_manager_ok').addClass('disabled'); - alertify.error('{{ _('Error occurred while checking access permission.') }}'); + alertify.error( gettext('Error occurred while checking access permission.')); } }); return permission; @@ -1276,16 +1277,16 @@ if ( have_all_types = (have_all_types || (t == '*')); } else { select_box += '"; + (t == '*' ? gettext('All Files') : t) + ""; have_all_types = (have_all_types || (t == '*')); } i++; } if (!have_all_types) { - select_box += ''; + select_box += ''; } - select_box += ""; + select_box += ""; } $(".allowed_file_types").html(select_box); diff --git a/web/pgadmin/misc/sql/static/js/sql.js b/web/pgadmin/misc/sql/static/js/sql.js index 3683a00df..8402fa21b 100644 --- a/web/pgadmin/misc/sql/static/js/sql.js +++ b/web/pgadmin/misc/sql/static/js/sql.js @@ -1,7 +1,7 @@ define([ - 'underscore', 'underscore.string', 'jquery', 'pgadmin.browser', - 'alertify', 'pgadmin.alertifyjs', 'pgadmin.browser.messages', -], function(_, S, $, pgBrowser, Alertify) { + 'sources/gettext', 'underscore', 'underscore.string', 'jquery', 'pgadmin.browser', + 'alertify', 'pgadmin.alertifyjs' +], function(gettext, _, S, $, pgBrowser, Alertify) { pgBrowser.ShowNodeSQL = pgBrowser.ShowNodeSQL || {}; @@ -68,7 +68,7 @@ define([ function() { var sql = ''; if (node) { - sql = '-- ' + pgBrowser.messages.NODE_HAS_NO_SQL; + sql = '-- ' + gettext("No SQL could be generated for the selected object."); var self = this, n_type = data._type, n_value = -1, @@ -95,7 +95,9 @@ define([ timer = setTimeout(function(){ // notify user if request is taking longer than 1 second - pgAdmin.Browser.editor.setValue(pgBrowser.messages['LOADING_MESSAGE']); + pgAdmin.Browser.editor.setValue( + gettext("Retrieving data from the server...") + ); }, 1000); }, success: function(res) { @@ -116,9 +118,9 @@ define([ ) { Alertify.pgNotifier( error, xhr, - S( - pgBrowser.messages['ERR_RETRIEVAL_INFO'] - ).sprintf(message || _label).value(), + S(gettext("Error retrieving the information - %s")).sprintf( + message || _label + ).value(), function() { console.log(arguments); } diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js index cc78d6dbb..1377c1eb7 100644 --- a/web/pgadmin/misc/statistics/static/js/statistics.js +++ b/web/pgadmin/misc/statistics/static/js/statistics.js @@ -1,7 +1,7 @@ define([ - 'underscore', 'underscore.string', 'jquery', 'pgadmin.browser', 'backgrid', + 'sources/gettext', 'underscore', 'underscore.string', 'jquery', 'pgadmin.browser', 'backgrid', 'alertify', 'sources/size_prettify' -], function(_, S, $, pgBrowser, Backgrid, Alertify, sizePrettify) { +], function(gettext, _, S, $, pgBrowser, Backgrid, Alertify, sizePrettify) { if (pgBrowser.NodeStatistics) return pgBrowser.NodeStatistics; @@ -78,8 +78,8 @@ define([ _.extend( PGBooleanCell.prototype.defaults.options, { - onText: pgBrowser.messages.TRUE, - offText: pgBrowser.messages.FALSE, + onText: gettext('True'), + offText: gettext('False'), onColor: 'success', offColor: 'primary', size: 'mini' @@ -104,14 +104,14 @@ define([ statistic_columns: [{ editable: false, name: 'statistics', - label: pgBrowser.messages.STATISTICS_LABEL, + label: gettext("Statistics"), cell: 'string', headerCell: Backgrid.Extension.CustomHeaderCell, cellHeaderClasses: 'width_percent_25' },{ editable: false, name: 'value', - label: pgBrowser.messages.STATISTICS_VALUE_LABEL, + label: gettext("Value"), cell: 'string' }], panel: pgBrowser.docker.findPanels('statistics'), @@ -180,7 +180,7 @@ define([ n_type = node_type; if (node) { - msg = pgBrowser.messages.NODE_HAS_NO_STATISTICS; + msg = gettext("No statistics are available for the selected object."); /* We fetch the statistics only for those node who set the parameter * showStatistics function. */ @@ -209,7 +209,7 @@ define([ timer = setTimeout(function(){ // notify user if request is taking longer than 1 second - $msgContainer.text(pgBrowser.messages['LOADING_MESSAGE']); + $msgContainer.text(gettext("Retrieving data from the server...")); $msgContainer.removeClass('hidden'); if (self.grid) { self.grid.remove(); @@ -267,16 +267,16 @@ define([ ) { Alertify.pgNotifier( error, xhr, - S( - pgBrowser.messages['ERR_RETRIEVAL_INFO'] - ).sprintf(message || _label).value(), + S(gettext("Error retrieving the information - %s")).sprintf( + message || _label + ).value(), function() { console.log(arguments); } ); } // show failed message. - $msgContainer.text(pgBrowser.messages['LOADING_FAILED']); + $msgContainer.text(gettext("Failed to retrieve data from the server.")); } }); } diff --git a/web/pgadmin/preferences/templates/preferences/preferences.js b/web/pgadmin/preferences/templates/preferences/preferences.js index 07a21482c..997273c75 100644 --- a/web/pgadmin/preferences/templates/preferences/preferences.js +++ b/web/pgadmin/preferences/templates/preferences/preferences.js @@ -1,9 +1,8 @@ -define( - ['jquery', 'alertify', 'pgadmin', 'underscore', 'backform', 'pgadmin.browser', - 'sources/gettext', 'pgadmin.backform'], - +define([ + 'jquery', 'alertify', 'pgadmin', 'underscore', 'backform', + 'pgadmin.browser', 'sources/gettext', 'pgadmin.backform' +], function($, alertify, pgAdmin, _, Backform, pgBrowser, gettext) { // This defines the Preference/Options Dialog for pgAdmin IV. - function($, alertify, pgAdmin, _, Backform, pgBrowser, gettext) { pgAdmin = pgAdmin || window.pgAdmin || {}; /* @@ -356,7 +355,7 @@ define( return { buttons:[{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question', - attrs:{name:'dialog_help', type:'button', label: '{{ _('Preferences') }}', + attrs:{name:'dialog_help', type:'button', label: gettext('Preferences'), url: '{{ url_for('help.static', filename='preferences.html') }}'} },{ text: gettext('OK'), key: 13, className: "btn btn-primary fa fa-lg fa-save pg-alertify-button" diff --git a/web/pgadmin/static/js/alertify.pgadmin.defaults.js b/web/pgadmin/static/js/alertify.pgadmin.defaults.js index d7e961481..04cee3b08 100644 --- a/web/pgadmin/static/js/alertify.pgadmin.defaults.js +++ b/web/pgadmin/static/js/alertify.pgadmin.defaults.js @@ -1,6 +1,6 @@ require( - ['alertify', 'underscore.string'], -function(alertify, S) { + ['sources/gettext', 'alertify', 'underscore.string'], +function(gettext, alertify, S) { alertify.defaults.transition = "zoom"; alertify.defaults.theme.ok = "btn btn-primary"; alertify.defaults.theme.cancel = "btn btn-danger"; @@ -90,7 +90,7 @@ function(alertify, S) { contentType = xhr.getResponseHeader('Content-Type'); if (xhr.status == 0) { - msg = window.pgAdmin.Browser.messages.SERVER_LOST; + msg = gettext('Connection to the server has been lost.'); } if (contentType) { @@ -108,7 +108,7 @@ function(alertify, S) { alertify.notify( S( '%s

' + - window.pgAdmin.Browser.messages.CLICK_FOR_DETAILED_MSG + gettext('Click here for details.') ).sprintf(promptmsg).value(), type, 0, function() { alertify.pgIframeDialog().show().set({frameless: false}).set( 'pg_msg', msg @@ -210,7 +210,7 @@ function(alertify, S) { ) : ( xhr.status == 428 && jsonResp.errormsg && - jsonResp.errormsg == pgBrowser.messages.CONNECTION_LOST + jsonResp.errormsg == gettext("Connection to the server has been lost.") ) ) ) { diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js index 553676e05..0cc1e2fc1 100644 --- a/web/pgadmin/static/js/backform.pgadmin.js +++ b/web/pgadmin/static/js/backform.pgadmin.js @@ -3,14 +3,14 @@ // Set up Backform appropriately for the environment. Start with AMD. if (typeof define === 'function' && define.amd) { define([ - 'underscore', 'underscore.string', 'jquery', 'backbone', 'backform', - 'backgrid', 'codemirror', 'pgadmin.backgrid', 'codemirror/mode/sql/sql', - 'select2', 'pgadmin.browser.messages' + 'sources/gettext', 'underscore', 'underscore.string', 'jquery', + 'backbone', 'backform', 'backgrid', 'codemirror', 'pgadmin.backgrid', + 'codemirror/mode/sql/sql', 'select2' ], - function(_, S, $, Backbone, Backform, Backgrid, CodeMirror) { + function(gettext, _, S, $, Backbone, Backform, Backgrid, CodeMirror) { // Export global even in AMD case in case this script is loaded with // others that may still expect a global Backform. - return factory(root, _, S, $, Backbone, Backform, Backgrid, CodeMirror); + return factory(root, gettext, _, S, $, Backbone, Backform, Backgrid, CodeMirror); }); // Next for Node.js or CommonJS. jQuery may not be needed as a module. @@ -22,14 +22,15 @@ Backgrid = require('backgrid') || root.Backgrid; CodeMirror = require('codemirror') || root.CodeMirror; pgAdminBackgrid = require('pgadmin.backgrid'); - S = require('underscore.string'); - factory(root, _, S, $, Backbone, Backform, Backgrid, CodeMirror); + S = require('underscore.string'), + gettext = require('sources/gettext'); + factory(root, gettext, _, S, $, Backbone, Backform, Backgrid, CodeMirror); // Finally, as a browser global. } else { - factory(root, root._, root.s, (root.jQuery || root.Zepto || root.ender || root.$), root.Backbone, root.Backform, root.Backgrid, root.CodeMirror); + factory(root, root.gettext, root._, root.s, (root.jQuery || root.Zepto || root.ender || root.$), root.Backbone, root.Backform, root.Backgrid, root.CodeMirror); } -}(this, function(root, _, S, $, Backbone, Backform, Backgrid, CodeMirror) { +}(this, function(root, gettext, _, S, $, Backbone, Backform, Backgrid, CodeMirror) { var pgAdmin = (window.pgAdmin = window.pgAdmin || {}); @@ -1453,11 +1454,11 @@ }); } else { this.sqlCtrl.clearHistory(); - this.sqlCtrl.setValue('-- ' + window.pgAdmin.Browser.messages.SQL_INCOMPLETE); + this.sqlCtrl.setValue('-- ' + gettext('Definition incomplete')); } } else { this.sqlCtrl.clearHistory(); - this.sqlCtrl.setValue('-- ' + window.pgAdmin.Browser.messages.SQL_NO_CHANGE); + this.sqlCtrl.setValue('-- ' + gettext('Nothing changed')); } this.sqlCtrl.refresh.apply(this.sqlCtrl); } @@ -1536,7 +1537,7 @@ this.model.errorModel.unset(name); this.model.errorModel.set( name, - S(pgAdmin.Browser.messages.MUST_BE_INT).sprintf( + S(gettext("'%s' must be an integer.")).sprintf( field.label ).value() ); @@ -1548,7 +1549,7 @@ this.model.errorModel.unset(name); this.model.errorModel.set( name, - S(pgAdmin.Browser.messages.MUST_GR_EQ).sprintf( + S(gettext("%s' must be greater than or equal to %d.")).sprintf( field.label, min_value ).value() @@ -1560,7 +1561,7 @@ this.model.errorModel.unset(name); this.model.errorModel.set( name, - S(pgAdmin.Browser.messages.MUST_LESS_EQ).sprintf( + S(gettext("'%s' must be less than or equal to %d.")).sprintf( field.label, max_value ).value() @@ -1639,7 +1640,7 @@ this.model.errorModel.unset(name); this.model.errorModel.set( name, - S(pgAdmin.Browser.messages.MUST_BE_NUM).sprintf( + S(gettext("'%s' must be a numeric.")).sprintf( field.label ).value() ); @@ -1651,7 +1652,7 @@ this.model.errorModel.unset(name); this.model.errorModel.set( name, - S(pgAdmin.Browser.messages.MUST_GR_EQ).sprintf( + S(gettext("%s' must be greater than or equal to %d.")).sprintf( field.label, min_value ).value() @@ -1663,7 +1664,7 @@ this.model.errorModel.unset(name); this.model.errorModel.set( name, - S(pgAdmin.Browser.messages.MUST_LESS_EQ).sprintf( + S(gettext("'%s' must be less than or equal to %d.")).sprintf( field.label, max_value ).value() @@ -1753,7 +1754,7 @@ _.indexOf(s.mode, mode) != -1)) { // Each field is kept in specified group, or in // 'General' category. - var group = s.group || pgBrowser.messages.GENERAL_CATEGORY, + var group = s.group || gettext('General'), control = s.control || Backform.getMappedControl(s.type, mode), cell = s.cell || Backform.getMappedControl(s.type, 'cell'); @@ -1826,7 +1827,7 @@ } if (!noSQL && node && node.hasSQL && (mode == 'create' || mode == 'edit')) { - groups[pgBrowser.messages.SQL_TAB] = [{ + groups[gettext('SQL')] = [{ name: 'sql', visible: true, disabled: false, @@ -2269,7 +2270,7 @@ // We will use this control just as a annotate in Backform var NoteControl = Backform.NoteControl = Backform.Control.extend({ defaults: { - label: window.pgAdmin.Browser.messages.NOTE_CTRL_LABEL, + label: gettext("Note"), text: '', extraClasses: [], noteClass: 'backform_control_notes' diff --git a/web/pgadmin/tools/backup/templates/backup/js/backup.js b/web/pgadmin/tools/backup/templates/backup/js/backup.js index 4c742f9f9..a3438cfb8 100644 --- a/web/pgadmin/tools/backup/templates/backup/js/backup.js +++ b/web/pgadmin/tools/backup/templates/backup/js/backup.js @@ -1,15 +1,13 @@ +// Backup dialog define([ - 'jquery', 'underscore', 'underscore.string', 'alertify', - 'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node' - ], + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node' +], function(gettext, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode) { - // This defines Backup dialog - function($, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode) { - - // if module is already initialized, refer to that. - if (pgBrowser.Backup) { - return pgBrowser.Backup; - } + // if module is already initialized, refer to that. + if (pgBrowser.Backup) { + return pgBrowser.Backup; + } /* ===================== @@ -59,33 +57,33 @@ TODO LIST FOR BACKUP: type: undefined /* global, server */ }, schema: [{ - id: 'file', label: '{{ _('Filename') }}', + id: 'file', label: gettext('Filename'), type: 'text', disabled: false, control: Backform.FileControl, dialog_type: 'create_file', supp_types: ['*', 'sql', 'backup'] },{ - id: 'role', label: '{{ _('Role name') }}', + id: 'role', label: gettext('Role name'), control: 'node-list-by-name', node: 'role', select2: { allowClear: false } },{ - type: 'nested', control: 'fieldset', label: '{{ _('Miscellaneous') }}', + type: 'nested', control: 'fieldset', label: gettext('Miscellaneous'), schema:[{ - id: 'verbose', label: '{{ _('Verbose messages') }}', + id: 'verbose', label: gettext('Verbose messages'), control: Backform.CustomSwitchControl, disabled: false, - group: '{{ _('Miscellaneous') }}' + group: gettext('Miscellaneous') },{ - id: 'dqoute', label: '{{ _('Force double quote on identifiers') }}', + id: 'dqoute', label: gettext('Force double quote on identifiers'), control: Backform.CustomSwitchControl, disabled: false, - group: '{{ _('Miscellaneous') }}' + group: gettext('Miscellaneous') }] },{ - id: 'server_note', label: '{{ _('Note') }}', - text: '{{ _('The backup format will be PLAIN') }}', + id: 'server_note', label: gettext('Note'), + text: gettext('The backup format will be PLAIN'), type: 'note', visible: function(m){ return m.get('type') === 'server'; } },{ - id: 'globals_note', label: '{{ _('Note') }}', - text: '{{ _('Only objects global to the entire database will be backed up in PLAIN format') }}', + id: 'globals_note', label: gettext('Note'), + text: gettext('Only objects global to the entire database will be backed up in PLAIN format'), type: 'note', visible: function(m){ return m.get('type') === 'globals'; } @@ -112,69 +110,69 @@ TODO LIST FOR BACKUP: database: undefined }, schema: [{ - id: 'file', label: '{{ _('Filename') }}', + id: 'file', label: gettext('Filename'), type: 'text', disabled: false, control: Backform.FileControl, dialog_type: 'create_file', supp_types: ['*', 'sql', 'backup'] },{ - id: 'format', label: '{{ _('Format') }}', + id: 'format', label: gettext('Format'), type: 'text', disabled: false, control: 'select2', select2: { allowClear: false, width: "100%" }, options: [ - {label: '{{ _('Custom') }}', value: "custom"}, - {label: '{{ _('Tar') }}', value: "tar"}, - {label: '{{ _('Plain') }}', value: "plain"}, - {label: '{{ _('Directory') }}', value: "directory"} + {label: gettext('Custom'), value: "custom"}, + {label: gettext('Tar'), value: "tar"}, + {label: gettext('Plain'), value: "plain"}, + {label: gettext('Directory'), value: "directory"} ] },{ - id: 'ratio', label: '{{ _('Compression ratio') }}', + id: 'ratio', label: gettext('Compression ratio'), type: 'int', min: 0, max:9, disabled: false },{ - id: 'encoding', label: '{{ _('Encoding') }}', + id: 'encoding', label: gettext('Encoding'), type: 'text', disabled: false, node: 'database', control: 'node-ajax-options', url: 'get_encodings' },{ - id: 'no_of_jobs', label: '{{ _('Number of jobs') }}', + id: 'no_of_jobs', label: gettext('Number of jobs'), type: 'int', deps: ['format'], disabled: function(m) { return !(m.get('format') === "Directory"); } },{ - id: 'role', label: '{{ _('Role name') }}', + id: 'role', label: gettext('Role name'), control: 'node-list-by-name', node: 'role', select2: { allowClear: false } },{ - type: 'nested', control: 'fieldset', label: '{{ _('Sections') }}', - group: '{{ _('Dump options') }}', + type: 'nested', control: 'fieldset', label: gettext('Sections'), + group: gettext('Dump options'), schema:[{ - id: 'pre_data', label: '{{ _('Pre-data') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}', + id: 'pre_data', label: gettext('Pre-data'), + control: Backform.CustomSwitchControl, group: gettext('Sections'), deps: ['only_data', 'only_schema'], disabled: function(m) { return m.get('only_data') || m.get('only_schema'); } },{ - id: 'data', label: '{{ _('Data') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}', + id: 'data', label: gettext('Data'), + control: Backform.CustomSwitchControl, group: gettext('Sections'), deps: ['only_data', 'only_schema'], disabled: function(m) { return m.get('only_data') || m.get('only_schema'); } },{ - id: 'post_data', label: '{{ _('Post-data') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}', + id: 'post_data', label: gettext('Post-data'), + control: Backform.CustomSwitchControl, group: gettext('Sections'), deps: ['only_data', 'only_schema'], disabled: function(m) { return m.get('only_data') || m.get('only_schema'); } }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Type of objects') }}', - group: '{{ _('Dump options') }}', + type: 'nested', control: 'fieldset', label: gettext('Type of objects'), + group: gettext('Dump options'), schema:[{ - id: 'only_data', label: '{{ _('Only data') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Type of objects') }}', + id: 'only_data', label: gettext('Only data'), + control: Backform.CustomSwitchControl, group: gettext('Type of objects'), deps: ['pre_data', 'data', 'post_data','only_schema'], disabled: function(m) { return m.get('pre_data') || m.get('data') @@ -182,8 +180,8 @@ TODO LIST FOR BACKUP: || m.get('only_schema'); } },{ - id: 'only_schema', label: '{{ _('Only schema') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Type of objects') }}', + id: 'only_schema', label: gettext('Only schema'), + control: Backform.CustomSwitchControl, group: gettext('Type of objects'), deps: ['pre_data', 'data', 'post_data', 'only_data'], disabled: function(m) { return m.get('pre_data') || m.get('data') @@ -191,69 +189,69 @@ TODO LIST FOR BACKUP: || m.get('only_data'); } },{ - id: 'blobs', label: '{{ _('Blobs') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Type of objects') }}' + id: 'blobs', label: gettext('Blobs'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Type of objects') }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Do not save') }}', - group: '{{ _('Dump options') }}', + type: 'nested', control: 'fieldset', label: gettext('Do not save'), + group: gettext('Dump options'), schema:[{ - id: 'dns_owner', label: '{{ _('Owner') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}' + id: 'dns_owner', label: gettext('Owner'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save') },{ - id: 'dns_privilege', label: '{{ _('Privilege') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}' + id: 'dns_privilege', label: gettext('Privilege'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save') },{ - id: 'dns_tablespace', label: '{{ _('Tablespace') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}' + id: 'dns_tablespace', label: gettext('Tablespace'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save') },{ - id: 'dns_unlogged_tbl_data', label: '{{ _('Unlogged table data') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}' + id: 'dns_unlogged_tbl_data', label: gettext('Unlogged table data'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save') }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Queries') }}', - group: '{{ _('Dump options') }}', + type: 'nested', control: 'fieldset', label: gettext('Queries'), + group: gettext('Dump options'), schema:[{ - id: 'use_column_inserts', label: '{{ _('Use Column Inserts') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}' + id: 'use_column_inserts', label: gettext('Use Column Inserts'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries') },{ - id: 'use_insert_commands', label: '{{ _('Use Insert Commands') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}' + id: 'use_insert_commands', label: gettext('Use Insert Commands'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries') },{ - id: 'include_create_database', label: '{{ _('Include CREATE DATABASE statement') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}' + id: 'include_create_database', label: gettext('Include CREATE DATABASE statement'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries') },{ - id: 'include_drop_database', label: '{{ _('Include DROP DATABASE statement') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}' + id: 'include_drop_database', label: gettext('Include DROP DATABASE statement'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries') }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Disable') }}', - group: '{{ _('Dump options') }}', + type: 'nested', control: 'fieldset', label: gettext('Disable'), + group: gettext('Dump options'), schema:[{ - id: 'disable_trigger', label: '{{ _('Trigger') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Disable') }}', + id: 'disable_trigger', label: gettext('Trigger'), + control: Backform.CustomSwitchControl, group: gettext('Disable'), deps: ['only_data'], disabled: function(m) { return !(m.get('only_data')); } },{ - id: 'disable_quoting', label: '{{ _('$ quoting') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Disable') }}' + id: 'disable_quoting', label: gettext('$ quoting'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Disable') }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Miscellaneous') }}', - group: '{{ _('Dump options') }}', + type: 'nested', control: 'fieldset', label: gettext('Miscellaneous'), + group: gettext('Dump options'), schema:[{ - id: 'with_oids', label: '{{ _('With OID(s)') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Miscellaneous') }}' + id: 'with_oids', label: gettext('With OID(s)'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Miscellaneous') },{ - id: 'verbose', label: '{{ _('Verbose messages') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Miscellaneous') }}' + id: 'verbose', label: gettext('Verbose messages'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Miscellaneous') },{ - id: 'dqoute', label: '{{ _('Force double quote on identifiers') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Miscellaneous') }}' + id: 'dqoute', label: gettext('Force double quote on identifiers'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Miscellaneous') },{ - id: 'use_set_session_auth', label: '{{ _('Use SET SESSION AUTHORIZATION') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Miscellaneous') }}' + id: 'use_set_session_auth', label: gettext('Use SET SESSION AUTHORIZATION'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Miscellaneous') }] }], validate: function() { @@ -317,27 +315,27 @@ TODO LIST FOR BACKUP: var menus = [{ name: 'backup_global', module: this, applies: ['tools'], callback: 'start_backup_global', - priority: 12, label: '{{_("Backup Globals...") }}', + priority: 12, label: gettext('Backup Globals...'), icon: 'fa fa-floppy-o', enable: menu_enabled_server },{ name: 'backup_server', module: this, applies: ['tools'], callback: 'start_backup_server', - priority: 12, label: '{{_("Backup Server...") }}', + priority: 12, label: gettext('Backup Server...'), icon: 'fa fa-floppy-o', enable: menu_enabled_server },{ name: 'backup_global_ctx', module: this, node: 'server', applies: ['context'], callback: 'start_backup_global', - priority: 12, label: '{{_("Backup Globals...") }}', + priority: 12, label: gettext('Backup Globals...'), icon: 'fa fa-floppy-o', enable: menu_enabled_server },{ name: 'backup_server_ctx', module: this, node: 'server', applies: ['context'], callback: 'start_backup_server', - priority: 12, label: '{{_("Backup Server...") }}', + priority: 12, label: gettext('Backup Server...'), icon: 'fa fa-floppy-o', enable: menu_enabled_server },{ name: 'backup_object', module: this, applies: ['tools'], callback: 'backup_objects', - priority: 11, label: '{{_("Backup...") }}', + priority: 11, label: gettext('Backup...'), icon: 'fa fa-floppy-o', enable: menu_enabled }]; @@ -346,7 +344,7 @@ TODO LIST FOR BACKUP: name: 'backup_' + backup_supported_nodes[idx], node: backup_supported_nodes[idx], module: this, applies: ['context'], callback: 'backup_objects', - priority: 11, label: '{{_("Backup...") }}', + priority: 11, label: gettext('Backup...'), icon: 'fa fa-floppy-o', enable: menu_enabled }); } @@ -382,7 +380,7 @@ TODO LIST FOR BACKUP: if (pgBrowser.tree.hasParent(i)) { i = $(pgBrowser.tree.parent(i)); } else { - alertify.alert("{{ _("Please select server or child node from tree.") }}"); + alertify.alert(gettext("Please select server or child node from the browser tree.")); break; } } @@ -393,23 +391,23 @@ TODO LIST FOR BACKUP: var module = 'paths', preference_name = 'pg_bin_dir', - msg = '{{ _('Please configure the PostgreSQL Binary Path in the Preferences dialog.') }}'; + msg = gettext('Please configure the PostgreSQL Binary Path in the Preferences dialog.'); if ((server_data.type && server_data.type == 'ppas') || server_data.server_type == 'ppas') { preference_name = 'ppas_bin_dir'; - msg = '{{ _('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.') }}'; + msg = gettext('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.'); } var preference = pgBrowser.get_preference(module, preference_name); if(preference) { if (!preference.value) { - alertify.alert('{{ _("Configuration required") }}', msg); + alertify.alert(gettext('Configuration required'), msg); return; } } else { - alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value()); + alertify.alert(S(gettext('Failed to load preference %s of module %s')).sprintf(preference_name, module).value()); return; } @@ -424,8 +422,8 @@ TODO LIST FOR BACKUP: var DialogName = 'BackupDialog_' + of_type, DialogTitle = ((of_type == 'globals') ? - '{{ _('Backup Globals...') }}' : - '{{ _('Backup Server...') }}'); + gettext('Backup Globals...') : + gettext('Backup Server...')); if(!alertify[DialogName]) { alertify.dialog(DialogName ,function factory() { @@ -440,17 +438,17 @@ TODO LIST FOR BACKUP: return { buttons: [{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-info', - attrs:{name:'object_help', type:'button', url: 'backup.html', label: '{{ _('Backup') }}'} + attrs:{name:'object_help', type:'button', url: 'backup.html', label: gettext('Backup')} },{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question', - attrs:{name:'dialog_help', type:'button', label: '{{ _('Backup') }}', + attrs:{name:'dialog_help', type:'button', label: gettext('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: gettext('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: gettext('Cancel'), key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button', 'data-btn-name': 'cancel' }], // Set options for dialog @@ -520,7 +518,7 @@ TODO LIST FOR BACKUP: self.__internal.buttons[2].element.disabled = false; } else { self.__internal.buttons[2].element.disabled = true; - this.errorModel.set('file', '{{ _('Please provide a filename') }}') + this.errorModel.set('file', gettext('Please provide a filename')) } }); }, @@ -558,7 +556,7 @@ TODO LIST FOR BACKUP: success: function(res) { if (res.success) { alertify.notify( - '{{ _('Backup job created.') }}', 'success', + gettext('Backup job created.'), 'success', 5 ); pgBrowser.Events.trigger('pgadmin-bgprocess:created', self); @@ -570,7 +568,7 @@ TODO LIST FOR BACKUP: try { var err = $.parseJSON(xhr.responseText); alertify.alert( - '{{ _('Backup job failed.') }}', + gettext('Backup job failed.'), err.errormsg ); } catch (e) {} @@ -600,7 +598,7 @@ TODO LIST FOR BACKUP: if (pgBrowser.tree.hasParent(i)) { i = $(pgBrowser.tree.parent(i)); } else { - alertify.alert("{{ _("Please select server or child node from tree.") }}"); + alertify.alert(gettext("Please select server or child node from tree.")); break; } } @@ -611,12 +609,12 @@ TODO LIST FOR BACKUP: var module = 'paths', preference_name = 'pg_bin_dir', - msg = '{{ _('Please set binary path for PostgreSQL Server from preferences.') }}'; + msg = gettext('Please set binary path for PostgreSQL Server from preferences.'); if ((server_data.type && server_data.type == 'ppas') || server_data.server_type == 'ppas') { preference_name = 'ppas_bin_dir'; - msg = '{{ _('Please set binary path for EDB Postgres Advanced Server from preferences.') }}'; + msg = gettext('Please set binary path for EDB Postgres Advanced Server from preferences.'); } var preference = pgBrowser.get_preference(module, preference_name); @@ -627,7 +625,7 @@ TODO LIST FOR BACKUP: return; } } else { - alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value()); + alertify.alert(S(gettext('Failed to load preference %s of module %s')).sprintf(preference_name, module).value()); return; } @@ -656,16 +654,16 @@ TODO LIST FOR BACKUP: return { buttons: [{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-info', - attrs:{name:'object_help', type:'button', url: 'backup.html', label: '{{ _('Backup') }}'} + attrs:{name:'object_help', type:'button', url: 'backup.html', label: gettext('Backup')} },{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question', - attrs:{name:'dialog_help', type:'button', label: '{{ _('Backup') }}', + attrs:{name:'dialog_help', type:'button', label: gettext('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: gettext('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: gettext('Cancel'), key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button', 'data-btn-name': 'cancel' }], // Set options for dialog @@ -732,7 +730,7 @@ TODO LIST FOR BACKUP: self.__internal.buttons[2].element.disabled = false; } else { self.__internal.buttons[2].element.disabled = true; - this.errorModel.set('file', '{{ _('Please provide filename') }}') + this.errorModel.set('file', gettext('Please provide filename')) } }); @@ -787,7 +785,7 @@ TODO LIST FOR BACKUP: data:{ 'data': JSON.stringify(args) }, success: function(res) { if (res.success) { - alertify.notify('{{ _('Backup job created.') }}', 'success', 5); + alertify.notify(gettext('Backup job created.'), 'success', 5); pgBrowser.Events.trigger('pgadmin-bgprocess:created', self); } }, @@ -795,7 +793,7 @@ TODO LIST FOR BACKUP: try { var err = $.parseJSON(xhr.responseText); alertify.alert( - '{{ _('Backup job failed.') }}', + gettext('Backup job failed.'), err.errormsg ); } catch (e) {} diff --git a/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js b/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js index 2b35b7e6f..53deb786d 100644 --- a/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js +++ b/web/pgadmin/tools/datagrid/templates/datagrid/js/datagrid.js @@ -1,7 +1,7 @@ -define( - ['jquery','alertify', 'pgadmin','codemirror', 'codemirror/mode/sql/sql', - 'pgadmin.browser', 'wcdocker'], - function($, alertify, pgAdmin, CodeMirror) { +define([ + 'sources/gettext', 'jquery','alertify', 'pgadmin','codemirror', + 'codemirror/mode/sql/sql', 'pgadmin.browser', 'wcdocker' +], function(gettext, $, alertify, pgAdmin, CodeMirror) { // Some scripts do export their object in the window only. // Generally the one, which do no have AMD support. var wcDocker = window.wcDocker, @@ -75,7 +75,7 @@ define( var menus = [{ name: 'query_tool', module: this, applies: ['tools'], callback: 'show_query_tool', enable: query_tool_menu_enabled, - priority: 1, label: '{{ _('Query Tool') }}', + priority: 1, label: gettext('Query Tool'), icon: 'fa fa-bolt' }]; @@ -85,26 +85,26 @@ define( name: 'view_all_rows_context_' + supported_nodes[idx], node: supported_nodes[idx], module: this, data: {mnuid: 3}, applies: ['context', 'object'], callback: 'show_data_grid', enable: view_menu_enabled, - category: 'view_data', priority: 101, label: '{{ _('View All Rows') }}' + category: 'view_data', priority: 101, label: gettext('View All Rows') },{ name: 'view_first_100_rows_context_' + supported_nodes[idx], node: supported_nodes[idx], module: this, data: {mnuid: 1}, applies: ['context', 'object'], callback: 'show_data_grid', enable: view_menu_enabled, - category: 'view_data', priority: 102, label: '{{ _('View First 100 Rows') }}' + category: 'view_data', priority: 102, label: gettext('View First 100 Rows') },{ name: 'view_last_100_rows_context_' + supported_nodes[idx], node: supported_nodes[idx], module: this, data: {mnuid: 2}, applies: ['context', 'object'], callback: 'show_data_grid', enable: view_menu_enabled, - category: 'view_data', priority: 103, label: '{{ _('View Last 100 Rows') }}' + category: 'view_data', priority: 103, label: gettext('View Last 100 Rows') },{ name: 'view_filtered_rows_context_' + supported_nodes[idx], node: supported_nodes[idx], module: this, data: {mnuid: 4}, applies: ['context', 'object'], callback: 'show_filtered_row', enable: view_menu_enabled, - category: 'view_data', priority: 104, label: '{{ _('View Filtered Rows...') }}' + category: 'view_data', priority: 104, label: gettext('View Filtered Rows...') }); } - pgAdmin.Browser.add_menu_category('view_data', '{{ _('View Data') }}', 100, 'fa fa-th'); + pgAdmin.Browser.add_menu_category('view_data', gettext('View Data'), 100, 'fa fa-th'); pgAdmin.Browser.add_menus(menus); // Creating a new pgAdmin.Browser frame to show the data. @@ -262,7 +262,7 @@ define( callback: function(closeEvent) { - if (closeEvent.button.text == "{{ _('OK') }}") { + if (closeEvent.button.text == gettext("OK")) { var sql = this.filter_obj.getValue(); var that = this; @@ -421,7 +421,7 @@ define( panel_title += self.title_index; self.title_index += 1; } else { - panel_title += "{{ _(' untitled') }}"; + panel_title += gettext(" untitled"); } $.ajax({ @@ -481,7 +481,7 @@ define( }, error: function(e) { alertify.alert( - "{{ _('Query Tool Initialize Error') }}" + gettext("Query Tool Initialize Error") ); } }); diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/debugger.js b/web/pgadmin/tools/debugger/templates/debugger/js/debugger.js index 86886ea64..7e7e31f02 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/debugger.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/debugger.js @@ -1,9 +1,9 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin', - 'pgadmin.browser', 'backbone', 'backgrid', 'codemirror', 'backform', - 'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.backform', - 'pgadmin.backgrid', 'pgadmin.browser.frame'], - function($, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform, get_function_arguments) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'codemirror', + 'backform', 'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.backform', + 'pgadmin.backgrid', 'pgadmin.browser.frame' +], function(gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform, get_function_arguments) { pgAdmin = pgAdmin || window.pgAdmin || {}; @@ -25,61 +25,61 @@ define( pgBrowser.add_menus([{ name: 'direct_debugger', node: 'function', module: this, applies: ['object', 'context'], callback: 'get_function_information', - category: 'Debugging', priority: 10, label: '{{ _('Debug') }}', + category: gettext('Debugging'), priority: 10, label: gettext('Debug'), data: {object: 'function'}, icon: 'fa fa-arrow-circle-right', enable: 'can_debug' },{ name: 'global_debugger', node: 'function', module: this, applies: ['object', 'context'], callback: 'check_func_debuggable', - category: 'Debugging', priority: 10, label: '{{ _('Set breakpoint') }}', + category: gettext('Debugging'), priority: 10, label: gettext('Set breakpoint'), data: {object: 'function'}, icon: 'fa fa-arrow-circle-right', enable: 'can_debug' },{ name: 'procedure_direct_debugger', node: 'procedure', module: this, applies: ['object', 'context'], callback: 'get_function_information', - category: 'Debugging', priority: 10, label: '{{ _('Debug') }}', + category: gettext('Debugging'), priority: 10, label: gettext('Debug'), data: {object: 'procedure'}, icon: 'fa fa-arrow-circle-right', enable: 'can_debug' }, { name: 'procedure_indirect_debugger', node: 'procedure', module: this, applies: ['object', 'context'], callback: 'check_func_debuggable', - category: 'Debugging', priority: 10, label: '{{ _('Set breakpoint') }}', + category: gettext('Debugging'), priority: 10, label: gettext('Set breakpoint'), data: {object: 'procedure'}, icon: 'fa fa-arrow-circle-right', enable: 'can_debug' }, { name: 'trigger_function_indirect_debugger', node: 'trigger_function', module: this, applies: ['object', 'context'], callback: 'check_func_debuggable', - priority: 10, label: '{{ _('Set breakpoint') }}', category: 'Debugging', + priority: 10, label: gettext('Set breakpoint'), category: gettext('Debugging'), icon: 'fa fa-arrow-circle-right', data: {object:'trigger_function'}, enable: 'can_debug' }, { name: 'trigger_indirect_debugger', node: 'trigger', module: this, applies: ['object', 'context'], callback: 'check_func_debuggable', - priority: 10, label: '{{ _('Set breakpoint') }}', category: 'Debugging', + priority: 10, label: gettext('Set breakpoint'), category: gettext('Debugging'), icon: 'fa fa-arrow-circle-right', data: {object:'trigger'}, enable: 'can_debug' }, { name: 'package_function_direct_debugger', node: 'edbfunc', module: this, applies: ['object', 'context'], callback: 'get_function_information', - category: 'Debugging', priority: 10, label: '{{ _('Debug') }}', + category: gettext('Debugging'), priority: 10, label: gettext('Debug'), data: {object: 'edbfunc'}, icon: 'fa fa-arrow-circle-right', enable: 'can_debug' },{ name: 'package_function_global_debugger', node: 'edbfunc', module: this, applies: ['object', 'context'], callback: 'check_func_debuggable', - category: 'Debugging', priority: 10, label: '{{ _('Set breakpoint') }}', + category: gettext('Debugging'), priority: 10, label: gettext('Set breakpoint'), data: {object: 'edbfunc'}, icon: 'fa fa-arrow-circle-right', enable: 'can_debug' },{ name: 'package_procedure_direct_debugger', node: 'edbproc', module: this, applies: ['object', 'context'], callback: 'get_function_information', - category: 'Debugging', priority: 10, label: '{{ _('Debug') }}', + category: gettext('Debugging'), priority: 10, label: gettext('Debug'), data: {object: 'edbproc'}, icon: 'fa fa-arrow-circle-right', enable: 'can_debug' }, { name: 'package_procedure_global_debugger', node: 'edbproc', module: this, applies: ['object', 'context'], callback: 'check_func_debuggable', - category: 'Debugging', priority: 10, label: '{{ _('Set breakpoint') }}', + category: gettext('Debugging'), priority: 10, label: gettext('Set breakpoint'), data: {object: 'edbproc'}, icon: 'fa fa-arrow-circle-right', enable: 'can_debug' }]); @@ -87,7 +87,7 @@ define( // Create and load the new frame required for debugger panel this.frame = new pgBrowser.Frame({ name: 'frm_debugger', - title: '{{ _('Debugger') }}', + title: gettext('Debugger'), width: 500, isCloseable: true, isPrivate: true, @@ -306,9 +306,9 @@ define( get_function_arguments(res.data[0], 0); } else { - // Initialize the target and create asynchronous connection and unique transaction ID - // If there is no arguments to the functions then we should not ask for for function arguments and - // Directly open the panel + // Initialize the target and create asynchronous connection and unique transaction ID + // If there is no arguments to the functions then we should not ask for for function arguments and + // Directly open the panel var t = pgBrowser.tree, i = t.selected(), d = i && i.length == 1 ? t.itemData(i) : undefined, diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/debugger_ui.js b/web/pgadmin/tools/debugger/templates/debugger/js/debugger_ui.js index 34447955f..8d711696d 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/debugger_ui.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/debugger_ui.js @@ -1,9 +1,9 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin', - 'pgadmin.browser', 'backbone', 'backgrid', 'codemirror', 'backform', - 'wcdocker', 'pgadmin.backform', 'pgadmin.backgrid', - 'pgadmin.browser.panel'], - function($, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform ) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'codemirror', + 'backform', 'wcdocker', 'pgadmin.backform', 'pgadmin.backgrid', + 'pgadmin.browser.panel' +], function(gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform ) { /* * Function used to return the respective Backgrid control based on the data type @@ -86,7 +86,7 @@ define( if (_.isUndefined(this.get('value')) || _.isNull(this.get('value')) || String(this.get('value')).replace(/^\s+|\s+$/g, '') == '') { - var msg = '{{ _('Please enter a value for the parameter.') }}'; + var msg = gettext('Please enter a value for the parameter.'); this.errorModel.set('value', msg); return msg; } else { diff --git a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js index 77af64e80..fc01b21d4 100644 --- a/web/pgadmin/tools/debugger/templates/debugger/js/direct.js +++ b/web/pgadmin/tools/debugger/templates/debugger/js/direct.js @@ -1,9 +1,14 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin','pgadmin.browser', - 'backbone', 'backgrid', 'codemirror', 'backform','pgadmin.tools.debugger.ui', - 'wcdocker', 'pgadmin.backform', 'pgadmin.backgrid', 'codemirror/addon/selection/active-line', - 'codemirror/addon/fold/foldgutter', 'codemirror/addon/fold/foldcode', 'pgadmin-sqlfoldcode'], - function($, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, CodeMirror, Backform, debug_function_again) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'pgadmin','pgadmin.browser', 'backbone', 'backgrid', 'codemirror', 'backform', + 'pgadmin.tools.debugger.ui', 'wcdocker', 'pgadmin.backform', + 'pgadmin.backgrid', 'codemirror/addon/selection/active-line', + 'codemirror/addon/fold/foldgutter', 'codemirror/addon/fold/foldcode', + 'pgadmin-sqlfoldcode' +], function( + gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, + CodeMirror, Backform, debug_function_again +) { if (pgAdmin.Browser.tree != null) { pgAdmin = pgAdmin || window.pgAdmin || {}; @@ -360,7 +365,7 @@ define( pgTools.DirectDebug.polling_timeout_idle = true; // If status is Busy then poll the result by recursive call to the poll function if (!pgTools.DirectDebug.debug_type) { - pgTools.DirectDebug.docker.startLoading('{{ _('Waiting for another session to invoke the target...') }}'); + pgTools.DirectDebug.docker.startLoading(gettext('Waiting for another session to invoke the target...')); // As we are waiting for another session to invoke the target,disable all the buttons self.enable('stop', false); @@ -1507,7 +1512,7 @@ define( // Create the parameters panel to display the arguments of the functions var parameters = new pgAdmin.Browser.Panel({ name: 'parameters', - title: '{{ _('Parameters') }}', + title: gettext('Parameters'), width: '100%', height:'100%', isCloseable: false, @@ -1518,7 +1523,7 @@ define( // Create the Local variables panel to display the local variables of the function. var local_variables = new pgAdmin.Browser.Panel({ name: 'local_variables', - title: '{{ _('Local variables') }}', + title: gettext('Local variables'), width: '100%', height:'100%', isCloseable: false, @@ -1529,7 +1534,7 @@ define( // Create the messages panel to display the message returned from the database server var messages = new pgAdmin.Browser.Panel({ name: 'messages', - title: '{{ _('Messages') }}', + title: gettext('Messages'), width: '100%', height:'100%', isCloseable: false, @@ -1540,7 +1545,7 @@ define( // Create the result panel to display the result after debugging the function var results = new pgAdmin.Browser.Panel({ name: 'results', - title: '{{ _('Results') }}', + title: gettext('Results'), width: '100%', height:'100%', isCloseable: false, @@ -1551,7 +1556,7 @@ define( // Create the stack pane panel to display the debugging stack information. var stack_pane = new pgAdmin.Browser.Panel({ name: 'stack_pane', - title: '{{ _('Stack') }}', + title: gettext('Stack'), width: '100%', height:'100%', isCloseable: false, @@ -1611,7 +1616,7 @@ define( self.editor.on("gutterClick", self.onBreakPoint.bind(self), self); }; - self.docker.startLoading('{{ _('Loading...') }}'); + self.docker.startLoading(gettext('Loading...')); self.docker.on(wcDocker.EVENT.LOADED, onLoad); // Create the toolbar view for debugging the function diff --git a/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js b/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js index db6cfd0f5..5cd26dc98 100644 --- a/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js +++ b/web/pgadmin/tools/grant_wizard/templates/grant_wizard/js/grant_wizard.js @@ -1,12 +1,10 @@ +// Grant Wizard define([ - 'jquery', 'underscore', 'underscore.string', 'alertify', - 'pgadmin.browser', 'backbone', 'backgrid', 'pgadmin.browser.node', - 'backgrid.select.all', 'backgrid.filter', 'pgadmin.browser.server.privilege', - 'pgadmin.browser.wizard', - ], - - // This defines Grant Wizard dialog - function($, _, S, alertify, pgBrowser, Backbone, Backgrid, pgNode) { + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'pgadmin.browser', 'backbone', 'backgrid', 'pgadmin.browser.node', + 'backgrid.select.all', 'backgrid.filter', 'pgadmin.browser.server.privilege', + 'pgadmin.browser.wizard', +], function(gettext, $, _, S, alertify, pgBrowser, Backbone, Backgrid, pgNode) { // if module is already initialized, refer to that. if (pgBrowser.GrantWizard) { @@ -63,7 +61,7 @@ define([ errmsg, node = this.get('objects').toJSON(); if (_.isEmpty(node)) { - err['selected'] = '{{ _("Please select any database object type.") }}'; + err['selected'] = gettext('Please select any database object type.'); errmsg = errmsg || err['selected']; this.errorModel.set('selected', errmsg); return errmsg; @@ -176,7 +174,7 @@ define([ var menus = [{ name: 'grant_wizard_schema', module: this, applies: ['tools'], callback: 'start_grant_wizard', - priority: 14, label: '{{_("Grant Wizard...") }}', + priority: 14, label: gettext('Grant Wizard...'), icon: 'fa fa-unlock-alt', enable: menu_enabled }]; @@ -186,7 +184,7 @@ define([ name: 'grant_wizard_schema_context_' + supported_nodes[idx], node: supported_nodes[idx], module: this, applies: ['context'], callback: 'start_grant_wizard', - priority: 14, label: '{{_("Grant Wizard...") }}', + priority: 14, label: gettext('Grant Wizard...'), icon: 'fa fa-unlock-alt', enable: menu_enabled }); } @@ -583,11 +581,11 @@ define([ }, schema: [ { - id: 'objects', label: '{{ _("Objects") }}', model: DatabaseObjectModel, - type: 'collection', group: 'Objects' + id: 'objects', label: gettext('Objects'), model: DatabaseObjectModel, + type: 'collection', group: gettext('Objects') }, { - id: 'acl', label: '{{ _("Privileges") }}', + id: 'acl', label: gettext('Privileges'), model: pgAdmin.Browser.Node.PrivilegeRoleModel, type: 'collection', canAdd: true, canDelete: true, control: 'unique-col-collection' @@ -773,7 +771,7 @@ define([ }, schema: [ { - id: 'acl', label: '{{ _("Privileges") }}', + id: 'acl', label: gettext('Privileges'), model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({ // privileges are selected based on node clicked @@ -1089,7 +1087,7 @@ define([ alertify.pgNotifier( "error", jqxhr, S( - "{{ _('Error saving properties: %s') }}" + gettext("Error saving properties: %s") ).sprintf(jqxhr.statusText).value() ); 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 a3005312d..390a32429 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 @@ -1,8 +1,10 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin', - 'pgadmin.browser', 'backbone', 'backgrid', 'backform', - 'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui'], - function($, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'backform', + 'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui' +], function( + gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform +) { pgAdmin = pgAdmin || window.pgAdmin || {}; @@ -32,39 +34,39 @@ define( table: undefined }, schema: [{ - id: 'is_import', label:'{{ _('Import/Export') }}', cell: 'switch', - type: 'switch', group: '{{ _('Options')}}', + id: 'is_import', label: gettext('Import/Export'), cell: 'switch', + type: 'switch', group: gettext('Options'), options: { - 'onText': '{{ _('Import') }}', 'offText': '{{ _('Export') }}', + 'onText': gettext('Import'), 'offText': gettext('Export'), 'onColor': 'success', 'offColor': 'primary' } }, { - type: 'nested', control: 'fieldset', label: '{{ _('File Info') }}', - group: '{{ _('Options') }}', + type: 'nested', control: 'fieldset', label: gettext('File Info'), + group: gettext('Options'), schema:[{ /* select file control for import */ - id: 'filename', label: '{{ _('Filename')}}', deps: ['is_import'], - type: 'text', control: Backform.FileControl, group: '{{ _('File Info')}}', + id: 'filename', label: gettext('Filename'), deps: ['is_import'], + type: 'text', control: Backform.FileControl, group: gettext('File Info'), dialog_type: 'select_file', supp_types: ['csv', 'txt', '*'], visible: 'importing' }, { /* create file control for export */ - id: 'filename', label: '{{ _('Filename')}}', deps: ['is_import'], - type: 'text', control: Backform.FileControl, group: '{{ _('File Info')}}', + id: 'filename', label: gettext('Filename'), deps: ['is_import'], + type: 'text', control: Backform.FileControl, group: gettext('File Info'), dialog_type: 'create_file', supp_types: ['csv', 'txt', '*'], visible: 'exporting' }, { - id: 'format', label: '{{ _("Format") }}', cell: 'string', - control: 'select2', group: '{{ _('File Info')}}', + id: 'format', label: gettext('Format'), cell: 'string', + control: 'select2', group: gettext('File Info'), options:[ {'label': 'binary', 'value': 'binary'}, {'label': 'csv', 'value': 'csv'}, {'label': 'text', 'value': 'text'}, ], disabled: 'isDisabled', select2: {allowClear: false, width: "100%" }, }, { - id: 'encoding', label: '{{ _("Encoding") }}', cell: 'string', + id: 'encoding', label: gettext('Encoding'), cell: 'string', control: 'node-ajax-options', node: 'database', url: 'get_encodings', first_empty: true, - group: '{{ _('File Info')}}' + group: gettext('File Info') }] },{ - id: 'columns', label: '{{ _("Columns to import") }}', cell: 'string', + id: 'columns', label: gettext('Columns to import'), cell: 'string', deps: ['is_import'], type: 'array', first_empty: false, control: Backform.NodeListByNameControl.extend({ // By default, all the import columns should be selected @@ -116,22 +118,22 @@ define( return res; }, - node: 'column', url: 'nodes', group: '{{ _('Columns')}}', + node: 'column', url: 'nodes', group: gettext('Columns'), select2: { multiple: true, allowClear: false, - placeholder: '{{ _('Columns for importing...') }}', + placeholder: gettext('Columns for importing...'), first_empty: false }, visible: 'importing', helpMessage: - '{{ _('An optional list of columns to be copied. If no column list is specified, all columns of the table will be copied.') }}' + gettext('An optional list of columns to be copied. If no column list is specified, all columns of the table will be copied.') }, { - id: 'columns', label: '{{ _("Columns to export") }}', cell: 'string', + id: 'columns', label: gettext('Columns to export'), cell: 'string', deps: ['is_import'], type: 'array', control: 'node-list-by-name', first_empty: false, - node: 'column', url: 'nodes', group: '{{ _('Columns')}}', + node: 'column', url: 'nodes', group: gettext('Columns'), select2: { multiple: true, allowClear: true, - placeholder: '{{ _('Colums for exporting...') }}' + placeholder: gettext('Colums for exporting...') }, visible: 'exporting', transform: function(rows) { var self = this, @@ -157,36 +159,36 @@ define( return res; }, helpMessage: - '{{ _('An optional list of columns to be copied. If no column list is specified, all columns of the table will be copied.') }}' + gettext('An optional list of columns to be copied. If no column list is specified, all columns of the table will be copied.') }, { - id: 'null_string', label: '{{ _("NULL Strings") }}', cell: 'string', - type: 'text', group: '{{ _('Columns')}}', disabled: 'isDisabled', + id: 'null_string', label: gettext('NULL Strings'), cell: 'string', + type: 'text', group: gettext('Columns'), disabled: 'isDisabled', deps: ['format'], helpMessage: - "{{ _("Specifies the string that represents a null value. The default is \\\\N (backslash-N) in text format, and an unquoted empty string in CSV format. You might prefer an empty string even in text format for cases where you don't want to distinguish nulls from empty strings. This option is not allowed when using binary format.") }}" + gettext("Specifies the string that represents a null value. The default is \\N (backslash-N) in text format, and an unquoted empty string in CSV format. You might prefer an empty string even in text format for cases where you don't want to distinguish nulls from empty strings. This option is not allowed when using binary format.") }, { - id: 'icolumns', label: '{{ _("Not null columns") }}', cell: 'string', + id: 'icolumns', label: gettext('Not null columns'), cell: 'string', control: 'node-list-by-name', node: 'column', - group: '{{ _('Columns')}}', deps: ['format', 'is_import'], disabled: 'isDisabled', + group: gettext('Columns'), deps: ['format', 'is_import'], disabled: 'isDisabled', type: 'array', first_empty: false, select2: { multiple: true, allowClear: true, first_empty: true, - placeholder: '{{ _('Not null columns...') }}' + placeholder: gettext('Not null columns...') }, helpMessage: - '{{ _('Do not match the specified column values against the null string. In the default case where the null string is empty, this means that empty values will be read as zero-length strings rather than nulls, even when they are not quoted. This option is allowed only in import, and only when using CSV format.') }}' + gettext('Do not match the specified column values against the null string. In the default case where the null string is empty, this means that empty values will be read as zero-length strings rather than nulls, even when they are not quoted. This option is allowed only in import, and only when using CSV format.') }, { - type: 'nested', control: 'fieldset', label: '{{ _('Miscellaneous') }}', - group: '{{ _('Options') }}', + type: 'nested', control: 'fieldset', label: gettext('Miscellaneous'), + group: gettext('Options'), schema:[{ - id: 'oid', label:'{{ _('OID') }}', cell: 'string', - type: 'switch', group: '{{ _('Miscellaneous') }}' + id: 'oid', label: gettext('OID'), cell: 'string', + type: 'switch', group: gettext('Miscellaneous') },{ - id: 'header', label:'{{ _('Header') }}', cell: 'string', - type: 'switch', group: '{{ _('Miscellaneous') }}', deps: ['format'], disabled: 'isDisabled' + id: 'header', label: gettext('Header'), cell: 'string', + type: 'switch', group: gettext('Miscellaneous'), deps: ['format'], disabled: 'isDisabled' },{ - id: 'delimiter', label:'{{ _('Delimiter') }}', cell: 'string', first_empty: true, - type: 'text', control: 'node-ajax-options', group: '{{ _('Miscellaneous') }}', disabled: 'isDisabled', + id: 'delimiter', label: gettext('Delimiter'), cell: 'string', first_empty: true, + type: 'text', control: 'node-ajax-options', group: gettext('Miscellaneous'), disabled: 'isDisabled', deps: ['format'], options:[ {'label': ';', 'value': ';'}, @@ -198,13 +200,13 @@ define( tags: true, allowClear: false, width: "100%", - placeholder: '{{ _('Select from list...') }}' + placeholder: gettext('Select from list...') }, helpMessage: - '{{ _('Specifies the character that separates columns within each row (line) of the file. The default is a tab character in text format, a comma in CSV format. This must be a single one-byte character. This option is not allowed when using binary format.') }}' + gettext('Specifies the character that separates columns within each row (line) of the file. The default is a tab character in text format, a comma in CSV format. This must be a single one-byte character. This option is not allowed when using binary format.') }, { - id: 'quote', label:'{{ _('Quote') }}', cell: 'string', first_empty: true, deps: ['format'], - type: 'text', control: 'node-ajax-options', group: '{{ _('Miscellaneous') }}', disabled: 'isDisabled', + id: 'quote', label: gettext('Quote'), cell: 'string', first_empty: true, deps: ['format'], + type: 'text', control: 'node-ajax-options', group: gettext('Miscellaneous'), disabled: 'isDisabled', options:[ {'label': '\"', 'value': '\"'}, {'label': '\'', 'value': '\''}, @@ -213,13 +215,13 @@ define( tags: true, allowClear: false, width: "100%", - placeholder: '{{ _('Select from list...') }}' + placeholder: gettext('Select from list...') }, helpMessage: - '{{ _('Specifies the quoting character to be used when a data value is quoted. The default is double-quote. This must be a single one-byte character. This option is allowed only when using CSV format.') }}' + gettext('Specifies the quoting character to be used when a data value is quoted. The default is double-quote. This must be a single one-byte character. This option is allowed only when using CSV format.') }, { - id: 'escape', label:'{{ _('Escape') }}', cell: 'string', first_empty: true, deps: ['format'], - type: 'text', control: 'node-ajax-options', group: '{{ _('Miscellaneous') }}', disabled: 'isDisabled', + id: 'escape', label: gettext('Escape'), cell: 'string', first_empty: true, deps: ['format'], + type: 'text', control: 'node-ajax-options', group: gettext('Miscellaneous'), disabled: 'isDisabled', options:[ {'label': '\"', 'value': '\"'}, {'label': '\'', 'value': '\''}, @@ -228,9 +230,9 @@ define( tags: true, allowClear: false, width: "100%", - placeholder: '{{ _('Select from list...') }}' + placeholder: gettext('Select from list...') }, helpMessage: - '{{ _('Specifies the character that should appear before a data character that matches the QUOTE value. The default is the same as the QUOTE value (so that the quoting character is doubled if it appears in the data). This must be a single one-byte character. This option is allowed only when using CSV format.') }}' + gettext('Specifies the character that should appear before a data character that matches the QUOTE value. The default is the same as the QUOTE value (so that the quoting character is doubled if it appears in the data). This must be a single one-byte character. This option is allowed only when using CSV format.') }] } ], @@ -289,7 +291,7 @@ define( pgBrowser.add_menus([{ name: 'import', node: 'table', module: this, applies: ['tools', 'context'], callback: 'callback_import_export', - category: 'import', priority: 10, label: '{{ _('Import/Export...') }}', + category: 'import', priority: 10, label: gettext('Import/Export...'), icon: 'fa fa-shopping-cart', enable: menu_enabled }]); }, @@ -311,7 +313,7 @@ define( if (pgBrowser.tree.hasParent(i)) { i = $(pgBrowser.tree.parent(i)); } else { - Alertify.alert("{{ _("Please select server or child node from tree.") }}"); + Alertify.alert(gettext("Please select server or child node from tree.")); break; } } @@ -322,23 +324,23 @@ define( var module = 'paths', preference_name = 'pg_bin_dir', - msg = '{{ _('Please configure the PostgreSQL Binary Path in the Preferences dialog.') }}'; + msg = gettext('Please configure the PostgreSQL Binary Path in the Preferences dialog.'); if ((server_data.type && server_data.type == 'ppas') || server_data.server_type == 'ppas') { preference_name = 'ppas_bin_dir'; - msg = '{{ _('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.') }}'; + msg = gettext('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.'); } var preference = pgBrowser.get_preference(module, preference_name); if(preference) { if (!preference.value) { - Alertify.alert('{{ _("Configuration required") }}', msg); + Alertify.alert(gettext('Configuration required'), msg); return; } } else { - Alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value()); + Alertify.alert(S(gettext('Failed to load preference %s of module %s')).sprintf(preference_name, module).value()); return; } @@ -373,12 +375,12 @@ define( setup: function() { return { buttons:[{ - text: "{{ _('OK') }}", key: 27, disable: true, + text: gettext("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, + text: gettext("Cancel"), key: 27, 'data-btn-name': 'cancel', className: "btn btn-danger fa fa-lg fa-times pg-alertify-button" @@ -417,7 +419,7 @@ define( data:{ 'data': JSON.stringify(args) }, success: function(res) { if (res.success) { - Alertify.notify('{{ _('Import/export job created.') }}', 'success', 5); + Alertify.notify(gettext('Import/export job created.'), 'success', 5); pgBrowser.Events.trigger('pgadmin-bgprocess:created', self); } }, @@ -425,7 +427,7 @@ define( try { var err = $.parseJSON(xhr.responseText); Alertify.alert( - '{{ _('Import/export job failed.') }}', + gettext('Import/export job failed.'), err.errormsg ); } catch (e) {} @@ -501,19 +503,19 @@ define( self.__internal.buttons[0].element.disabled = false; } else { self.__internal.buttons[0].element.disabled = true; - this.errorModel.set('escape', '{{ _('Escape should contain only one character') }}') + this.errorModel.set('escape', gettext('Escape should contain only one character')) } } else { self.__internal.buttons[0].element.disabled = true; - this.errorModel.set('quote', '{{ _('Quote should contain only one character') }}') + this.errorModel.set('quote', gettext('Quote should contain only one character')) } } else { self.__internal.buttons[0].element.disabled = true; - this.errorModel.set('delimiter', '{{ _('Delimiter should contain only one character') }}') + this.errorModel.set('delimiter', gettext('Delimiter should contain only one character')) } } else { self.__internal.buttons[0].element.disabled = true; - this.errorModel.set('filename', '{{ _('Please provide filename') }}') + this.errorModel.set('filename', gettext('Please provide filename')) } }); @@ -528,7 +530,7 @@ define( // Open the Alertify dialog for the import/export module Alertify.ImportDialog( S( - "{{ _("Import/Export data - table '%s'") }}" + gettext("Import/Export data - table '%s'") ).sprintf(treeInfo.table.label).value(), node, i, d ).set('resizable',true).resizeTo('70%','80%'); } diff --git a/web/pgadmin/tools/maintenance/templates/maintenance/js/maintenance.js b/web/pgadmin/tools/maintenance/templates/maintenance/js/maintenance.js index 3d2b51a20..e22c42487 100644 --- a/web/pgadmin/tools/maintenance/templates/maintenance/js/maintenance.js +++ b/web/pgadmin/tools/maintenance/templates/maintenance/js/maintenance.js @@ -1,8 +1,10 @@ -define( - ['jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin', - 'pgadmin.browser', 'backbone', 'backgrid', 'backform', - 'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui'], - function($, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'pgadmin', 'pgadmin.browser', 'backbone', 'backgrid', 'backform', + 'pgadmin.backform', 'pgadmin.backgrid', 'pgadmin.browser.node.ui' +], function( + gettext, $, _, S, Alertify, pgAdmin, pgBrowser, Backbone, Backgrid, Backform +) { pgAdmin = pgAdmin || window.pgAdmin || {}; @@ -49,8 +51,8 @@ define( }, schema: [ { - id: 'op', label:'{{ _('Maintenance operation') }}', cell: 'string', - type: 'text', group: '{{ _('Options') }}', + id: 'op', label: gettext('Maintenance operation'), cell: 'string', + type: 'text', group: gettext('Options'), options:[ {'label': "VACUUM", 'value': "VACUUM"}, {'label': "ANALYZE", 'value': "ANALYZE"}, @@ -73,25 +75,25 @@ define( select2: { allowClear: false, width: "100%", - placeholder: '{{ _('Select from list...') }}' + placeholder: gettext('Select from list...') }, }, { - type: 'nested', control: 'fieldset', label:'{{ _('Vacuum') }}', group: '{{ _('Options') }}', + type: 'nested', control: 'fieldset', label: gettext('Vacuum'), group: gettext('Options'), schema:[{ - id: 'vacuum_full', disabled: false, group: '{{ _('Vacuum') }}', disabled: 'isDisabled', - control: Backform.CustomSwitchControl, label: '{{ _('FULL') }}', deps: ['op'] + id: 'vacuum_full', disabled: false, group: gettext('Vacuum'), disabled: 'isDisabled', + control: Backform.CustomSwitchControl, label: gettext('FULL'), deps: ['op'] },{ id: 'vacuum_freeze', disabled: false, deps: ['op'], disabled: 'isDisabled', - control: Backform.CustomSwitchControl, label: '{{ _('FREEZE') }}', group: '{{ _('Vacuum') }}' + control: Backform.CustomSwitchControl, label: gettext('FREEZE'), group: gettext('Vacuum') },{ id: 'vacuum_analyze', disabled: false, deps: ['op'], disabled: 'isDisabled', - control: Backform.CustomSwitchControl, label: '{{ _('ANALYZE') }}', group: '{{ _('Vacuum') }}' + control: Backform.CustomSwitchControl, label: gettext('ANALYZE'), group: gettext('Vacuum') }] }, { - id: 'verbose', disabled: false, group: '{{ _('Options') }}', deps: ['op'], - control: Backform.CustomSwitchControl, label: '{{ _('Verbose Messages') }}', disabled: 'isDisabled' + id: 'verbose', disabled: false, group: gettext('Options'), deps: ['op'], + control: Backform.CustomSwitchControl, label: gettext('Verbose Messages'), disabled: 'isDisabled' } ], @@ -174,7 +176,7 @@ define( var menus = [{ name: 'maintenance', module: this, applies: ['tools'], callback: 'callback_maintenace', - priority: 10, label: '{{ _('Maintenance...') }}', + priority: 10, label: gettext('Maintenance...'), icon: 'fa fa-wrench', enable: menu_enabled }]; @@ -184,7 +186,7 @@ define( name: 'maintenance_context_' + maintenance_supported_nodes[idx], node: maintenance_supported_nodes[idx], module: this, applies: ['context'], callback: 'callback_maintenace', - priority: 10, label: '{{_("Maintenance...") }}', + priority: 10, label: gettext('Maintenance...'), icon: 'fa fa-wrench', enable: menu_enabled }); } @@ -208,7 +210,7 @@ define( if (pgBrowser.tree.hasParent(i)) { i = $(pgBrowser.tree.parent(i)); } else { - Alertify.alert("{{ _("Please select server or child node from tree.") }}"); + Alertify.alert(gettext("Please select server or child node from tree.")); break; } } @@ -219,23 +221,23 @@ define( var module = 'paths', preference_name = 'pg_bin_dir', - msg = '{{ _('Please configure the PostgreSQL Binary Path in the Preferences dialog.') }}'; + msg = gettext('Please configure the PostgreSQL Binary Path in the Preferences dialog.'); if ((server_data.type && server_data.type == 'ppas') || server_data.server_type == 'ppas') { preference_name = 'ppas_bin_dir'; - msg = '{{ _('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.') }}'; + msg = gettext('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.'); } var preference = pgBrowser.get_preference(module, preference_name); if(preference) { if (!preference.value) { - Alertify.alert('{{ _("Configuration required") }}', msg); + Alertify.alert(gettext('Configuration required'), msg); return; } } else { - Alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value()); + Alertify.alert(S(gettext('Failed to load preference %s of module %s')).sprintf(preference_name, module).value()); return; } @@ -263,16 +265,16 @@ define( return { buttons:[{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-info', - attrs:{name:'object_help', type:'button', url: 'maintenance.html', label: '{{ _('Maintenance') }}'} + attrs:{name:'object_help', type:'button', url: 'maintenance.html', label: gettext('Maintenance')} },{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question', - attrs:{name:'dialog_help', type:'button', label: '{{ _('Maintenance') }}', + attrs:{name:'dialog_help', type:'button', label: gettext('Maintenance'), url: '{{ url_for('help.static', filename='maintenance_dialog.html') }}'} },{ - text: "{{ _('OK') }}", key: 27, className: "btn btn-primary fa fa-lg fa-save pg-alertify-button", + text: gettext("OK"), key: 27, className: "btn btn-primary fa fa-lg fa-save pg-alertify-button", 'data-btn-name': 'ok', },{ - text: "{{ _('Cancel') }}", key: 27, className: "btn btn-danger fa fa-lg fa-times pg-alertify-button", + text: gettext("Cancel"), key: 27, className: "btn btn-danger fa fa-lg fa-times pg-alertify-button", 'data-btn-name': 'cancel', }], options: { modal: 0, pinnable: false} @@ -346,7 +348,7 @@ define( }, error: function(e) { Alertify.alert( - "{{ _('Maintenance job creation failed.') }}" + gettext("Maintenance job creation failed.") ); } }); diff --git a/web/pgadmin/tools/restore/templates/restore/js/restore.js b/web/pgadmin/tools/restore/templates/restore/js/restore.js index e17d9ceeb..b2d58e821 100644 --- a/web/pgadmin/tools/restore/templates/restore/js/restore.js +++ b/web/pgadmin/tools/restore/templates/restore/js/restore.js @@ -1,11 +1,11 @@ +// Restore dialog define([ - 'jquery', 'underscore', 'underscore.string', 'alertify', - 'pgadmin.browser', 'backbone', 'backgrid', 'backform', - 'pgadmin.browser.node' - ], - - // This defines Restore dialog - function($, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode) { + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'pgadmin.browser', 'backbone', 'backgrid', 'backform', + 'pgadmin.browser.node' +], function( + gettext, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode +) { // if module is already initialized, refer to that. if (pgBrowser.Restore) { @@ -74,33 +74,33 @@ define([ Backbone.Model.prototype.initialize.apply(this, arguments); }, schema: [{ - id: 'format', label: '{{ _('Format') }}', + id: 'format', label: gettext('Format'), type: 'text', disabled: false, control: 'select2', select2: { allowClear: false, width: "100%" }, options: [ - {label: '{{ _('Custom or tar') }}', value: "custom"}, - {label: '{{ _('Directory') }}', value: "directory"} + {label: gettext('Custom or tar'), value: "custom"}, + {label: gettext('Directory'), value: "directory"} ] },{ - id: 'file', label: '{{ _('Filename') }}', + id: 'file', label: gettext('Filename'), type: 'text', disabled: false, control: Backform.FileControl, dialog_type: 'select_file', supp_types: ['*', 'backup','sql', 'patch'] },{ - id: 'no_of_jobs', label: '{{ _('Number of jobs') }}', + id: 'no_of_jobs', label: gettext('Number of jobs'), type: 'int' },{ - id: 'role', label: '{{ _('Role name') }}', + id: 'role', label: gettext('Role name'), control: 'node-list-by-name', node: 'role', select2: { allowClear: false } },{ - type: 'nested', control: 'fieldset', label: '{{ _('Sections') }}', - group: '{{ _('Restore options') }}', + type: 'nested', control: 'fieldset', label: gettext('Sections'), + group: gettext('Restore options'), schema:[{ - id: 'pre_data', label: '{{ _('Pre-data') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}', + id: 'pre_data', label: gettext('Pre-data'), + control: Backform.CustomSwitchControl, group: gettext('Sections'), deps: ['only_data', 'only_schema'], disabled: function(m) { return this.node.type !== 'function' && this.node.type !== 'table' && this.node.type !== 'trigger' @@ -108,8 +108,8 @@ define([ && (m.get('only_data') || m.get('only_schema')); } },{ - id: 'data', label: '{{ _('Data') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}', + id: 'data', label: gettext('Data'), + control: Backform.CustomSwitchControl, group: gettext('Sections'), deps: ['only_data', 'only_schema'], disabled: function(m) { return this.node.type !== 'function' && this.node.type !== 'table' && this.node.type !== 'trigger' @@ -117,8 +117,8 @@ define([ && (m.get('only_data') || m.get('only_schema')); } },{ - id: 'post_data', label: '{{ _('Post-data') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Sections') }}', + id: 'post_data', label: gettext('Post-data'), + control: Backform.CustomSwitchControl, group: gettext('Sections'), deps: ['only_data', 'only_schema'], disabled: function(m) { return this.node.type !== 'function' && this.node.type !== 'table' && this.node.type !== 'trigger' @@ -127,11 +127,11 @@ define([ } }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Type of objects') }}', - group: '{{ _('Restore options') }}', + type: 'nested', control: 'fieldset', label: gettext('Type of objects'), + group: gettext('Restore options'), schema:[{ - id: 'only_data', label: '{{ _('Only data') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Type of objects') }}', + id: 'only_data', label: gettext('Only data'), + control: Backform.CustomSwitchControl, group: gettext('Type of objects'), deps: ['pre_data', 'data', 'post_data','only_schema'], disabled: function(m) { return (this.node.type !== 'database' && this.node.type !== 'schema') || ( m.get('pre_data') @@ -141,8 +141,8 @@ define([ ); } },{ - id: 'only_schema', label: '{{ _('Only schema') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Type of objects') }}', + id: 'only_schema', label: gettext('Only schema'), + control: Backform.CustomSwitchControl, group: gettext('Type of objects'), deps: ['pre_data', 'data', 'post_data', 'only_data'], disabled: function(m) { return (this.node.type !== 'database' && this.node.type !== 'schema') || ( m.get('pre_data') @@ -153,60 +153,60 @@ define([ } }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Do not save') }}', - group: '{{ _('Restore options') }}', + type: 'nested', control: 'fieldset', label: gettext('Do not save'), + group: gettext('Restore options'), schema:[{ - id: 'dns_owner', label: '{{ _('Owner') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}' + id: 'dns_owner', label: gettext('Owner'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save') },{ - id: 'dns_privilege', label: '{{ _('Privilege') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}' + id: 'dns_privilege', label: gettext('Privilege'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save') },{ - id: 'dns_tablespace', label: '{{ _('Tablespace') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Do not save') }}' + id: 'dns_tablespace', label: gettext('Tablespace'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Do not save') }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Queries') }}', - group: '{{ _('Restore options') }}', + type: 'nested', control: 'fieldset', label: gettext('Queries'), + group: gettext('Restore options'), schema:[{ - id: 'include_create_database', label: '{{ _('Include CREATE DATABASE statement') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}' + id: 'include_create_database', label: gettext('Include CREATE DATABASE statement'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries') },{ - id: 'clean', label: '{{ _('Clean before restore') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Queries') }}', + id: 'clean', label: gettext('Clean before restore'), + control: Backform.CustomSwitchControl, group: gettext('Queries'), disabled: function(m) { return this.node.type === 'function' || this.node.type === 'trigger_function'; } },{ - id: 'single_transaction', label: '{{ _('Single transaction') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Queries') }}' + id: 'single_transaction', label: gettext('Single transaction'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Queries') }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Disable') }}', - group: '{{ _('Restore options') }}', + type: 'nested', control: 'fieldset', label: gettext('Disable'), + group: gettext('Restore options'), schema:[{ - id: 'disable_trigger', label: '{{ _('Trigger') }}', - control: Backform.CustomSwitchControl, group: '{{ _('Disable') }}' + id: 'disable_trigger', label: gettext('Trigger'), + control: Backform.CustomSwitchControl, group: gettext('Disable') },{ - id: 'no_data_fail_table', label: '{{ _('No data for Failed Tables') }}', - control: Backform.CustomSwitchControl, disabled: false, group: '{{ _('Disable') }}' + id: 'no_data_fail_table', label: gettext('No data for Failed Tables'), + control: Backform.CustomSwitchControl, disabled: false, group: gettext('Disable') }] },{ - type: 'nested', control: 'fieldset', label: '{{ _('Miscellaneous / Behavior') }}', - group: '{{ _('Restore options') }}', + type: 'nested', control: 'fieldset', label: gettext('Miscellaneous / Behavior'), + group: gettext('Restore options'), schema:[{ - id: 'verbose', label: '{{ _('Verbose messages') }}', + id: 'verbose', label: gettext('Verbose messages'), control: Backform.CustomSwitchControl, disabled: false, - group: '{{ _('Miscellaneous / Behavior') }}' + group: gettext('Miscellaneous / Behavior') },{ - id: 'use_set_session_auth', label: '{{ _('Use SET SESSION AUTHORIZATION') }}', + id: 'use_set_session_auth', label: gettext('Use SET SESSION AUTHORIZATION'), control: Backform.CustomSwitchControl, disabled: false, - group: '{{ _('Miscellaneous / Behavior') }}' + group: gettext('Miscellaneous / Behavior') },{ - id: 'exit_on_error', label: '{{ _('Exit on error') }}', + id: 'exit_on_error', label: gettext('Exit on error'), control: Backform.CustomSwitchControl, disabled: false, - group: '{{ _('Miscellaneous / Behavior') }}' + group: gettext('Miscellaneous / Behavior') }] }], validate: function() { @@ -275,7 +275,7 @@ define([ var menus = [{ name: 'restore_object', module: this, applies: ['tools'], callback: 'restore_objects', - priority: 13, label: '{{_("Restore...") }}', + priority: 13, label: gettext('Restore...'), icon: 'fa fa-upload', enable: menu_enabled }]; @@ -284,7 +284,7 @@ define([ name: 'restore_' + restore_supported_nodes[idx], node: restore_supported_nodes[idx], module: this, applies: ['context'], callback: 'restore_objects', - priority: 13, label: '{{_("Restore...") }}', + priority: 13, label: gettext('Restore...'), icon: 'fa fa-upload', enable: menu_enabled }); } @@ -308,7 +308,7 @@ define([ if (pgBrowser.tree.hasParent(i)) { i = $(pgBrowser.tree.parent(i)); } else { - alertify.alert("{{ _("Please select server or child node from tree.") }}"); + alertify.alert(gettext("Please select server or child node from tree.")); break; } } @@ -319,23 +319,23 @@ define([ var module = 'paths', preference_name = 'pg_bin_dir', - msg = '{{ _('Please configure the PostgreSQL Binary Path in the Preferences dialog.') }}'; + msg = gettext('Please configure the PostgreSQL Binary Path in the Preferences dialog.'); if ((server_data.type && server_data.type == 'ppas') || server_data.server_type == 'ppas') { preference_name = 'ppas_bin_dir'; - msg = '{{ _('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.') }}'; + msg = gettext('Please configure the EDB Advanced Server Binary Path in the Preferences dialog.'); } var preference = pgBrowser.get_preference(module, preference_name); if(preference) { if (!preference.value) { - alertify.alert('{{ _("Configuration required") }}', msg); + alertify.alert(gettext('Configuration required'), msg); return; } } else { - alertify.alert(S('{{ _('Failed to load preference %s of module %s') }}').sprintf(preference_name, module).value()); + alertify.alert(S(gettext('Failed to load preference %s of module %s')).sprintf(preference_name, module).value()); return; } @@ -367,17 +367,17 @@ define([ return { buttons: [{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-info', - attrs:{name:'object_help', type:'button', url: 'backup.html', label: '{{ _('Restore') }}'} + attrs:{name:'object_help', type:'button', url: 'backup.html', label: gettext('Restore')} },{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question', - attrs:{name:'dialog_help', type:'button', label: '{{ _('Restore') }}', + attrs:{name:'dialog_help', type:'button', label: gettext('Restore'), url: '{{ url_for('help.static', filename='restore_dialog.html') }}'} },{ - text: '{{ _('Restore') }}', key: 27, + text: gettext('Restore'), key: 27, className: 'btn btn-primary fa fa-upload pg-alertify-button', restore: true, 'data-btn-name': 'restore' },{ - text: '{{ _('Cancel') }}', key: 27, + text: gettext('Cancel'), key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button', restore: false, 'data-btn-name': 'cancel' }], @@ -451,7 +451,7 @@ define([ self.__internal.buttons[2].element.disabled = false; } else { self.__internal.buttons[2].element.disabled = true; - this.errorModel.set('file', '{{ _('Please provide filename') }}') + this.errorModel.set('file', gettext('Please provide filename')) } }); @@ -528,7 +528,7 @@ define([ success: function(res) { if (res.success) { alertify.notify( - '{{ _('Restore job created.') }}', 'success', 5 + gettext('Restore job created.'), 'success', 5 ); pgBrowser.Events.trigger('pgadmin-bgprocess:created', self); } else { @@ -539,7 +539,7 @@ define([ try { var err = $.parseJSON(xhr.responseText); alertify.alert( - '{{ _('Restore failed.') }}', + gettext('Restore failed.'), err.errormsg ); } catch (e) {} diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js index 1e2f659a2..f1cc3f191 100644 --- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js @@ -1,34 +1,32 @@ -define( - [ - 'jquery', 'underscore', 'underscore.string', 'alertify', 'pgadmin', - 'backbone', 'backgrid', 'codemirror', 'pgadmin.misc.explain', - 'sources/selection/grid_selector', 'sources/selection/clipboard', - 'sources/selection/copy_data', - - 'slickgrid', 'bootstrap', 'pgadmin.browser', 'wcdocker', - 'codemirror/mode/sql/sql', 'codemirror/addon/selection/mark-selection', - 'codemirror/addon/selection/active-line', 'codemirror/addon/fold/foldcode', - 'codemirror/addon/fold/foldgutter', 'codemirror/addon/hint/show-hint', - 'codemirror/addon/hint/sql-hint', 'pgadmin.file_manager', - 'pgadmin-sqlfoldcode', - 'codemirror/addon/scroll/simplescrollbars', - 'codemirror/addon/dialog/dialog', - 'codemirror/addon/search/search', - 'codemirror/addon/search/searchcursor', - 'codemirror/addon/search/jump-to-line', - 'backgrid.sizeable.columns', 'slickgrid/slick.formatters', - 'slick.pgadmin.formatters', 'slickgrid/slick.editors', - 'slick.pgadmin.editors', 'slickgrid/plugins/slick.autotooltips', - 'slickgrid/plugins/slick.cellrangedecorator', - 'slickgrid/plugins/slick.cellrangeselector', - 'slickgrid/plugins/slick.cellselectionmodel', - 'slickgrid/plugins/slick.cellcopymanager', - 'slickgrid/plugins/slick.rowselectionmodel', - 'slickgrid/slick.grid' - ], - function( - $, _, S, alertify, pgAdmin, Backbone, Backgrid, CodeMirror, pgExplain, GridSelector, clipboard, copyData - ) { +define([ + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'pgadmin', 'backbone', 'backgrid', 'codemirror', 'pgadmin.misc.explain', + 'sources/selection/grid_selector', 'sources/selection/clipboard', + 'sources/selection/copy_data', + 'slickgrid', 'bootstrap', 'pgadmin.browser', 'wcdocker', + 'codemirror/mode/sql/sql', 'codemirror/addon/selection/mark-selection', + 'codemirror/addon/selection/active-line', 'codemirror/addon/fold/foldcode', + 'codemirror/addon/fold/foldgutter', 'codemirror/addon/hint/show-hint', + 'codemirror/addon/hint/sql-hint', 'pgadmin.file_manager', + 'pgadmin-sqlfoldcode', + 'codemirror/addon/scroll/simplescrollbars', + 'codemirror/addon/dialog/dialog', + 'codemirror/addon/search/search', + 'codemirror/addon/search/searchcursor', + 'codemirror/addon/search/jump-to-line', + 'backgrid.sizeable.columns', 'slickgrid/slick.formatters', + 'slick.pgadmin.formatters', 'slickgrid/slick.editors', + 'slick.pgadmin.editors', 'slickgrid/plugins/slick.autotooltips', + 'slickgrid/plugins/slick.cellrangedecorator', + 'slickgrid/plugins/slick.cellrangeselector', + 'slickgrid/plugins/slick.cellselectionmodel', + 'slickgrid/plugins/slick.cellcopymanager', + 'slickgrid/plugins/slick.rowselectionmodel', + 'slickgrid/slick.grid' +], function( + gettext, $, _, S, alertify, pgAdmin, Backbone, Backgrid, CodeMirror, + pgExplain, GridSelector, clipboard, copyData +) { /* Return back, this has been called more than once */ if (pgAdmin.SqlEditor) return pgAdmin.SqlEditor; @@ -193,7 +191,7 @@ define( // Create panels for 'Data Output', 'Explain', 'Messages' and 'History' var data_output = new pgAdmin.Browser.Panel({ name: 'data_output', - title: "{{ _('Data Output') }}", + title: gettext("Data Output"), width: '100%', height:'100%', isCloseable: false, @@ -203,7 +201,7 @@ define( var explain = new pgAdmin.Browser.Panel({ name: 'explain', - title: "{{ _('Explain') }}", + title: gettext("Explain"), width: '100%', height:'100%', isCloseable: false, @@ -213,7 +211,7 @@ define( var messages = new pgAdmin.Browser.Panel({ name: 'messages', - title: "{{ _('Messages') }}", + title: gettext("Messages"), width: '100%', height:'100%', isCloseable: false, @@ -223,7 +221,7 @@ define( var history = new pgAdmin.Browser.Panel({ name: 'history', - title: "{{ _('History') }}", + title: gettext("History"), width: '100%', height:'100%', isCloseable: false, @@ -256,11 +254,11 @@ define( var data_store = self.handler.data_store; if(data_store && (_.size(data_store.added) || _.size(data_store.updated))) { - msg = "{{ _('The data has been modified, but not saved. Are you sure you wish to discard the changes?') }}"; + msg = gettext("The data has been modified, but not saved. Are you sure you wish to discard the changes?"); notify = true; } } else if(self.handler.is_query_tool && self.handler.is_query_changed) { - msg = "{{ _('The query has been modified, but not saved. Are you sure you wish to discard the changes?') }}"; + msg = gettext("The query has been modified, but not saved. Are you sure you wish to discard the changes?"); notify = true; } if(notify) {return self.user_confirmation(p, msg);} @@ -410,7 +408,7 @@ define( /* To prompt user for unsaved changes */ user_confirmation: function(panel, msg) { // If there is anything to save then prompt user - alertify.confirm("{{ _('Unsaved changes') }}", msg, + alertify.confirm(gettext("Unsaved changes"), msg, function() { // Do nothing as user do not want to save, just continue window.onbeforeunload = null; @@ -1422,8 +1420,8 @@ define( */ if (self.handler.is_query_changed) { alertify.confirm( - "{{ _('Unsaved changes') }}", - "{{ _('Are you sure you wish to discard the current changes?') }}", + gettext("Unsaved changes"), + gettext("Are you sure you wish to discard the current changes?"), function() { // Do nothing as user do not want to save, just continue self.query_tool_obj.setValue(''); @@ -1445,8 +1443,8 @@ define( // ask for confirmation only if anything to clear if(!self.history_collection.length) { return; } - alertify.confirm("{{ _('Clear history') }}", - "{{ _('Are you sure you wish to clear the history?') }}", + alertify.confirm(gettext("Clear history"), + gettext("Are you sure you wish to clear the history?"), function() { // Remove any existing grid first if (self.history_grid) { @@ -1738,8 +1736,8 @@ define( _.size(self.data_store.updated) || _.size(self.data_store.deleted)) ) { - alertify.confirm("{{ _('Unsaved changes') }}", - "{{ _('The data has been modified, but not saved. Are you sure you wish to discard the changes?') }}", + alertify.confirm(gettext("Unsaved changes"), + gettext("The data has been modified, but not saved. Are you sure you wish to discard the changes?"), function(){ // Do nothing as user do not want to save, just continue self._run_query(); @@ -1767,14 +1765,14 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Initializing query execution.') }}" + gettext("Initializing query execution.") ); $("#btn-flash").prop('disabled', true); self.trigger( 'pgadmin-sqleditor:loading-icon:message', - "{{ _('Waiting for the query execution to complete...') }}" + gettext("Waiting for the query execution to complete...") ); $.ajax({ @@ -1827,7 +1825,7 @@ define( self.trigger('pgadmin-sqleditor:loading-icon:hide'); if (e.readyState == 0) { self.update_msg_history(false, - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -1891,7 +1889,7 @@ define( else { // Show message in message and history tab in case of query tool self.total_time = self.get_query_run_time(self.query_start_time, self.query_end_time); - var msg = S("{{ _('Query returned successfully in %s.') }}").sprintf(self.total_time).value(); + var msg = S(gettext("Query returned successfully in %s.")).sprintf(self.total_time).value(); res.result += "\n\n" + msg; self.update_msg_history(true, res.result, false); // Display the notifier if the timeout is set to >= 0 @@ -1927,7 +1925,7 @@ define( if (res.data.status === 'Success') { self.trigger( 'pgadmin-sqleditor:loading-icon:message', - "{{ _('Loading data from the database server and rendering...') }}" + gettext("Loading data from the database server and rendering...") ); self.get_columns(res.data); } @@ -1963,7 +1961,7 @@ define( if (e.readyState == 0) { self.update_msg_history(false, - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -2033,15 +2031,15 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:message', - "{{ _('Loading data from the database server and rendering...') }}", + gettext("Loading data from the database server and rendering..."), self ); // Show message in message and history tab in case of query tool self.total_time = self.get_query_run_time(self.query_start_time, self.query_end_time); self.update_msg_history(true, "", false); - var msg1 = S("{{ _('Total query runtime: %s.') }}").sprintf(self.total_time).value(); - var msg2 = S("{{ _('%s rows retrieved.') }}").sprintf(self.rows_affected).value(); + var msg1 = S(gettext("Total query runtime: %s.")).sprintf(self.total_time).value(); + var msg2 = S(gettext("%s rows retrieved.")).sprintf(self.rows_affected).value(); // Display the notifier if the timeout is set to >= 0 if (self.info_notifier_timeout >= 0) { @@ -2119,7 +2117,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:message', - "{{ _('Retrieving information about the columns returned...') }}" + gettext("Retrieving information about the columns returned...") ); // Make ajax call to fetch the pg types to map numeric data type @@ -2367,17 +2365,17 @@ define( } else { $("#btn-save").prop('disabled', true); } - alertify.success("{{ _('Row(s) deleted') }}"); + alertify.success(gettext("Row(s) deleted")); } else { // There are other data to needs to be updated on server if(is_updated) { - alertify.alert("{{ _('Operation failed') }}", - "{{ _('There are unsaved changes in grid, Please save them first to avoid inconsistency in data') }}" + alertify.alert(gettext("Operation failed"), + gettext("There are unsaved changes in grid, Please save them first to avoid inconsistency in data") ); return; } - alertify.confirm("{{ _('Delete Row(s)') }}", - "{{ _('Are you sure you wish to delete selected row(s)?') }}", + alertify.confirm(gettext("Delete Row(s)"), + gettext("Are you sure you wish to delete selected row(s)?"), function() { $("#btn-delete-row").prop('disabled', true); $("#btn-copy-row").prop('disabled', true); @@ -2439,7 +2437,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Saving the updated data...') }}" + gettext("Saving the updated data...") ); // Add the columns to the data so the server can remap the data @@ -2517,7 +2515,7 @@ define( // Something went wrong while saving data on the db server $("#btn-flash").prop('disabled', false); $('.sql-editor-message').text(res.data.result); - var err_msg = S("{{ _('%s.') }}").sprintf(res.data.result).value(); + var err_msg = S(gettext("%s.")).sprintf(res.data.result).value(); alertify.notify(err_msg, 'error', 20); // To highlight the row at fault @@ -2554,7 +2552,7 @@ define( error: function(e) { if (e.readyState == 0) { self.update_msg_history(false, - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -2630,8 +2628,8 @@ define( * confirm with the user for unsaved changes. */ if (self.is_query_changed) { - alertify.confirm("{{ _('Unsaved changes') }}", - "{{ _('Are you sure you wish to discard the current changes?') }}", + alertify.confirm(gettext("Unsaved changes"), + gettext("Are you sure you wish to discard the current changes?"), function() { // User do not want to save, just continue self._open_select_file_manager(); @@ -2665,7 +2663,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Loading the file...') }}" + gettext("Loading the file...") ); // set cursor to progress before file load var $busy_icon_div = $('.sql-editor-busy-fetching'); @@ -2713,7 +2711,7 @@ define( } self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Saving the queries in the file...') }}" + gettext("Saving the queries in the file...") ); // Make ajax call to save the data to file @@ -2724,7 +2722,7 @@ define( data: JSON.stringify(data), success: function(res) { if (res.data.status) { - alertify.success("{{ _('File saved successfully.') }}"); + alertify.success(gettext("File saved successfully.")); self.gridView.current_file = e; self.setTitle(self.gridView.current_file.replace(/^.*[\\\/]/g, '')); // disable save button on file save @@ -2835,7 +2833,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Loading the existing filter options...') }}" + gettext("Loading the existing filter options...") ); $.ajax({ url: "{{ url_for('sqleditor.index') }}" + "filter/get/" + self.transId, @@ -2865,7 +2863,7 @@ define( var msg; if (e.readyState == 0) { msg = - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") } else { msg = e.responseText; if (e.responseJSON != undefined && @@ -2905,7 +2903,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Applying the new filter...') }}" + gettext("Applying the new filter...") ); // Make ajax call to include the filter by selection @@ -2934,7 +2932,7 @@ define( function() { if (e.readyState == 0) { alertify.alert('Filter By Selection Error', - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -2975,7 +2973,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Applying the new filter...') }}" + gettext("Applying the new filter...") ); // Make ajax call to exclude the filter by selection. @@ -3005,7 +3003,7 @@ define( function() { if (e.readyState == 0) { alertify.alert('Filter Exclude Selection Error', - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -3028,7 +3026,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Removing the filter...') }}" + gettext("Removing the filter...") ); // Make ajax call to exclude the filter by selection. @@ -3055,7 +3053,7 @@ define( function() { if (e.readyState == 0) { alertify.alert('Remove Filter Error', - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -3079,7 +3077,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Applying the filter...') }}" + gettext("Applying the filter...") ); // Make ajax call to include the filter by selection @@ -3110,7 +3108,7 @@ define( function() { if (e.readyState == 0) { alertify.alert('Apply Filter Error', - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -3203,7 +3201,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Setting the limit on the result...') }}" + gettext("Setting the limit on the result...") ); // Make ajax call to change the limit $.ajax({ @@ -3230,7 +3228,7 @@ define( function() { if (e.readyState == 0) { alertify.alert('Change limit Error', - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -3277,7 +3275,7 @@ define( self.trigger( 'pgadmin-sqleditor:loading-icon:show', - "{{ _('Initializing the query execution!') }}" + gettext("Initializing the query execution!") ); $("#btn-flash").prop('disabled', true); @@ -3313,7 +3311,7 @@ define( if (res.data.status) { self.trigger( 'pgadmin-sqleditor:loading-icon:message', - "{{ _('Waiting for the query execution to complete...') }}" + gettext("Waiting for the query execution to complete...") ); self.can_edit = res.data.can_edit; @@ -3340,7 +3338,7 @@ define( if (e.readyState == 0) { self.update_msg_history(false, - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -3438,7 +3436,7 @@ define( if (e.readyState == 0) { alertify.alert('Cancel Query Error', - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -3483,24 +3481,24 @@ define( error: function(e) { if (e.readyState == 0) { alertify.alert('Get Object Name Error', - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } var msg = e.responseText; if (e.responseJSON != undefined && - e.responseJSON.errormsg != undefined) + e.responseJSON.errormsg != undefined) msg = e.responseJSON.errormsg; alertify.alert('Get Object Name Error', msg); } }); - } else { + } else { var cur_time = new Date(); var filename = 'data-' + cur_time.getTime() + '.csv'; self._trigger_csv_download(sql, filename); - } + } }, // Trigger query result download to csv. _trigger_csv_download: function(query, filename) { @@ -3536,7 +3534,7 @@ define( error: function(e) { if (e.readyState == 0) { alertify.alert('Auto Rollback Error', - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -3575,7 +3573,7 @@ define( error: function(e) { if (e.readyState == 0) { alertify.alert('Auto Commit Error', - "{{ _('Not connected to the server or the connection to the server has been closed.') }}" + gettext("Not connected to the server or the connection to the server has been closed.") ); return; } @@ -3640,13 +3638,13 @@ define( success: function(res) { if(res.success == undefined || !res.success) { alertify.alert('Explain options error', - "{{ _('Error occurred while setting verbose option in explain') }}" + gettext("Error occurred while setting verbose option in explain") ); } }, error: function(e) { alertify.alert('Explain options error', - "{{ _('Error occurred while setting verbose option in explain') }}" + gettext("Error occurred while setting verbose option in explain") ); return; } @@ -3678,13 +3676,13 @@ define( success: function(res) { if(res.success == undefined || !res.success) { alertify.alert('Explain options error', - "{{ _('Error occurred while setting costs option in explain') }}" + gettext("Error occurred while setting costs option in explain") ); } }, error: function(e) { alertify.alert('Explain options error', - "{{ _('Error occurred while setting costs option in explain') }}" + gettext("Error occurred while setting costs option in explain") ); } }); @@ -3715,13 +3713,13 @@ define( success: function(res) { if(res.success == undefined || !res.success) { alertify.alert('Explain options error', - "{{ _('Error occurred while setting buffers option in explain') }}" + gettext("Error occurred while setting buffers option in explain") ); } }, error: function(e) { alertify.alert('Explain options error', - "{{ _('Error occurred while setting buffers option in explain') }}" + gettext("Error occurred while setting buffers option in explain") ); } }); @@ -3751,13 +3749,13 @@ define( success: function(res) { if(res.success == undefined || !res.success) { alertify.alert('Explain options error', - "{{ _('Error occurred while setting timing option in explain') }}" + gettext("Error occurred while setting timing option in explain") ); } }, error: function(e) { alertify.alert('Explain options error', - "{{ _('Error occurred while setting timing option in explain') }}" + gettext("Error occurred while setting timing option in explain") ); } }); @@ -3835,7 +3833,7 @@ define( error: function(e) { updateUI(); alertify.alert('Get Preferences error', - "{{ _('Error occurred while getting query tool options ') }}" + gettext("Error occurred while getting query tool options ") ); } }); diff --git a/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js b/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js index c8c91c70a..fbd5e1711 100644 --- a/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js +++ b/web/pgadmin/tools/user_management/templates/user_management/js/user_management.js @@ -1,11 +1,11 @@ +// Backup dialog define([ - 'jquery', 'underscore', 'underscore.string', 'alertify', - 'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node', - 'backgrid.select.all', 'backgrid.filter' - ], - - // This defines Backup dialog - function($, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode) { + 'sources/gettext', 'jquery', 'underscore', 'underscore.string', 'alertify', + 'pgadmin.browser', 'backbone', 'backgrid', 'backform', 'pgadmin.browser.node', + 'backgrid.select.all', 'backgrid.filter' +], function( + gettext, $, _, S, alertify, pgBrowser, Backbone, Backgrid, Backform, pgNode +) { // if module is already initialized, refer to that. if (pgBrowser.UserManagement) { @@ -83,7 +83,7 @@ define([ }, schema: [ { - id: 'email', label: '{{ _('Email') }}', type: 'text', + id: 'email', label: gettext('Email'), type: 'text', cell:StringDepCell, cellHeaderClasses:'width_percent_30', deps: ['id'], editable: function(m) { @@ -97,7 +97,7 @@ define([ return false; } },{ - id: 'role', label: '{{ _('Role') }}', + id: 'role', label: gettext('Role'), type: 'text', control: "Select2", cellHeaderClasses:'width_percent_20', cell: 'select2', select2: {allowClear: false, openOnEnter: false}, options: function (controlOrCell) { @@ -131,7 +131,7 @@ define([ } } },{ - id: 'active', label: '{{ _('Active') }}', + id: 'active', label: gettext('Active'), type: 'switch', cell: 'switch', cellHeaderClasses:'width_percent_10', options: { 'onText': 'Yes', 'offText': 'No'}, editable: function(m) { @@ -145,11 +145,11 @@ define([ } } },{ - id: 'newPassword', label: '{{ _('New password') }}', + id: 'newPassword', label: gettext('New password'), type: 'password', disabled: false, control: 'input', cell: 'password', cellHeaderClasses:'width_percent_20' },{ - id: 'confirmPassword', label: '{{ _('Confirm password') }}', + id: 'confirmPassword', label: gettext('Confirm password'), type: 'password', disabled: false, control: 'input', cell: 'password', cellHeaderClasses:'width_percent_20' }], @@ -162,19 +162,19 @@ define([ if (('email' in changedAttrs || !this.isNew()) && (_.isUndefined(this.get('email')) || _.isNull(this.get('email')) || String(this.get('email')).replace(/^\s+|\s+$/g, '') == '')) { - errmsg = '{{ _('Email address cannot be empty.')}}'; + errmsg = gettext('Email address cannot be empty.'); this.errorModel.set('email', errmsg); return errmsg; } else if (!!this.get('email') && !email_filter.test(this.get('email'))) { - errmsg = S("{{ _("Invalid email address: %s.")}}").sprintf( + errmsg = S(gettext("Invalid email address: %s.")).sprintf( this.get('email') ).value(); this.errorModel.set('email', errmsg); return errmsg; } else if (!!this.get('email') && this.collection.where({"email":this.get('email')}).length > 1) { - errmsg = S("{{ _("The email address %s already exists.")}}").sprintf( + errmsg = S(gettext("The email address %s already exists.")).sprintf( this.get('email') ).value(); @@ -188,7 +188,7 @@ define([ _.isNull(this.get('role')) || String(this.get('role')).replace(/^\s+|\s+$/g, '') == '')) { - errmsg = S("{{ _("Role cannot be empty for user %s.")}}").sprintf( + errmsg = S(gettext("Role cannot be empty for user %s.")).sprintf( (this.get('email') || '') ).value(); @@ -204,7 +204,7 @@ define([ _.isNull(this.get('newPassword')) || this.get('newPassword') == '')) { - errmsg = S("{{ _("Password cannot be empty for user %s.")}}").sprintf( + errmsg = S(gettext("Password cannot be empty for user %s.")).sprintf( (this.get('email') || '') ).value(); @@ -214,7 +214,7 @@ define([ !_.isNull(this.get('newPassword')) && this.get('newPassword').length < 6) { - errmsg = S("{{ _("Password must be at least 6 characters for user %s.")}}").sprintf( + errmsg = S(gettext("Password must be at least 6 characters for user %s.")).sprintf( (this.get('email') || '') ).value(); @@ -228,7 +228,7 @@ define([ _.isNull(this.get('confirmPassword')) || this.get('confirmPassword') == '')) { - errmsg = S("{{ _("Confirm Password cannot be empty for user %s.")}}").sprintf( + errmsg = S(gettext("Confirm Password cannot be empty for user %s.")).sprintf( (this.get('email') || '') ).value(); @@ -241,7 +241,7 @@ define([ if(!!this.get('newPassword') && !!this.get('confirmPassword') && this.get('newPassword') != this.get('confirmPassword')) { - errmsg = S("{{ _("Passwords do not match for user %s.")}}").sprintf( + errmsg = S(gettext("Passwords do not match for user %s.")).sprintf( (this.get('email') || '') ).value(); @@ -271,7 +271,7 @@ define([ !this.get('newPassword') == '' && this.get('newPassword').length < 6) { - errmsg = S("{{ _("Password must be at least 6 characters for user %s.")}}").sprintf( + errmsg = S(gettext("Password must be at least 6 characters for user %s.")).sprintf( (this.get('email') || '') ).value(); @@ -281,7 +281,7 @@ define([ _.isNull(this.get('confirmPassword')) || this.get('confirmPassword') == '') { - errmsg = S("{{ _("Confirm Password cannot be empty for user %s.")}}").sprintf( + errmsg = S(gettext("Confirm Password cannot be empty for user %s.")).sprintf( (this.get('email') || '') ).value(); @@ -290,7 +290,7 @@ define([ } else if (!!this.get('newPassword') && !!this.get('confirmPassword') && this.get('newPassword') != this.get('confirmPassword')) { - errmsg = S("{{ _("Passwords do not match for user %s.")}}").sprintf( + errmsg = S(gettext("Passwords do not match for user %s.")).sprintf( (this.get('email') || '') ).value(); @@ -313,8 +313,8 @@ define([ if (self.model.get("id") == {{user_id}}) { alertify.alert( - '{{_('Cannot delete user.') }}', - '{{_('Cannot delete currently logged in user.') }}', + gettext('Cannot delete user.'), + gettext('Cannot delete currently logged in user.'), function(){ return true; } @@ -338,10 +338,10 @@ define([ self.model.destroy({ wait: true, success: function(res) { - alertify.success('{{_('User deleted.') }}'); + alertify.success(gettext('User deleted.')); }, error: function(m, jqxhr) { - alertify.error('{{_('Error during deleting user.') }}'); + alertify.error(gettext('Error during deleting user.')); } }); }, @@ -381,15 +381,15 @@ define([ return { buttons: [{ text: '', key: 27, className: 'btn btn-default pull-left fa fa-lg fa-question', - attrs:{name:'dialog_help', type:'button', label: '{{ _('Users') }}', + attrs:{name:'dialog_help', type:'button', label: gettext('Users'), url: '{{ url_for('help.static', filename='pgadmin_user.html') }}'} },{ - text: '{{ _('Close') }}', key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button user_management_pg-alertify-button', + text: gettext('Close'), key: 27, className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button user_management_pg-alertify-button', attrs:{name:'close', type:'button'} }], // Set options for dialog options: { - title: '{{ _('User Management') }}', + title: gettext('User Management'), //disable both padding and overflow control. padding : !1, overflow: !1, @@ -513,14 +513,14 @@ define([ 'confirmPassword':undefined}); m.startNewSession(); - alertify.success(S("{{_("User '%s' saved.")|safe }}").sprintf( + alertify.success(S(gettext("User '%s' saved.")).sprintf( m.get('email') ).value()); }, error: function(res, jqxhr) { m.startNewSession(); alertify.error( - S("{{_("Error saving user: '%s'")|safe }}").sprintf( + S(gettext("Error saving user: '%s'")).sprintf( jqxhr.responseJSON.errormsg ).value() ); @@ -538,7 +538,7 @@ define([ headerTpl = _.template(header), data = { canAdd: true, - add_title: '{{ _("Add new user") }}' + add_title: gettext('Add new user') }, $gridBody = $("
", { class: "user_container" @@ -553,9 +553,7 @@ define([ }, error: function(e) { setTimeout(function() { - alertify.alert( - '{{ _('Cannot load user roles.') }}' - ); + alertify.alert(gettext('Cannot load user roles.')); },100); } }); @@ -638,8 +636,8 @@ define([ if (!_.all(this.userCollection.pluck('id')) || !_.isEmpty(this.userCollection.invalidUsers)) { e.cancel = true; alertify.confirm( - '{{ _('Discard unsaved changes?') }}', - '{{ _('Are you sure you want to close the dialog? Any unsaved changes will be lost.') }}', + gettext('Discard unsaved changes?'), + gettext('Are you sure you want to close the dialog? Any unsaved changes will be lost.'), function(e) { self.close(); return true;