2
0
mirror of https://github.com/frappe/books.git synced 2024-11-08 14:50:56 +00:00

refactor: replace all frappe._(" instances

This commit is contained in:
18alantom 2022-01-24 11:42:01 +05:30
parent 31f2db495e
commit d4675c0e5a
8 changed files with 15 additions and 15 deletions

View File

@ -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])
);
}

View File

@ -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')
});
}

View File

@ -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);
}

View File

@ -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'] }]
};

View File

@ -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(

View File

@ -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');

View File

@ -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'] }],
};

View File

@ -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);