fix: Make strings translatable (#13046)

Co-authored-by: Mohammad Hasnain Mohsin Rajan <hasnain2808@gmail.com>
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
(cherry picked from commit b0af8886d5)
This commit is contained in:
Ernesto Ruiz 2021-05-02 22:04:16 -06:00 committed by mergify-bot
parent 9ba9c4c604
commit 8fdb69cc75
11 changed files with 67 additions and 67 deletions

View file

@ -1,7 +1,7 @@
frappe.pages['recorder'].on_page_load = function(wrapper) {
frappe.ui.make_app_page({
parent: wrapper,
title: 'Recorder',
title: __('Recorder'),
single_column: true,
card_layout: true
});

View file

@ -1,7 +1,7 @@
frappe.pages['backups'].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: 'Download Backups',
title: __('Download Backups'),
single_column: true
});

View file

@ -1,7 +1,7 @@
frappe.pages['translation-tool'].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: 'Translation Tool',
title: __('Translation Tool'),
single_column: true,
card_layout: true,
});

View file

@ -8,7 +8,7 @@
</div>
<div class="chart-wrapper performance-heatmap">
<div class="null-state">
<span>No Data to Show</span>
<span>{%=__("No Data to Show") %}</span>
</div>
</div>
</div>
@ -19,7 +19,7 @@
</div>
<div class="chart-wrapper performance-percentage-chart">
<div class="null-state">
<span>No Data to Show</span>
<span>{%=__("No Data to Show") %}</span>
</div>
</div>
</div>
@ -30,7 +30,7 @@
</div>
<div class="chart-wrapper performance-line-chart">
<div class="null-state">
<span>No Data to Show</span>
<span>{%=__("No Data to Show") %}</span>
</div>
</div>
</div>
@ -41,4 +41,4 @@
<div class="recent-activity-footer"></div>
</div>
</div>
</div>
</div>

View file

@ -32,7 +32,7 @@ frappe.ui.form.Toolbar = class Toolbar {
}
set_title() {
if (this.frm.is_new()) {
var title = __('New {0}', [this.frm.meta.name]);
var title = __('New {0}', [__(this.frm.meta.name)]);
} else if (this.frm.meta.title_field) {
let title_field = (this.frm.doc[this.frm.meta.title_field] || "").toString().trim();
var title = strip_html(title_field || this.frm.docname);
@ -551,7 +551,7 @@ frappe.ui.form.Toolbar = class Toolbar {
let fields = this.frm.fields
.filter(visible_fields_filter)
.map(f => ({ label: f.df.label, value: f.df.fieldname }));
.map(f => ({ label: __(f.df.label), value: f.df.fieldname }));
let dialog = new frappe.ui.Dialog({
title: __('Jump to field'),

View file

@ -150,13 +150,13 @@ frappe.views.ListViewSelect = class ListViewSelect {
const views_wrapper = this.sidebar.sidebar.find(".views-section");
views_wrapper.find(".sidebar-label").html(`${__(view)}`);
const $dropdown = views_wrapper.find(".views-dropdown");
let placeholder = `Select ${view}`;
let placeholder = `${__("Select {0}", [__(view)])}`;
let html = ``;
if (!items || !items.length) {
html = `<div class="empty-state">
${__("No {} Found", [view])}
${__("No {0} Found", [__(view)])}
</div>`;
} else {
const page_name = this.get_page_name();

View file

@ -5,7 +5,7 @@
<div class="tag-filters-area">
<div class="active-tag-filters">
<button class="btn btn-default btn-xs add-filter text-muted">
Add Filter
{{ __("Add Filter") }}
</button>
</div>
</div>
@ -71,12 +71,12 @@
</div>
<div v-if="requests.length == 0" class="no-result text-muted flex justify-center align-center" style="">
<div class="msg-box no-border" v-if="status.status == 'Inactive'" >
<p>Recorder is Inactive</p>
<p><button class="btn btn-primary btn-sm btn-new-doc" @click="start()">Start Recording</button></p>
<p>{{ __("Recorder is Inactive") }}</p>
<p><button class="btn btn-primary btn-sm btn-new-doc" @click="start()">{{ __("Start Recording") }}</button></p>
</div>
<div class="msg-box no-border" v-if="status.status == 'Active'" >
<p>No Requests found</p>
<p>Go make some noise</p>
<p>{{ __("No Requests found") }}</p>
<p>{{ __("Go make some noise") }}</p>
</div>
</div>
<div v-if="requests.length != 0" class="list-paging-area">
@ -108,12 +108,12 @@ export default {
return {
requests: [],
columns: [
{label: "Path", slug: "path"},
{label: "Duration (ms)", slug: "duration", sortable: true, number: true},
{label: "Time in Queries (ms)", slug: "time_queries", sortable: true, number: true},
{label: "Queries", slug: "queries", sortable: true, number: true},
{label: "Method", slug: "method"},
{label: "Time", slug: "time", sortable: true},
{label: __("Path"), slug: "path"},
{label: __("Duration (ms)"), slug: "duration", sortable: true, number: true},
{label: __("Time in Queries (ms)"), slug: "time_queries", sortable: true, number: true},
{label: __("Queries"), slug: "queries", sortable: true, number: true},
{label: __("Method"), slug: "method"},
{label: __("Time"), slug: "time", sortable: true},
],
query: {
sort: "duration",
@ -140,7 +140,7 @@ export default {
mounted() {
this.fetch_status();
this.refresh();
this.$root.page.set_secondary_action("Clear", () => {
this.$root.page.set_secondary_action(__("Clear"), () => {
frappe.set_route("recorder");
this.clear();
});
@ -151,11 +151,11 @@ export default {
const current_page = this.query.pagination.page;
const total_pages = this.query.pagination.total;
return [{
label: "First",
label: __("First"),
number: 1,
status: (current_page == 1) ? "disabled" : "",
},{
label: "Previous",
label: __("Previous)",
number: Math.max(current_page - 1, 1),
status: (current_page == 1) ? "disabled" : "",
}, {
@ -163,11 +163,11 @@ export default {
number: current_page,
status: "btn-info",
}, {
label: "Next",
label: __("Next"),
number: Math.min(current_page + 1, total_pages),
status: (current_page == total_pages) ? "disabled" : "",
}, {
label: "Last",
label: __("Last"),
number: total_pages,
status: (current_page == total_pages) ? "disabled" : "",
}];
@ -230,11 +230,11 @@ export default {
},
update_buttons: function() {
if(this.status.status == "Active") {
this.$root.page.set_primary_action("Stop", () => {
this.$root.page.set_primary_action(__("Stop"), () => {
this.stop();
});
} else {
this.$root.page.set_primary_action("Start", () => {
this.$root.page.set_primary_action(__("Start"), () => {
this.start();
});
}

View file

@ -16,7 +16,7 @@
</div>
<div class="row form-section visible-section">
<div class="col-sm-10">
<h6 class="form-section-heading uppercase">SQL Queries</h6>
<h6 class="form-section-heading uppercase">{{ __("SQL Queries") }}</h6>
</div>
<div class="col-sm-2 filter-list">
<div class="sort-selector">
@ -37,7 +37,7 @@
<div class="checkbox">
<label>
<span class="input-area"><input type="checkbox" class="input-with-feedback bold" data-fieldtype="Check" v-model="group_duplicates"></span>
<span class="label-area small">Group Duplicate Queries</span>
<span class="label-area small">{{ __("Group Duplicate Queries") }}</span>
</label>
</div>
</div>
@ -48,15 +48,15 @@
<div class="grid-row">
<div class="data-row row">
<div class="row-index col col-xs-1">
<span>Index</span></div>
<span>{{ __("Index") }}</span></div>
<div class="col grid-static-col col-xs-6">
<div class="static-area ellipsis">Query</div>
<div class="static-area ellipsis">{{ __("Query") }}</div>
</div>
<div class="col grid-static-col col-xs-2">
<div class="static-area ellipsis text-right">Duration (ms)</div>
<div class="static-area ellipsis text-right">{{ __("Duration (ms)") }}</div>
</div>
<div class="col grid-static-col col-xs-2">
<div class="static-area ellipsis text-right">Exact Copies</div>
<div class="static-area ellipsis text-right">{{ __("Exact Copies") }}</div>
</div>
</div>
</div>
@ -82,7 +82,7 @@
<div class="recorder-form-in-grid" v-if="showing == call.index">
<div class="grid-form-heading" @click="showing = null">
<div class="toolbar grid-header-toolbar">
<span class="panel-title">SQL Query #<span class="grid-form-row-index">{{ call.index }}</span></span>
<span class="panel-title">{{ __("SQL Query") }} #<span class="grid-form-row-index">{{ call.index }}</span></span>
<div class="btn btn-default btn-xs pull-right" style="margin-left: 7px;">
<span class="hidden-xs octicon octicon-triangle-up"></span>
</div>
@ -98,25 +98,25 @@
<form>
<div class="frappe-control">
<div class="form-group">
<div class="clearfix"><label class="control-label">Query</label></div>
<div class="clearfix"><label class="control-label">{{ __("Query") }}</label></div>
<div class="control-value like-disabled-input for-description"><pre>{{ call.query }}</pre></div>
</div>
</div>
<div class="frappe-control input-max-width">
<div class="form-group">
<div class="clearfix"><label class="control-label">Duration (ms)</label></div>
<div class="clearfix"><label class="control-label">{{ __("Duration (ms)") }}</label></div>
<div class="control-value like-disabled-input">{{ call.duration }}</div>
</div>
</div>
<div class="frappe-control input-max-width">
<div class="form-group">
<div class="clearfix"><label class="control-label">Exact Copies</label></div>
<div class="clearfix"><label class="control-label">{{ __("Exact Copies") }}</label></div>
<div class="control-value like-disabled-input">{{ call.exact_copies }}</div>
</div>
</div>
<div class="frappe-control">
<div class="form-group">
<div class="clearfix"><label class="control-label">Stack Trace</label></div>
<div class="clearfix"><label class="control-label"{{ __("Stack Trace") }}</label></div>
<div class="control-value like-disabled-input for-description" style="overflow:auto">
<table class="table table-striped">
<thead>
@ -137,7 +137,7 @@
</div>
<div class="frappe-control" v-if="call.explain_result[0]">
<div class="form-group">
<div class="clearfix"><label class="control-label">SQL Explain</label></div>
<div class="clearfix"><label class="control-label">{{ __("SQL Explain") }}</label></div>
<div class="control-value like-disabled-input for-description" style="overflow:auto">
<table class="table table-striped">
<thead>
@ -165,7 +165,7 @@
</div>
</div>
</div>
<div v-if="request.calls.length == 0" class="grid-empty text-center">No Data</div>
<div v-if="request.calls.length == 0" class="grid-empty text-center">{{ __("No Data") }}</div>
</div>
</div>
</div>
@ -201,19 +201,19 @@ export default {
data() {
return {
columns: [
{label: "Path", slug: "path", type: "Data", class: "col-sm-6"},
{label: "CMD", slug: "cmd", type: "Data", class: "col-sm-6"},
{label: "Time", slug: "time", type: "Time", class: "col-sm-6"},
{label: "Duration (ms)", slug: "duration", type: "Float", class: "col-sm-6"},
{label: "Number of Queries", slug: "queries", type: "Int", class: "col-sm-6"},
{label: "Time in Queries (ms)", slug: "time_queries", type: "Float", class: "col-sm-6"},
{label: "Request Headers", slug: "headers", type: "Small Text", formatter: value => `<pre class="for-description like-disabled-input">${JSON.stringify(value, null, 4)}</pre>`, class: "col-sm-12"},
{label: "Form Dict", slug: "form_dict", type: "Small Text", formatter: value => `<pre class="for-description like-disabled-input">${JSON.stringify(value, null, 4)}</pre>`, class: "col-sm-12"},
{label: __("Path"), slug: "path", type: "Data", class: "col-sm-6"},
{label: __("CMD"), slug: "cmd", type: "Data", class: "col-sm-6"},
{label: __("Time"), slug: "time", type: "Time", class: "col-sm-6"},
{label: __("Duration (ms)"), slug: "duration", type: "Float", class: "col-sm-6"},
{label: __("Number of Queries"), slug: "queries", type: "Int", class: "col-sm-6"},
{label: __("Time in Queries (ms)"), slug: "time_queries", type: "Float", class: "col-sm-6"},
{label: __("Request Headers"), slug: "headers", type: "Small Text", formatter: value => `<pre class="for-description like-disabled-input">${JSON.stringify(value, null, 4)}</pre>`, class: "col-sm-12"},
{label: __("Form Dict"), slug: "form_dict", type: "Small Text", formatter: value => `<pre class="for-description like-disabled-input">${JSON.stringify(value, null, 4)}</pre>`, class: "col-sm-12"},
],
table_columns: [
{label: "Execution Order", slug: "index", sortable: true},
{label: "Duration (ms)", slug: "duration", sortable: true},
{label: "Exact Copies", slug: "exact_copies", sortable: true},
{label: __("Execution Order"), slug: "index", sortable: true},
{label: __("Duration (ms)"), slug: "duration", sortable: true},
{label: __("Exact Copies"), slug: "exact_copies", sortable: true},
],
query: {
sort: "duration",
@ -236,11 +236,11 @@ export default {
const current_page = this.query.pagination.page;
const total_pages = this.query.pagination.total;
return [{
label: "First",
label: __("First"),
number: 1,
status: (current_page == 1) ? "disabled" : "",
},{
label: "Previous",
label: __("Previous"),
number: Math.max(current_page - 1, 1),
status: (current_page == 1) ? "disabled" : "",
}, {
@ -248,11 +248,11 @@ export default {
number: current_page,
status: "btn-info",
}, {
label: "Next",
label: __("Next"),
number: Math.min(current_page + 1, total_pages),
status: (current_page == total_pages) ? "disabled" : "",
}, {
label: "Last",
label: __("Last"),
number: total_pages,
status: (current_page == total_pages) ? "disabled" : "",
}];

View file

@ -312,7 +312,7 @@ class NotificationsView extends BaseNotificationsView {
this.container.append($(`<div class="notification-null-state">
<div class="text-center">
<img src="/assets/frappe/images/ui-states/notification-empty-state.svg" alt="Generic Empty State" class="null-state">
<div class="title">No New notifications</div>
<div class="title">${__('No New notifications')}</div>
<div class="subtitle">
${__('Looks like you havent received any notifications.')}
</div></div></div>`));
@ -430,7 +430,7 @@ class EventsView extends BaseNotificationsView {
<div class="notification-null-state">
<div class="text-center">
<img src="/assets/frappe/images/ui-states/event-empty-state.svg" alt="Generic Empty State" class="null-state">
<div class="title">No Upcoming Events</div>
<div class="title">${__('No Upcoming Events')}</div>
<div class="subtitle">
${__('There are no upcoming events for you.')}
</div></div></div>

View file

@ -8,7 +8,7 @@ frappe.views.DashboardView = class DashboardView extends frappe.views.ListView {
setup_defaults() {
return super.setup_defaults()
.then(() => {
this.page_title = __('{0} Dashboard', [this.doctype]);
this.page_title = __('{0} Dashboard', [__(this.doctype)]);
this.dashboard_settings = frappe.get_user_settings(this.doctype)['dashboard_settings'] || null;
});
}
@ -271,7 +271,7 @@ frappe.views.DashboardView = class DashboardView extends frappe.views.ListView {
show_add_chart_dialog() {
let fields = this.get_field_options();
const dialog = new frappe.ui.Dialog({
title: __("Add a {0} Chart", [this.doctype]),
title: __("Add a {0} Chart", [__(this.doctype)]),
fields: [
{
fieldname: 'new_or_existing',

View file

@ -335,12 +335,12 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
let message;
if (dashboard_name) {
let dashboard_route_html = `<a href="#dashboard-view/${dashboard_name}">${dashboard_name}</a>`;
message = __("New {0} {1} added to Dashboard {2}", [doctype, name, dashboard_route_html]);
message = __("New {0} {1} added to Dashboard {2}", [__(doctype), name, dashboard_route_html]);
} else {
message = __("New {0} {1} created", [doctype, name]);
message = __("New {0} {1} created", [__(doctype), name]);
}
frappe.msgprint(message, __("New {0} Created", [doctype]));
frappe.msgprint(message, __("New {0} Created", [__(doctype)]));
});
}
@ -937,7 +937,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
else {
wrapper[0].innerHTML =
`<div class="flex justify-center align-center text-muted" style="height: 120px; display: flex;">
<div>Please select X and Y fields</div>
<div>${__("Please select X and Y fields")}</div>
</div>`;
}
}
@ -1343,7 +1343,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
open_url_post(frappe.request.url, args);
}
}, __('Export Report: '+ this.report_name), __('Download'));
}, __('Export Report: {0}', [this.report_name]), __('Download'));
}
get_data_for_csv(include_indentation) {