feat: add translations to datatable
This commit is contained in:
parent
77fd08985a
commit
c8c77437fa
5 changed files with 30 additions and 1 deletions
|
|
@ -63,6 +63,7 @@ import "./frappe/utils/address_and_contact.js";
|
|||
import "./frappe/utils/preview_email.js";
|
||||
import "./frappe/utils/file_manager.js";
|
||||
import "./frappe/utils/diffview";
|
||||
import "./frappe/utils/datatable.js";
|
||||
|
||||
import "./frappe/upload.js";
|
||||
import "./frappe/ui/tree.js";
|
||||
|
|
|
|||
|
|
@ -142,6 +142,8 @@ frappe.data_import.ImportPreview = class ImportPreview {
|
|||
columns: this.columns,
|
||||
layout: this.columns.length < 10 ? 'fluid' : 'fixed',
|
||||
cellHeight: 35,
|
||||
language: frappe.boot.lang,
|
||||
translations: frappe.utils.datatable.get_translations(),
|
||||
serialNoColumn: false,
|
||||
checkboxColumn: false,
|
||||
noDataMessage: __('No Data'),
|
||||
|
|
|
|||
22
frappe/public/js/frappe/utils/datatable.js
Normal file
22
frappe/public/js/frappe/utils/datatable.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
frappe.provide("frappe.utils.datatable");
|
||||
|
||||
frappe.utils.datatable.get_translations = function () {
|
||||
let translations = {};
|
||||
translations[frappe.boot.lang] = {
|
||||
"Sort Ascending": __("Sort Ascending"),
|
||||
"Sort Descending": __("Sort Descending"),
|
||||
"Reset sorting": __("Reset sorting"),
|
||||
"Remove column": __("Remove column"),
|
||||
"No Data": __("No Data"),
|
||||
"{count} cells copied": {
|
||||
"1": __("{count} cell copied"),
|
||||
"default": __("{count} cells copied")
|
||||
},
|
||||
"{count} rows selected": {
|
||||
"1": __("{count} row selected"),
|
||||
"default": __("{count} rows selected")
|
||||
}
|
||||
};
|
||||
|
||||
return translations;
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
|
|||
this.toggle_nothing_to_show(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
let route_options = {};
|
||||
route_options = Object.assign(route_options, frappe.route_options);
|
||||
|
||||
|
|
@ -849,6 +849,8 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
|
|||
columns: columns,
|
||||
data: data,
|
||||
inlineFilters: true,
|
||||
language: frappe.boot.lang,
|
||||
translations: frappe.utils.datatable.get_translations(),
|
||||
treeView: this.tree_report,
|
||||
layout: 'fixed',
|
||||
cellHeight: 33,
|
||||
|
|
|
|||
|
|
@ -284,6 +284,8 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
|
|||
columns: this.columns,
|
||||
data: this.get_data(values),
|
||||
getEditor: this.get_editing_object.bind(this),
|
||||
language: frappe.boot.lang,
|
||||
translations: frappe.utils.datatable.get_translations(),
|
||||
checkboxColumn: true,
|
||||
inlineFilters: true,
|
||||
cellHeight: 35,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue