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) {
|
if (missingMandatory.length > 0) {
|
||||||
let fields = missingMandatory.join('\n');
|
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);
|
throw new frappe.errors.MandatoryError(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ module.exports = class BaseDocument extends Observable {
|
|||||||
// check for conflict
|
// check for conflict
|
||||||
if (currentDoc && this.modified != currentDoc.modified) {
|
if (currentDoc && this.modified != currentDoc.modified) {
|
||||||
throw new frappe.errors.Conflict(
|
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.doctype,
|
||||||
this.name,
|
this.name,
|
||||||
])
|
])
|
||||||
@ -418,7 +418,7 @@ module.exports = class BaseDocument extends Observable {
|
|||||||
|
|
||||||
if (this.submitted && !this.meta.isSubmittable) {
|
if (this.submitted && !this.meta.isSubmittable) {
|
||||||
throw new frappe.errors.ValidationError(
|
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) {
|
if (!this.fields.find(df => df.fieldname === 'name') && !this.isSingle) {
|
||||||
this.fields = [
|
this.fields = [
|
||||||
{
|
{
|
||||||
label: frappe._('ID'),
|
label: frappe.t('ID'),
|
||||||
fieldname: 'name',
|
fieldname: 'name',
|
||||||
fieldtype: 'Data',
|
fieldtype: 'Data',
|
||||||
required: 1,
|
required: 1,
|
||||||
@ -176,7 +176,7 @@ module.exports = class BaseMeta extends BaseDocument {
|
|||||||
_add({
|
_add({
|
||||||
fieldtype: 'Check',
|
fieldtype: 'Check',
|
||||||
fieldname: 'submitted',
|
fieldname: 'submitted',
|
||||||
label: frappe._('Submitted')
|
label: frappe.t('Submitted')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,5 +101,5 @@ export default function getCommonExportActions(reportName) {
|
|||||||
|
|
||||||
export async function saveExportData(data, filePath) {
|
export async function saveExportData(data, filePath) {
|
||||||
await saveData(data, filePath);
|
await saveData(data, filePath);
|
||||||
showExportInFolder(frappe._('Export Successful'), filePath);
|
showExportInFolder(frappe.t('Export Successful'), filePath);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
async openFileSelector() {
|
async openFileSelector() {
|
||||||
const options = {
|
const options = {
|
||||||
title: frappe._('Select Image'),
|
title: frappe.t('Select Image'),
|
||||||
properties: ['openFile'],
|
properties: ['openFile'],
|
||||||
filters: [{ name: 'Image', extensions: ['png', 'jpg', 'jpeg', 'webp'] }]
|
filters: [{ name: 'Image', extensions: ['png', 'jpg', 'jpeg', 'webp'] }]
|
||||||
};
|
};
|
||||||
|
@ -77,12 +77,12 @@ export default {
|
|||||||
? path.resolve('.')
|
? path.resolve('.')
|
||||||
: frappe.store.documentsPath;
|
: frappe.store.documentsPath;
|
||||||
|
|
||||||
let title = frappe._('Message');
|
let title = frappe.t('Message');
|
||||||
let message = frappe._('Template saved successfully.');
|
let message = frappe.t('Template saved successfully.');
|
||||||
|
|
||||||
if (documentsPath === undefined) {
|
if (documentsPath === undefined) {
|
||||||
title = frappe._('Error');
|
title = frappe.t('Error');
|
||||||
message = frappe._('Template could not be saved.');
|
message = frappe.t('Template could not be saved.');
|
||||||
} else {
|
} else {
|
||||||
await writeFile(
|
await writeFile(
|
||||||
path.resolve(
|
path.resolve(
|
||||||
|
@ -115,7 +115,7 @@ export default {
|
|||||||
showReloadToast() {
|
showReloadToast() {
|
||||||
showToast({
|
showToast({
|
||||||
message: _('Settings changes will be visible on reload'),
|
message: _('Settings changes will be visible on reload'),
|
||||||
actionText: frappe._('Reload App'),
|
actionText: frappe.t('Reload App'),
|
||||||
type: 'info',
|
type: 'info',
|
||||||
action: async () => {
|
action: async () => {
|
||||||
frappe.events.trigger('reload-main-window');
|
frappe.events.trigger('reload-main-window');
|
||||||
|
@ -90,7 +90,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
async openFileSelector() {
|
async openFileSelector() {
|
||||||
const options = {
|
const options = {
|
||||||
title: frappe._('Select Logo'),
|
title: frappe.t('Select Logo'),
|
||||||
properties: ['openFile'],
|
properties: ['openFile'],
|
||||||
filters: [{ name: 'Invoice Logo', extensions: ['png', 'jpg', 'svg'] }],
|
filters: [{ name: 'Invoice Logo', extensions: ['png', 'jpg', 'svg'] }],
|
||||||
};
|
};
|
||||||
|
@ -174,13 +174,13 @@ export function handleErrorWithDialog(e, doc) {
|
|||||||
|
|
||||||
export async function makePDF(html, savePath) {
|
export async function makePDF(html, savePath) {
|
||||||
await ipcRenderer.invoke(IPC_ACTIONS.SAVE_HTML_AS_PDF, 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) {
|
export function showExportInFolder(message, filePath) {
|
||||||
showToast({
|
showToast({
|
||||||
message,
|
message,
|
||||||
actionText: frappe._('Open Folder'),
|
actionText: frappe.t('Open Folder'),
|
||||||
type: 'success',
|
type: 'success',
|
||||||
action: async () => {
|
action: async () => {
|
||||||
await showItemInFolder(filePath);
|
await showItemInFolder(filePath);
|
||||||
|
Loading…
Reference in New Issue
Block a user