mirror of
https://github.com/frappe/books.git
synced 2024-11-08 23:00:56 +00:00
refactor: replace all frappe._(" instances
This commit is contained in:
parent
31f2db495e
commit
d4675c0e5a
@ -211,7 +211,7 @@ module.exports = class BaseDocument extends Observable {
|
||||
|
||||
if (missingMandatory.length > 0) {
|
||||
let fields = missingMandatory.join('\n');
|
||||
let message = frappe._('Value missing for {0}', fields);
|
||||
let message = frappe.t('Value missing for {0}', fields);
|
||||
throw new frappe.errors.MandatoryError(message);
|
||||
}
|
||||
|
||||
@ -409,7 +409,7 @@ module.exports = class BaseDocument extends Observable {
|
||||
// check for conflict
|
||||
if (currentDoc && this.modified != currentDoc.modified) {
|
||||
throw new frappe.errors.Conflict(
|
||||
frappe._('Document {0} {1} has been modified after loading', [
|
||||
frappe.t('Document {0} {1} has been modified after loading', [
|
||||
this.doctype,
|
||||
this.name,
|
||||
])
|
||||
@ -418,7 +418,7 @@ module.exports = class BaseDocument extends Observable {
|
||||
|
||||
if (this.submitted && !this.meta.isSubmittable) {
|
||||
throw new frappe.errors.ValidationError(
|
||||
frappe._('Document type {1} is not submittable', [this.doctype])
|
||||
frappe.t('Document type {1} is not submittable', [this.doctype])
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ module.exports = class BaseMeta extends BaseDocument {
|
||||
if (!this.fields.find(df => df.fieldname === 'name') && !this.isSingle) {
|
||||
this.fields = [
|
||||
{
|
||||
label: frappe._('ID'),
|
||||
label: frappe.t('ID'),
|
||||
fieldname: 'name',
|
||||
fieldtype: 'Data',
|
||||
required: 1,
|
||||
@ -176,7 +176,7 @@ module.exports = class BaseMeta extends BaseDocument {
|
||||
_add({
|
||||
fieldtype: 'Check',
|
||||
fieldname: 'submitted',
|
||||
label: frappe._('Submitted')
|
||||
label: frappe.t('Submitted')
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -101,5 +101,5 @@ export default function getCommonExportActions(reportName) {
|
||||
|
||||
export async function saveExportData(data, filePath) {
|
||||
await saveData(data, filePath);
|
||||
showExportInFolder(frappe._('Export Successful'), filePath);
|
||||
showExportInFolder(frappe.t('Export Successful'), filePath);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ export default {
|
||||
methods: {
|
||||
async openFileSelector() {
|
||||
const options = {
|
||||
title: frappe._('Select Image'),
|
||||
title: frappe.t('Select Image'),
|
||||
properties: ['openFile'],
|
||||
filters: [{ name: 'Image', extensions: ['png', 'jpg', 'jpeg', 'webp'] }]
|
||||
};
|
||||
|
@ -77,12 +77,12 @@ export default {
|
||||
? path.resolve('.')
|
||||
: frappe.store.documentsPath;
|
||||
|
||||
let title = frappe._('Message');
|
||||
let message = frappe._('Template saved successfully.');
|
||||
let title = frappe.t('Message');
|
||||
let message = frappe.t('Template saved successfully.');
|
||||
|
||||
if (documentsPath === undefined) {
|
||||
title = frappe._('Error');
|
||||
message = frappe._('Template could not be saved.');
|
||||
title = frappe.t('Error');
|
||||
message = frappe.t('Template could not be saved.');
|
||||
} else {
|
||||
await writeFile(
|
||||
path.resolve(
|
||||
|
@ -115,7 +115,7 @@ export default {
|
||||
showReloadToast() {
|
||||
showToast({
|
||||
message: _('Settings changes will be visible on reload'),
|
||||
actionText: frappe._('Reload App'),
|
||||
actionText: frappe.t('Reload App'),
|
||||
type: 'info',
|
||||
action: async () => {
|
||||
frappe.events.trigger('reload-main-window');
|
||||
|
@ -90,7 +90,7 @@ export default {
|
||||
methods: {
|
||||
async openFileSelector() {
|
||||
const options = {
|
||||
title: frappe._('Select Logo'),
|
||||
title: frappe.t('Select Logo'),
|
||||
properties: ['openFile'],
|
||||
filters: [{ name: 'Invoice Logo', extensions: ['png', 'jpg', 'svg'] }],
|
||||
};
|
||||
|
@ -174,13 +174,13 @@ export function handleErrorWithDialog(e, doc) {
|
||||
|
||||
export async function makePDF(html, savePath) {
|
||||
await ipcRenderer.invoke(IPC_ACTIONS.SAVE_HTML_AS_PDF, html, savePath);
|
||||
showExportInFolder(frappe._('Save as PDF Successful'), savePath);
|
||||
showExportInFolder(frappe.t('Save as PDF Successful'), savePath);
|
||||
}
|
||||
|
||||
export function showExportInFolder(message, filePath) {
|
||||
showToast({
|
||||
message,
|
||||
actionText: frappe._('Open Folder'),
|
||||
actionText: frappe.t('Open Folder'),
|
||||
type: 'success',
|
||||
action: async () => {
|
||||
await showItemInFolder(filePath);
|
||||
|
Loading…
Reference in New Issue
Block a user