mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added and fixed gettext usage for better translation coverage. Fixes #5284
1) Fixed usage gettext('') instead of _('') in javascript files. 2) Fixed usage gettext('') instead of `${gettext('')}` in javascript files, because "pybabel extract" not support extracting from this syntax.
This commit is contained in:
@@ -98,7 +98,7 @@ export class BackupDialogWrapper extends DialogWrapper {
|
||||
|
||||
const node = this.pgBrowser.Nodes[selectedTreeNodeData._type];
|
||||
if (this.dialogTitle === null) {
|
||||
const title = `Backup (${node.label}: ${selectedTreeNodeData.label})`;
|
||||
let title = gettext('Backup (%s: %s)', node.label, selectedTreeNodeData.label);
|
||||
this.main(title);
|
||||
}
|
||||
|
||||
|
@@ -1047,7 +1047,7 @@ define([
|
||||
|
||||
// Initialize a new Grid instance
|
||||
var stack_grid = this.stack_grid = new Backgrid.Grid({
|
||||
emptyText: 'No data found',
|
||||
emptyText: gettext('No data found'),
|
||||
columns: stackGridCols,
|
||||
row: Backgrid.Row.extend({
|
||||
events: {
|
||||
@@ -1112,7 +1112,7 @@ define([
|
||||
|
||||
// Initialize a new Grid instance
|
||||
var result_grid = this.result_grid = new Backgrid.Grid({
|
||||
emptyText: 'No data found',
|
||||
emptyText: gettext('No data found'),
|
||||
columns: resultGridCols,
|
||||
collection: new ResultsCollection(result),
|
||||
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
|
||||
@@ -1190,7 +1190,7 @@ define([
|
||||
|
||||
// Initialize a new Grid instance
|
||||
var variable_grid = this.variable_grid = new Backgrid.Grid({
|
||||
emptyText: 'No data found',
|
||||
emptyText: gettext('No data found'),
|
||||
columns: gridCols,
|
||||
collection: new VariablesCollection(my_obj),
|
||||
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
|
||||
@@ -1276,7 +1276,7 @@ define([
|
||||
|
||||
// Initialize a new Grid instance
|
||||
var param_grid = this.param_grid = new Backgrid.Grid({
|
||||
emptyText: 'No data found',
|
||||
emptyText: gettext('No data found'),
|
||||
columns: paramGridCols,
|
||||
collection: new ParametersCollection(param_obj),
|
||||
className: 'backgrid table table-bordered table-noouter-border table-bottom-border',
|
||||
|
@@ -251,7 +251,7 @@ define([
|
||||
DbObjectFilter: function(coll) {
|
||||
var clientSideFilter = this.clientSideFilter = new Backgrid.Extension.ClientSideFilter({
|
||||
collection: coll,
|
||||
placeholder: _('Search by object type or name'),
|
||||
placeholder: gettext('Search by object type or name'),
|
||||
|
||||
// The model fields to search for matches
|
||||
fields: ['object_type', 'name'],
|
||||
@@ -697,11 +697,11 @@ define([
|
||||
*/
|
||||
var dbObjectTypePage = self.dbObjectTypePage = new pgBrowser.WizardPage({
|
||||
id: 1,
|
||||
page_title: _('Object Selection (step 1 of 3)'),
|
||||
page_title: gettext('Object Selection (step 1 of 3)'),
|
||||
disable_prev: true,
|
||||
disable_next: true,
|
||||
show_description: '',
|
||||
show_progress_bar: _('Please wait while fetching records...'),
|
||||
show_progress_bar: gettext('Please wait while fetching records...'),
|
||||
model: newModel,
|
||||
view: new(function() {
|
||||
|
||||
@@ -735,13 +735,13 @@ define([
|
||||
$(`
|
||||
<div class="db_objects_container pg-el-xs-12">
|
||||
<div class="db_objects_header d-flex py-1">
|
||||
<div>${_('Please select the objects to grant privileges to from the list below.')}</div>
|
||||
<div>` + gettext('Please select the objects to grant privileges to from the list below.') + `</div>
|
||||
<div class="db_objects_filter ml-auto">
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text fa fa-search" id="labelSearch"></span>
|
||||
</div>
|
||||
<input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch">
|
||||
<input type="search" class="form-control" id="txtGridSearch" placeholder="` + gettext('Search') + `" aria-label="Search" aria-describedby="labelSearch">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -822,8 +822,8 @@ define([
|
||||
// Wizard for Privelege control
|
||||
var privilegePage = self.privilegePage = new pgBrowser.WizardPage({
|
||||
id: 2,
|
||||
page_title: _('Privilege Selection (step 2 of 3)'),
|
||||
show_description: _('Please add the required privileges for the selected objects.'),
|
||||
page_title: gettext('Privilege Selection (step 2 of 3)'),
|
||||
show_description: gettext('Please add the required privileges for the selected objects.'),
|
||||
disable_next: true,
|
||||
model: newModel,
|
||||
|
||||
@@ -1021,7 +1021,7 @@ define([
|
||||
//Create SqlField Object
|
||||
var sqlField = new Backform.Field({
|
||||
id: 'sqltab',
|
||||
label: _('Sql Tab'),
|
||||
label: gettext('Sql Tab'),
|
||||
|
||||
/**
|
||||
Extend 'SqlTabControl' to define new
|
||||
@@ -1091,8 +1091,8 @@ define([
|
||||
// Wizard for SQL tab control
|
||||
var reviewSQLPage = self.reviewSQLPage = new pgBrowser.WizardPage({
|
||||
id: 3,
|
||||
page_title: _('Final (Review Selection) (step 3 of 3)'),
|
||||
show_description: _('The SQL below will be executed on the ' +
|
||||
page_title: gettext('Final (Review Selection) (step 3 of 3)'),
|
||||
show_description: gettext('The SQL below will be executed on the ' +
|
||||
'database server to grant the selected privileges. ' +
|
||||
'Please click on <b>Finish</b> to complete the process.'),
|
||||
model: newModel,
|
||||
@@ -1151,7 +1151,7 @@ define([
|
||||
*/
|
||||
self.wizard = new(pgBrowser.Wizard.extend({
|
||||
options: {
|
||||
title: _('Grant Wizard'),
|
||||
title: gettext('Grant Wizard'),
|
||||
/* Main Wizard Title */
|
||||
width: '',
|
||||
height: '',
|
||||
|
@@ -266,7 +266,7 @@ def create_maintenance_job(sid, did):
|
||||
# Return response
|
||||
return make_json_response(
|
||||
data={'job_id': jid, 'status': True,
|
||||
'info': 'Maintenance job created.'}
|
||||
'info': _('Maintenance job created.')}
|
||||
)
|
||||
|
||||
|
||||
|
@@ -36,7 +36,7 @@ class SchemaDiffModule(PgAdminModule):
|
||||
A module class for Schema Diff derived from PgAdminModule.
|
||||
"""
|
||||
|
||||
LABEL = "Schema Diff"
|
||||
LABEL = gettext("Schema Diff")
|
||||
|
||||
def get_own_menuitems(self):
|
||||
return {}
|
||||
@@ -439,7 +439,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
|
||||
|
||||
comparison_result = []
|
||||
|
||||
diff_model_obj.set_comparison_info("Comparing objects...", 0)
|
||||
diff_model_obj.set_comparison_info(gettext("Comparing objects..."), 0)
|
||||
update_session_diff_transaction(trans_id, session_obj,
|
||||
diff_model_obj)
|
||||
|
||||
@@ -451,7 +451,8 @@ def compare(trans_id, source_sid, source_did, source_scid,
|
||||
for node_name, node_view in all_registered_nodes.items():
|
||||
view = SchemaDiffRegistry.get_node_view(node_name)
|
||||
if hasattr(view, 'compare'):
|
||||
msg = "Comparing " + view.blueprint.COLLECTION_LABEL
|
||||
msg = gettext('Comparing {0}').\
|
||||
format(gettext(view.blueprint.COLLECTION_LABEL))
|
||||
diff_model_obj.set_comparison_info(msg, total_percent)
|
||||
# Update the message and total percentage in session object
|
||||
update_session_diff_transaction(trans_id, session_obj,
|
||||
@@ -468,7 +469,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
|
||||
comparison_result = comparison_result + res
|
||||
total_percent = total_percent + node_percent
|
||||
|
||||
msg = "Successfully compare the specified schemas."
|
||||
msg = gettext("Successfully compare the specified schemas.")
|
||||
total_percent = 100
|
||||
diff_model_obj.set_comparison_info(msg, total_percent)
|
||||
# Update the message and total percentage done in session object
|
||||
@@ -501,7 +502,7 @@ def poll(trans_id):
|
||||
msg, diff_percentage = diff_model_obj.get_comparison_info()
|
||||
|
||||
if diff_percentage == 100:
|
||||
diff_model_obj.set_comparison_info("Comparing objects...", 0)
|
||||
diff_model_obj.set_comparison_info(gettext("Comparing objects..."), 0)
|
||||
update_session_diff_transaction(trans_id, session_obj,
|
||||
diff_model_obj)
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
import copy
|
||||
|
||||
from flask import render_template
|
||||
from flask_babelex import gettext
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.utils.ajax import internal_server_error
|
||||
@@ -86,7 +87,7 @@ class SchemaDiffObjectCompare:
|
||||
return compare_dictionaries(self, source_params, target_params,
|
||||
target_schema, source, target,
|
||||
self.node_type,
|
||||
self.blueprint.COLLECTION_LABEL,
|
||||
gettext(self.blueprint.COLLECTION_LABEL),
|
||||
self.keys_to_ignore)
|
||||
|
||||
def ddl_compare(self, **kwargs):
|
||||
|
@@ -7,6 +7,8 @@
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
from flask_babelex import gettext
|
||||
|
||||
|
||||
class SchemaDiffModel(object):
|
||||
"""
|
||||
@@ -30,7 +32,7 @@ class SchemaDiffModel(object):
|
||||
**kwargs : N number of parameters
|
||||
"""
|
||||
self._comparison_result = dict()
|
||||
self._comparison_msg = 'Comparision started...'
|
||||
self._comparison_msg = gettext('Comparision started...')
|
||||
self._comparison_percentage = 0
|
||||
|
||||
def clear_data(self):
|
||||
|
@@ -289,11 +289,11 @@ let SchemaDiffHeaderView = Backform.Form.extend({
|
||||
},
|
||||
template: _.template(`
|
||||
<div class="row pgadmin-control-group">
|
||||
<div class="col-1 control-label">Select Source</div>
|
||||
<div class="col-1 control-label">` + gettext('Select Source') + `</div>
|
||||
<div class="col-6 source row"></div>
|
||||
</div>
|
||||
<div class="row pgadmin-control-group">
|
||||
<div class="col-1 control-label">Select Target</div>
|
||||
<div class="col-1 control-label">` + gettext('Select Target') + `</div>
|
||||
<div class="col-6 target row"></div>
|
||||
<div class="col-5 target-buttons">
|
||||
<div class="action-btns d-flex">
|
||||
@@ -421,9 +421,9 @@ let SchemaDiffFooterView = Backform.Form.extend({
|
||||
template: {
|
||||
'content': _.template(`
|
||||
<div class="pg-el-sm-12 row <%=contentClass%>">
|
||||
<div class="pg-el-sm-4 ddl-source">Source</div>
|
||||
<div class="pg-el-sm-4 ddl-target">Target</div>
|
||||
<div class="pg-el-sm-4 ddl-diff">Difference
|
||||
<div class="pg-el-sm-4 ddl-source">` + gettext('Source') + `</div>
|
||||
<div class="pg-el-sm-4 ddl-target">` + gettext('Target') + `</div>
|
||||
<div class="pg-el-sm-4 ddl-diff">` + gettext('Difference') + `
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -85,7 +85,7 @@ define('pgadmin.schemadiff', [
|
||||
})
|
||||
.done(function(res) {
|
||||
self.trans_id = res.data.schemaDiffTransId;
|
||||
res.data.panel_title = 'Schema Diff (Beta)'; //TODO: Set the panel title
|
||||
res.data.panel_title = gettext('Schema Diff (Beta)'); //TODO: Set the panel title
|
||||
// TODO: Following function is used to test the fetching of the
|
||||
// databases this should be moved to server selection event later.
|
||||
self.launch_schema_diff(res.data);
|
||||
|
@@ -302,11 +302,11 @@ export default class SchemaDiffUI {
|
||||
var grid_width = (self.grid_width - 47) / 2 ;
|
||||
var columns = [
|
||||
checkboxSelector.getColumnDefinition(),
|
||||
{id: 'title', name: 'Schema Objects', field: 'title', minWidth: grid_width, formatter: formatColumnTitle},
|
||||
{id: 'status', name: 'Comparison Result', field: 'status', minWidth: grid_width},
|
||||
{id: 'label', name: 'Schema Objects', field: 'label', width: 0, minWidth: 0, maxWidth: 0,
|
||||
{id: 'title', name: gettext('Schema Objects'), field: 'title', minWidth: grid_width, formatter: formatColumnTitle},
|
||||
{id: 'status', name: gettext('Comparison Result'), field: 'status', minWidth: grid_width},
|
||||
{id: 'label', name: gettext('Schema Objects'), field: 'label', width: 0, minWidth: 0, maxWidth: 0,
|
||||
cssClass: 'really-hidden', headerCssClass: 'really-hidden'},
|
||||
{id: 'type', name: 'Schema Objects', field: 'type', width: 0, minWidth: 0, maxWidth: 0,
|
||||
{id: 'type', name: gettext('Schema Objects'), field: 'type', width: 0, minWidth: 0, maxWidth: 0,
|
||||
cssClass: 'really-hidden', headerCssClass: 'really-hidden'},
|
||||
{id: 'id', name: 'id', field: 'id', width: 0, minWidth: 0, maxWidth: 0,
|
||||
cssClass: 'really-hidden', headerCssClass: 'really-hidden' },
|
||||
@@ -462,10 +462,10 @@ export default class SchemaDiffUI {
|
||||
.done(function (res) {
|
||||
let msg = res.data.compare_msg;
|
||||
if (res.data.diff_percentage != 100) {
|
||||
msg = msg + ' (this may take a few minutes)...';
|
||||
msg = msg + gettext(' (this may take a few minutes)...');
|
||||
}
|
||||
|
||||
msg = msg + '<br>'+ res.data.diff_percentage + '% completed.';
|
||||
msg = msg + '<br>' + gettext('%s completed.', res.data.diff_percentage + '%');
|
||||
$('#diff_fetching_data').find('.schema-diff-busy-text').html(msg);
|
||||
})
|
||||
.fail(function (xhr) {
|
||||
|
@@ -2237,7 +2237,7 @@ define('tools.querytool', [
|
||||
|
||||
self.trigger('pgadmin-sqleditor:loading-icon:hide');
|
||||
|
||||
self.gridView.set_editor_title(`(${gettext('Obtaining connection...')} ${_.unescape(url_params.title)}`);
|
||||
self.gridView.set_editor_title('(' + gettext('Obtaining connection...') + ` ${_.unescape(url_params.title)}`);
|
||||
|
||||
let afterConn = function() {
|
||||
let enableBtns = [];
|
||||
|
@@ -212,9 +212,9 @@ def RegisterQueryToolPreferences(self):
|
||||
'CSV_output', 'csv_quoting',
|
||||
gettext("CSV quoting"), 'options', 'strings',
|
||||
category_label=gettext('CSV Output'),
|
||||
options=[{'label': 'None', 'value': 'none'},
|
||||
{'label': 'All', 'value': 'all'},
|
||||
{'label': 'Strings', 'value': 'strings'}],
|
||||
options=[{'label': gettext('None'), 'value': 'none'},
|
||||
{'label': gettext('All'), 'value': 'all'},
|
||||
{'label': gettext('Strings'), 'value': 'strings'}],
|
||||
select2={
|
||||
'allowClear': False,
|
||||
'tags': False
|
||||
@@ -240,7 +240,7 @@ def RegisterQueryToolPreferences(self):
|
||||
options=[{'label': ';', 'value': ';'},
|
||||
{'label': ',', 'value': ','},
|
||||
{'label': '|', 'value': '|'},
|
||||
{'label': 'Tab', 'value': '\t'}],
|
||||
{'label': gettext('Tab'), 'value': '\t'}],
|
||||
select2={
|
||||
'allowClear': False,
|
||||
'tags': True
|
||||
@@ -262,9 +262,9 @@ def RegisterQueryToolPreferences(self):
|
||||
'Results_grid', 'results_grid_quoting',
|
||||
gettext("Result copy quoting"), 'options', 'strings',
|
||||
category_label=gettext('Results grid'),
|
||||
options=[{'label': 'None', 'value': 'none'},
|
||||
{'label': 'All', 'value': 'all'},
|
||||
{'label': 'Strings', 'value': 'strings'}],
|
||||
options=[{'label': gettext('None'), 'value': 'none'},
|
||||
{'label': gettext('All'), 'value': 'all'},
|
||||
{'label': gettext('Strings'), 'value': 'strings'}],
|
||||
select2={
|
||||
'allowClear': False,
|
||||
'tags': False
|
||||
@@ -290,7 +290,7 @@ def RegisterQueryToolPreferences(self):
|
||||
options=[{'label': ';', 'value': ';'},
|
||||
{'label': ',', 'value': ','},
|
||||
{'label': '|', 'value': '|'},
|
||||
{'label': 'Tab', 'value': '\t'}],
|
||||
{'label': gettext('Tab'), 'value': '\t'}],
|
||||
select2={
|
||||
'allowClear': False,
|
||||
'tags': True
|
||||
|
@@ -27,7 +27,7 @@ define([
|
||||
userFilter = function(collection) {
|
||||
return (new Backgrid.Extension.ClientSideFilter({
|
||||
collection: collection,
|
||||
placeholder: _('Filter by email'),
|
||||
placeholder: gettext('Filter by email'),
|
||||
// How long to wait after typing has stopped before searching can start
|
||||
wait: 150,
|
||||
}));
|
||||
@@ -763,7 +763,7 @@ define([
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text fa fa-search" id="labelSearch"></span>
|
||||
</div>
|
||||
<input type="search" class="form-control" id="txtGridSearch" placeholder="Search" aria-label="Search" aria-describedby="labelSearch" />
|
||||
<input type="search" class="form-control" id="txtGridSearch" placeholder="` + gettext('Search') + `" aria-label="Search" aria-describedby="labelSearch" />
|
||||
</div>
|
||||
<button id="btn_refresh" type="button" class="btn btn-secondary btn-navtab-inline add" title="Add">
|
||||
<span class="fa fa-plus "></span>
|
||||
|
Reference in New Issue
Block a user