2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

Merge pull request #322 from 18alantom/deprecate-underscore

refactor: deprecate underscore, switch _ to t
This commit is contained in:
Alan 2022-01-24 12:05:48 +05:30 committed by GitHub
commit 6b0aab815f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 313 additions and 314 deletions

View File

@ -1,6 +1,6 @@
import { showMessageDialog } from '@/utils'; import { showMessageDialog } from '@/utils';
import frappe from 'frappe'; import frappe from 'frappe';
import { _ } from 'frappe/utils'; import { t } from 'frappe';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import { exportCsv, saveExportData } from '../reports/commonExporter'; import { exportCsv, saveExportData } from '../reports/commonExporter';
import { getSavePath } from '../src/utils'; import { getSavePath } from '../src/utils';
@ -89,8 +89,8 @@ export async function generateGstr1Json(getReportData) {
const { gstin } = frappe.AccountingSettings; const { gstin } = frappe.AccountingSettings;
if (!gstin) { if (!gstin) {
showMessageDialog({ showMessageDialog({
message: _('Export Failed'), message: t('Export Failed'),
description: _('Please set GSTIN in General Settings.'), description: t('Please set GSTIN in General Settings.'),
}); });
return; return;
} }
@ -269,8 +269,8 @@ export async function generateGstr2Csv(getReportData) {
const { gstin } = frappe.AccountingSettings; const { gstin } = frappe.AccountingSettings;
if (!gstin) { if (!gstin) {
showMessageDialog({ showMessageDialog({
message: _('Export Failed'), message: t('Export Failed'),
description: _('Please set GSTIN in General Settings.'), description: t('Please set GSTIN in General Settings.'),
}); });
return; return;
} }
@ -350,8 +350,8 @@ export async function generateGstr1Csv(getReportData) {
const { gstin } = frappe.AccountingSettings; const { gstin } = frappe.AccountingSettings;
if (!gstin) { if (!gstin) {
showMessageDialog({ showMessageDialog({
message: _('Export Failed'), message: t('Export Failed'),
description: _('Please set GSTIN in General Settings.'), description: t('Please set GSTIN in General Settings.'),
}); });
return; return;
} }

View File

@ -1,171 +1,170 @@
import frappe from 'frappe'; import { t } from 'frappe';
const _ = frappe._.bind(frappe);
export default { export default {
[_('Application of Funds (Assets)')]: { [t('Application of Funds (Assets)')]: {
[_('Current Assets')]: { [t('Current Assets')]: {
[_('Accounts Receivable')]: { [t('Accounts Receivable')]: {
[_('Debtors')]: { [t('Debtors')]: {
accountType: 'Receivable', accountType: 'Receivable',
}, },
}, },
[_('Bank Accounts')]: { [t('Bank Accounts')]: {
accountType: 'Bank', accountType: 'Bank',
isGroup: 1, isGroup: 1,
}, },
[_('Cash In Hand')]: { [t('Cash In Hand')]: {
[_('Cash')]: { [t('Cash')]: {
accountType: 'Cash', accountType: 'Cash',
}, },
accountType: 'Cash', accountType: 'Cash',
}, },
[_('Loans and Advances (Assets)')]: { [t('Loans and Advances (Assets)')]: {
isGroup: 1, isGroup: 1,
}, },
[_('Securities and Deposits')]: { [t('Securities and Deposits')]: {
[_('Earnest Money')]: {}, [t('Earnest Money')]: {},
}, },
[_('Stock Assets')]: { [t('Stock Assets')]: {
[_('Stock In Hand')]: { [t('Stock In Hand')]: {
accountType: 'Stock', accountType: 'Stock',
}, },
accountType: 'Stock', accountType: 'Stock',
}, },
[_('Tax Assets')]: { [t('Tax Assets')]: {
isGroup: 1, isGroup: 1,
}, },
}, },
[_('Fixed Assets')]: { [t('Fixed Assets')]: {
[_('Capital Equipments')]: { [t('Capital Equipments')]: {
accountType: 'Fixed Asset', accountType: 'Fixed Asset',
}, },
[_('Electronic Equipments')]: { [t('Electronic Equipments')]: {
accountType: 'Fixed Asset', accountType: 'Fixed Asset',
}, },
[_('Furnitures and Fixtures')]: { [t('Furnitures and Fixtures')]: {
accountType: 'Fixed Asset', accountType: 'Fixed Asset',
}, },
[_('Office Equipments')]: { [t('Office Equipments')]: {
accountType: 'Fixed Asset', accountType: 'Fixed Asset',
}, },
[_('Plants and Machineries')]: { [t('Plants and Machineries')]: {
accountType: 'Fixed Asset', accountType: 'Fixed Asset',
}, },
[_('Buildings')]: { [t('Buildings')]: {
accountType: 'Fixed Asset', accountType: 'Fixed Asset',
}, },
[_('Softwares')]: { [t('Softwares')]: {
accountType: 'Fixed Asset', accountType: 'Fixed Asset',
}, },
[_('Accumulated Depreciation')]: { [t('Accumulated Depreciation')]: {
accountType: 'Accumulated Depreciation', accountType: 'Accumulated Depreciation',
}, },
}, },
[_('Investments')]: { [t('Investments')]: {
isGroup: 1, isGroup: 1,
}, },
[_('Temporary Accounts')]: { [t('Temporary Accounts')]: {
[_('Temporary Opening')]: { [t('Temporary Opening')]: {
accountType: 'Temporary', accountType: 'Temporary',
}, },
}, },
rootType: 'Asset', rootType: 'Asset',
}, },
[_('Expenses')]: { [t('Expenses')]: {
[_('Direct Expenses')]: { [t('Direct Expenses')]: {
[_('Stock Expenses')]: { [t('Stock Expenses')]: {
[_('Cost of Goods Sold')]: { [t('Cost of Goods Sold')]: {
accountType: 'Cost of Goods Sold', accountType: 'Cost of Goods Sold',
}, },
[_('Expenses Included In Valuation')]: { [t('Expenses Included In Valuation')]: {
accountType: 'Expenses Included In Valuation', accountType: 'Expenses Included In Valuation',
}, },
[_('Stock Adjustment')]: { [t('Stock Adjustment')]: {
accountType: 'Stock Adjustment', accountType: 'Stock Adjustment',
}, },
}, },
}, },
[_('Indirect Expenses')]: { [t('Indirect Expenses')]: {
[_('Administrative Expenses')]: {}, [t('Administrative Expenses')]: {},
[_('Commission on Sales')]: {}, [t('Commission on Sales')]: {},
[_('Depreciation')]: { [t('Depreciation')]: {
accountType: 'Depreciation', accountType: 'Depreciation',
}, },
[_('Entertainment Expenses')]: {}, [t('Entertainment Expenses')]: {},
[_('Freight and Forwarding Charges')]: { [t('Freight and Forwarding Charges')]: {
accountType: 'Chargeable', accountType: 'Chargeable',
}, },
[_('Legal Expenses')]: {}, [t('Legal Expenses')]: {},
[_('Marketing Expenses')]: { [t('Marketing Expenses')]: {
accountType: 'Chargeable', accountType: 'Chargeable',
}, },
[_('Miscellaneous Expenses')]: { [t('Miscellaneous Expenses')]: {
accountType: 'Chargeable', accountType: 'Chargeable',
}, },
[_('Office Maintenance Expenses')]: {}, [t('Office Maintenance Expenses')]: {},
[_('Office Rent')]: {}, [t('Office Rent')]: {},
[_('Postal Expenses')]: {}, [t('Postal Expenses')]: {},
[_('Print and Stationery')]: {}, [t('Print and Stationery')]: {},
[_('Round Off')]: { [t('Round Off')]: {
accountType: 'Round Off', accountType: 'Round Off',
}, },
[_('Salary')]: {}, [t('Salary')]: {},
[_('Sales Expenses')]: {}, [t('Sales Expenses')]: {},
[_('Telephone Expenses')]: {}, [t('Telephone Expenses')]: {},
[_('Travel Expenses')]: {}, [t('Travel Expenses')]: {},
[_('Utility Expenses')]: {}, [t('Utility Expenses')]: {},
[_('Write Off')]: {}, [t('Write Off')]: {},
[_('Exchange Gain/Loss')]: {}, [t('Exchange Gain/Loss')]: {},
[_('Gain/Loss on Asset Disposal')]: {}, [t('Gain/Loss on Asset Disposal')]: {},
}, },
rootType: 'Expense', rootType: 'Expense',
}, },
[_('Income')]: { [t('Income')]: {
[_('Direct Income')]: { [t('Direct Income')]: {
[_('Sales')]: {}, [t('Sales')]: {},
[_('Service')]: {}, [t('Service')]: {},
}, },
[_('Indirect Income')]: { [t('Indirect Income')]: {
isGroup: 1, isGroup: 1,
}, },
rootType: 'Income', rootType: 'Income',
}, },
[_('Source of Funds (Liabilities)')]: { [t('Source of Funds (Liabilities)')]: {
[_('Current Liabilities')]: { [t('Current Liabilities')]: {
[_('Accounts Payable')]: { [t('Accounts Payable')]: {
[_('Creditors')]: { [t('Creditors')]: {
accountType: 'Payable', accountType: 'Payable',
}, },
[_('Payroll Payable')]: {}, [t('Payroll Payable')]: {},
}, },
[_('Stock Liabilities')]: { [t('Stock Liabilities')]: {
[_('Stock Received But Not Billed')]: { [t('Stock Received But Not Billed')]: {
accountType: 'Stock Received But Not Billed', accountType: 'Stock Received But Not Billed',
}, },
}, },
[_('Duties and Taxes')]: { [t('Duties and Taxes')]: {
accountType: 'Tax', accountType: 'Tax',
isGroup: 1, isGroup: 1,
}, },
[_('Loans (Liabilities)')]: { [t('Loans (Liabilities)')]: {
[_('Secured Loans')]: {}, [t('Secured Loans')]: {},
[_('Unsecured Loans')]: {}, [t('Unsecured Loans')]: {},
[_('Bank Overdraft Account')]: {}, [t('Bank Overdraft Account')]: {},
}, },
}, },
rootType: 'Liability', rootType: 'Liability',
}, },
[_('Equity')]: { [t('Equity')]: {
[_('Capital Stock')]: { [t('Capital Stock')]: {
accountType: 'Equity', accountType: 'Equity',
}, },
[_('Dividends Paid')]: { [t('Dividends Paid')]: {
accountType: 'Equity', accountType: 'Equity',
}, },
[_('Opening Balance Equity')]: { [t('Opening Balance Equity')]: {
accountType: 'Equity', accountType: 'Equity',
}, },
[_('Retained Earnings')]: { [t('Retained Earnings')]: {
accountType: 'Equity', accountType: 'Equity',
}, },
rootType: 'Equity', rootType: 'Equity',

View File

@ -1,4 +1,5 @@
const Observable = require('./utils/observable'); const Observable = require('./utils/observable');
const { T, t } = require('./utils/translation');
const utils = require('./utils'); const utils = require('./utils');
const { getMoneyMaker } = require('pesa'); const { getMoneyMaker } = require('pesa');
const { const {
@ -227,8 +228,10 @@ module.exports = {
return this.metaCache[doctype]; return this.metaCache[doctype];
}, },
async getDoc(doctype, name, options = {skipDocumentCache: false}) { async getDoc(doctype, name, options = { skipDocumentCache: false }) {
let doc = options.skipDocumentCache ? null : this.getDocFromCache(doctype, name); let doc = options.skipDocumentCache
? null
: this.getDocFromCache(doctype, name);
if (!doc) { if (!doc) {
doc = new (this.getDocumentClass(doctype))({ doc = new (this.getDocumentClass(doctype))({
doctype: doctype, doctype: doctype,
@ -369,4 +372,6 @@ module.exports = {
this.server.close(); this.server.close();
} }
}, },
t,
T,
}; };

View File

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

View File

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

View File

@ -1,5 +1,5 @@
const { DateTime } = require('luxon'); const { DateTime } = require('luxon');
const { _ } = require('frappe/utils'); const { t } = require('frappe');
const { const {
DEFAULT_DISPLAY_PRECISION, DEFAULT_DISPLAY_PRECISION,
DEFAULT_INTERNAL_PRECISION, DEFAULT_INTERNAL_PRECISION,
@ -42,14 +42,14 @@ module.exports = {
options: dateFormatOptions, options: dateFormatOptions,
default: 'MMM d, y', default: 'MMM d, y',
required: 1, required: 1,
description: _('Sets the app-wide date display format.'), description: t('Sets the app-wide date display format.'),
}, },
{ {
fieldname: 'locale', fieldname: 'locale',
label: 'Locale', label: 'Locale',
fieldtype: 'Data', fieldtype: 'Data',
default: DEFAULT_LOCALE, default: DEFAULT_LOCALE,
description: _('Set the local code, this is used for number formatting.'), description: t('Set the local code, this is used for number formatting.'),
}, },
{ {
fieldname: 'displayPrecision', fieldname: 'displayPrecision',
@ -64,10 +64,10 @@ module.exports = {
return; return;
} }
throw new frappe.errors.ValidationError( throw new frappe.errors.ValidationError(
_('Display Precision should have a value between 0 and 9.') t('Display Precision should have a value between 0 and 9.')
); );
}, },
description: _('Sets how many digits are shown after the decimal point.'), description: t('Sets how many digits are shown after the decimal point.'),
}, },
{ {
fieldname: 'internalPrecision', fieldname: 'internalPrecision',
@ -75,7 +75,7 @@ module.exports = {
fieldtype: 'Int', fieldtype: 'Int',
minValue: 0, minValue: 0,
default: DEFAULT_INTERNAL_PRECISION, default: DEFAULT_INTERNAL_PRECISION,
description: _( description: t(
'Sets the internal precision used for monetary calculations. Above 6 should be sufficient for most currencies.' 'Sets the internal precision used for monetary calculations. Above 6 should be sufficient for most currencies.'
), ),
}, },
@ -84,7 +84,7 @@ module.exports = {
label: 'Hide Get Started', label: 'Hide Get Started',
fieldtype: 'Check', fieldtype: 'Check',
default: 0, default: 0,
description: _( description: t(
'Hides the Get Started section from the sidebar. Change will be visible on restart or refreshing the app.' 'Hides the Get Started section from the sidebar. Change will be visible on restart or refreshing the app.'
), ),
}, },
@ -93,7 +93,7 @@ module.exports = {
label: 'Auto Update', label: 'Auto Update',
fieldtype: 'Check', fieldtype: 'Check',
default: 1, default: 1,
description: _( description: t(
'Automatically checks for updates and download them if available. The update will be applied after you restart the app.' 'Automatically checks for updates and download them if available. The update will be applied after you restart the app.'
), ),
}, },
@ -102,7 +102,7 @@ module.exports = {
label: 'Auto Report Errors', label: 'Auto Report Errors',
fieldtype: 'Check', fieldtype: 'Check',
default: 0, default: 0,
description: _( description: t(
'Automatically report all errors. User will still be notified when an error pops up.' 'Automatically report all errors. User will still be notified when an error pops up.'
), ),
}, },

View File

@ -1,5 +1,4 @@
const { pesa } = require('pesa'); const { pesa } = require('pesa');
const { T, t } = require('./translation');
Array.prototype.equals = function (array) { Array.prototype.equals = function (array) {
return ( return (
@ -88,9 +87,6 @@ function isPesa(value) {
} }
module.exports = { module.exports = {
_: t,
t,
T,
slug, slug,
getRandomString, getRandomString,
sleep, sleep,

View File

@ -1,7 +1,7 @@
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
doctype: 'Account', doctype: 'Account',
title: _('Account'), title: t('Account'),
columns: ['name', 'parentAccount', 'rootType'], columns: ['name', 'parentAccount', 'rootType'],
}; };

View File

@ -1,7 +1,7 @@
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
doctype: 'AccountingLedgerEntry', doctype: 'AccountingLedgerEntry',
title: _('Accounting Ledger Entries'), title: t('Accounting Ledger Entries'),
columns: ['account', 'party', 'debit', 'credit', 'balance'], columns: ['account', 'party', 'debit', 'credit', 'balance'],
}; };

View File

@ -1,7 +1,7 @@
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
doctype: 'GSTR3B', doctype: 'GSTR3B',
title: _('GSTR 3B Report'), title: t('GSTR 3B Report'),
columns: ['year', 'month'], columns: ['year', 'month'],
}; };

View File

@ -2,7 +2,7 @@
<div> <div>
<div class="row no-gutters"> <div class="row no-gutters">
<div class="col-8 mx-auto text-right mt-4"> <div class="col-8 mx-auto text-right mt-4">
<f-button primary @click="$emit('makePDF', $refs.printComponent.innerHTML)">{{ _('PDF') }}</f-button> <f-button primary @click="$emit('makePDF', $refs.printComponent.innerHTML)">{{ t('PDF') }}</f-button>
</div> </div>
</div> </div>
<div ref="printComponent" class="col-8 bg-white mt-4 mx-auto border shadow"> <div ref="printComponent" class="col-8 bg-white mt-4 mx-auto border shadow">

View File

@ -1,5 +1,5 @@
import frappe from 'frappe'; import frappe from 'frappe';
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
name: 'Item', name: 'Item',
@ -124,7 +124,7 @@ export default {
], ],
actions: [ actions: [
{ {
label: _('New Invoice'), label: t('New Invoice'),
condition: (doc) => !doc.isNew(), condition: (doc) => !doc.isNew(),
action: async (doc, router) => { action: async (doc, router) => {
const invoice = await frappe.getNewDoc('SalesInvoice'); const invoice = await frappe.getNewDoc('SalesInvoice');
@ -137,7 +137,7 @@ export default {
}, },
}, },
{ {
label: _('New Bill'), label: t('New Bill'),
condition: (doc) => !doc.isNew(), condition: (doc) => !doc.isNew(),
action: async (doc, router) => { action: async (doc, router) => {
const invoice = await frappe.getNewDoc('PurchaseInvoice'); const invoice = await frappe.getNewDoc('PurchaseInvoice');

View File

@ -1,7 +1,7 @@
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
doctype: 'Item', doctype: 'Item',
title: _('Items'), title: t('Items'),
columns: ['name', 'unit', 'tax', 'rate'], columns: ['name', 'unit', 'tax', 'rate'],
}; };

View File

@ -1,9 +1,9 @@
import Badge from '@/components/Badge'; import Badge from '@/components/Badge';
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
doctype: 'JournalEntry', doctype: 'JournalEntry',
title: _('Journal Entry'), title: t('Journal Entry'),
formRoute: (name) => `/edit/JournalEntry/${name}`, formRoute: (name) => `/edit/JournalEntry/${name}`,
columns: [ columns: [
'date', 'date',

View File

@ -1,6 +1,6 @@
import router from '@/router'; import router from '@/router';
import frappe from 'frappe'; import frappe from 'frappe';
import { _ } from 'frappe/utils'; import { t } from 'frappe';
import PartyWidget from './PartyWidget.vue'; import PartyWidget from './PartyWidget.vue';
export default { export default {
@ -12,7 +12,7 @@ export default {
}, },
actions: [ actions: [
{ {
label: _('Create Invoice'), label: t('Create Invoice'),
condition: (doc) => !doc.isNew(), condition: (doc) => !doc.isNew(),
action: async (customer) => { action: async (customer) => {
let doc = await frappe.getNewDoc('SalesInvoice'); let doc = await frappe.getNewDoc('SalesInvoice');
@ -28,7 +28,7 @@ export default {
}, },
}, },
{ {
label: _('View Invoices'), label: t('View Invoices'),
condition: (doc) => !doc.isNew(), condition: (doc) => !doc.isNew(),
action: (customer) => { action: (customer) => {
router.push({ router.push({

View File

@ -1,7 +1,7 @@
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
doctype: 'Customer', doctype: 'Customer',
title: _('Customers'), title: t('Customers'),
columns: ['name', 'phone', 'outstandingAmount'], columns: ['name', 'phone', 'outstandingAmount'],
}; };

View File

@ -1,5 +1,5 @@
import frappe from 'frappe'; import frappe from 'frappe';
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
name: 'Party', name: 'Party',
@ -86,7 +86,7 @@ export default {
label: 'Address', label: 'Address',
fieldtype: 'Link', fieldtype: 'Link',
target: 'Address', target: 'Address',
placeholder: _('Click to create'), placeholder: t('Click to create'),
inline: true, inline: true,
}, },
{ {

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="py-4" v-if="pendingInvoices.length"> <div class="py-4" v-if="pendingInvoices.length">
<div class="px-4 text-sm text-gray-600 mb-1"> <div class="px-4 text-sm text-gray-600 mb-1">
{{ _('Recent Invoices') }} {{ t('Recent Invoices') }}
</div> </div>
<div <div
class="px-4 py-3 border-b hover:bg-gray-100 cursor-pointer" class="px-4 py-3 border-b hover:bg-gray-100 cursor-pointer"

View File

@ -1,6 +1,6 @@
import router from '@/router'; import router from '@/router';
import frappe from 'frappe'; import frappe from 'frappe';
import { _ } from 'frappe/utils'; import { t } from 'frappe';
import PartyWidget from './PartyWidget.vue'; import PartyWidget from './PartyWidget.vue';
export default { export default {
@ -12,7 +12,7 @@ export default {
}, },
actions: [ actions: [
{ {
label: _('Create Bill'), label: t('Create Bill'),
condition: (doc) => !doc.isNew(), condition: (doc) => !doc.isNew(),
action: async (supplier) => { action: async (supplier) => {
let doc = await frappe.getNewDoc('PurchaseInvoice'); let doc = await frappe.getNewDoc('PurchaseInvoice');
@ -28,7 +28,7 @@ export default {
}, },
}, },
{ {
label: _('View Bills'), label: t('View Bills'),
condition: (doc) => !doc.isNew(), condition: (doc) => !doc.isNew(),
action: (supplier) => { action: (supplier) => {
router.push({ router.push({

View File

@ -1,7 +1,7 @@
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
doctype: 'Supplier', doctype: 'Supplier',
title: _('Supplier'), title: t('Supplier'),
columns: ['name', 'phone', 'outstandingAmount'], columns: ['name', 'phone', 'outstandingAmount'],
}; };

View File

@ -113,7 +113,7 @@ export default {
validate(value, doc) { validate(value, doc) {
if (value.isNegative()) { if (value.isNegative()) {
throw new frappe.errors.ValidationError( throw new frappe.errors.ValidationError(
frappe._(`Payment amount cannot be less than zero.`) frappe.t(`Payment amount cannot be less than zero.`)
); );
} }
@ -122,7 +122,7 @@ export default {
if (value.gt(amount)) { if (value.gt(amount)) {
throw new frappe.errors.ValidationError( throw new frappe.errors.ValidationError(
frappe._( frappe.t(
`Payment amount cannot exceed ${frappe.format( `Payment amount cannot exceed ${frappe.format(
amount, amount,
'Currency' 'Currency'
@ -131,7 +131,7 @@ export default {
); );
} else if (value.isZero()) { } else if (value.isZero()) {
throw new frappe.errors.ValidationError( throw new frappe.errors.ValidationError(
frappe._( frappe.t(
`Payment amount cannot be ${frappe.format(value, 'Currency')}.` `Payment amount cannot be ${frappe.format(value, 'Currency')}.`
) )
); );

View File

@ -1,9 +1,9 @@
import Badge from '@/components/Badge'; import Badge from '@/components/Badge';
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
doctype: 'Payment', doctype: 'Payment',
title: _('Payments'), title: t('Payments'),
columns: [ columns: [
'party', 'party',
{ {

View File

@ -84,7 +84,7 @@ export default class PaymentServer extends BaseDocument {
: ''; : '';
throw new Error( throw new Error(
frappe._( frappe.t(
`Amount: ${payment} ${writeoffString}is less than the total amount allocated to references: ${refAmount}.` `Amount: ${payment} ${writeoffString}is less than the total amount allocated to references: ${refAmount}.`
) )
); );
@ -115,7 +115,7 @@ export default class PaymentServer extends BaseDocument {
outstandingAmount = baseGrandTotal; outstandingAmount = baseGrandTotal;
} }
if (this.amount.lte(0) || this.amount.gt(outstandingAmount)) { if (this.amount.lte(0) || this.amount.gt(outstandingAmount)) {
let message = frappe._( let message = frappe.t(
`Payment amount: ${frappe.format( `Payment amount: ${frappe.format(
this.amount, this.amount,
'Currency' 'Currency'
@ -127,7 +127,7 @@ export default class PaymentServer extends BaseDocument {
if (this.amount.lte(0)) { if (this.amount.lte(0)) {
const amt = frappe.format(this.amount, 'Currency'); const amt = frappe.format(this.amount, 'Currency');
message = frappe._( message = frappe.t(
`Payment amount: ${amt} should be greater than 0.` `Payment amount: ${amt} should be greater than 0.`
); );
} }

View File

@ -1,9 +1,9 @@
import frappe from 'frappe'; import frappe from 'frappe';
import { _ } from 'frappe/utils'; import { t } from 'frappe';
const referenceTypeMap = { const referenceTypeMap = {
SalesInvoice: _('Invoice'), SalesInvoice: t('Invoice'),
PurchaseInvoice: _('Bill'), PurchaseInvoice: t('Bill'),
}; };
export default { export default {

View File

@ -1,9 +1,9 @@
import { _ } from 'frappe/utils'; import { t } from 'frappe';
import { getStatusColumn } from '../Transaction/Transaction'; import { getStatusColumn } from '../Transaction/Transaction';
export default { export default {
doctype: 'PurchaseInvoice', doctype: 'PurchaseInvoice',
title: _('Bills'), title: t('Bills'),
formRoute: (name) => `/edit/PurchaseInvoice/${name}`, formRoute: (name) => `/edit/PurchaseInvoice/${name}`,
columns: [ columns: [
'supplier', 'supplier',

View File

@ -1,9 +1,9 @@
import { _ } from 'frappe/utils'; import { t } from 'frappe';
import { getStatusColumn } from '../Transaction/Transaction'; import { getStatusColumn } from '../Transaction/Transaction';
export default { export default {
doctype: 'SalesInvoice', doctype: 'SalesInvoice',
title: _('Invoices'), title: t('Invoices'),
formRoute: (name) => `/edit/SalesInvoice/${name}`, formRoute: (name) => `/edit/SalesInvoice/${name}`,
columns: [ columns: [
'customer', 'customer',

View File

@ -3,9 +3,9 @@
<div class="row no-gutters"> <div class="row no-gutters">
<div v-if="showInvoiceCustomizer" class="col-3 mt-4 mx-auto"></div> <div v-if="showInvoiceCustomizer" class="col-3 mt-4 mx-auto"></div>
<div class="col-8 mx-auto text-right mt-4"> <div class="col-8 mx-auto text-right mt-4">
<f-button primary @click="$emit('send', $refs.printComponent.innerHTML)">{{ _('Send') }}</f-button> <f-button primary @click="$emit('send', $refs.printComponent.innerHTML)">{{ t('Send') }}</f-button>
<f-button secondary @click="toggleCustomizer">{{ _('Customize') }}</f-button> <f-button secondary @click="toggleCustomizer">{{ t('Customize') }}</f-button>
<f-button secondary @click="$emit('makePDF', $refs.printComponent.innerHTML)">{{ _('PDF') }}</f-button> <f-button secondary @click="$emit('makePDF', $refs.printComponent.innerHTML)">{{ t('PDF') }}</f-button>
</div> </div>
</div> </div>
<div class="row no-gutters"> <div class="row no-gutters">

View File

@ -96,7 +96,7 @@
</div> </div>
<div class="w-1/2"> <div class="w-1/2">
<div class="flex pl-2 justify-between py-3 border-b"> <div class="flex pl-2 justify-between py-3 border-b">
<div>{{ _('Subtotal') }}</div> <div>{{ t('Subtotal') }}</div>
<div>{{ frappe.format(doc.netTotal, 'Currency') }}</div> <div>{{ frappe.format(doc.netTotal, 'Currency') }}</div>
</div> </div>
<div <div
@ -110,7 +110,7 @@
<div <div
class="flex pl-2 justify-between py-3 border-t text-green-600 font-semibold text-base" class="flex pl-2 justify-between py-3 border-t text-green-600 font-semibold text-base"
> >
<div>{{ _('Grand Total') }}</div> <div>{{ t('Grand Total') }}</div>
<div>{{ frappe.format(doc.grandTotal, 'Currency') }}</div> <div>{{ frappe.format(doc.grandTotal, 'Currency') }}</div>
</div> </div>
</div> </div>

View File

@ -82,7 +82,7 @@
<div class="flex -mx-3"> <div class="flex -mx-3">
<div class="flex justify-end flex-1 p-3 bg-gray-100"> <div class="flex justify-end flex-1 p-3 bg-gray-100">
<div class="text-right"> <div class="text-right">
<div class="text-gray-800">{{ _('Subtotal') }}</div> <div class="text-gray-800">{{ t('Subtotal') }}</div>
<div class="text-xl mt-2"> <div class="text-xl mt-2">
{{ frappe.format(doc.netTotal, 'Currency') }} {{ frappe.format(doc.netTotal, 'Currency') }}
</div> </div>
@ -105,7 +105,7 @@
:style="{ backgroundColor: printSettings.color }" :style="{ backgroundColor: printSettings.color }"
> >
<div> <div>
<div>{{ _('Grand Total') }}</div> <div>{{ t('Grand Total') }}</div>
<div class="text-2xl mt-2 font-semibold"> <div class="text-2xl mt-2 font-semibold">
{{ frappe.format(doc.grandTotal, 'Currency') }} {{ frappe.format(doc.grandTotal, 'Currency') }}
</div> </div>

View File

@ -103,7 +103,7 @@
</div> </div>
<div class="w-1/2 text-lg"> <div class="w-1/2 text-lg">
<div class="flex pl-2 justify-between py-1"> <div class="flex pl-2 justify-between py-1">
<div>{{ _('Subtotal') }}</div> <div>{{ t('Subtotal') }}</div>
<div>{{ frappe.format(doc.netTotal, 'Currency') }}</div> <div>{{ frappe.format(doc.netTotal, 'Currency') }}</div>
</div> </div>
<div <div
@ -118,7 +118,7 @@
class="flex pl-2 justify-between py-1 font-semibold" class="flex pl-2 justify-between py-1 font-semibold"
:style="{ color: printSettings.color }" :style="{ color: printSettings.color }"
> >
<div>{{ _('Grand Total') }}</div> <div>{{ t('Grand Total') }}</div>
<div>{{ frappe.format(doc.grandTotal, 'Currency') }}</div> <div>{{ frappe.format(doc.grandTotal, 'Currency') }}</div>
</div> </div>
</div> </div>

View File

@ -41,7 +41,7 @@ export default {
} }
throw new frappe.errors.ValidationError( throw new frappe.errors.ValidationError(
frappe._(`Quantity (${value}) cannot be less than zero.`) frappe.t(`Quantity (${value}) cannot be less than zero.`)
); );
}, },
}, },
@ -63,7 +63,7 @@ export default {
} }
throw new frappe.errors.ValidationError( throw new frappe.errors.ValidationError(
frappe._( frappe.t(
`Rate (${frappe.format(value, 'Currency')}) cannot be less zero.` `Rate (${frappe.format(value, 'Currency')}) cannot be less zero.`
) )
); );

View File

@ -1,7 +1,7 @@
import { _ } from 'frappe/utils'; import { t } from 'frappe';
export default { export default {
doctype: 'Tax', doctype: 'Tax',
title: _('Taxes'), title: t('Taxes'),
columns: ['name'], columns: ['name'],
}; };

View File

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

View File

@ -5,6 +5,6 @@
@click="$router.back()" @click="$router.back()"
> >
<feather-icon name="chevron-left" class="w-5 h-5" /> <feather-icon name="chevron-left" class="w-5 h-5" />
<span class="ml-1">{{ _('Back') }}</span> <span class="ml-1">{{ t('Back') }}</span>
</a> </a>
</template> </template>

View File

@ -33,7 +33,7 @@
v-show="showEdit" v-show="showEdit"
class="absolute bottom-0 text-gray-500 text-center text-xs pt-3 pb-1" class="absolute bottom-0 text-gray-500 text-center text-xs pt-3 pb-1"
> >
{{ _('Edit') }} {{ t('Edit') }}
</div> </div>
</div> </div>
</template> </template>
@ -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'] }]
}; };

View File

@ -40,7 +40,7 @@
<div class="mt-3 w-28"> <div class="mt-3 w-28">
<input <input
type="text" type="text"
:placeholder="_('Custom Hex')" :placeholder="t('Custom Hex')"
:class="inputClasses" :class="inputClasses"
:value="value" :value="value"
@change="e => setColorValue(e.target.value)" @change="e => setColorValue(e.target.value)"

View File

@ -66,7 +66,7 @@ export default {
action: () => this.openNewDoc(), action: () => this.openNewDoc(),
component: { component: {
template: ` template: `
<div class="flex items-center font-semibold">{{ _('Create') }} <div class="flex items-center font-semibold">{{ t('Create') }}
<Badge color="blue" class="ml-2" v-if="isNewValue">{{ linkValue }}</Badge> <Badge color="blue" class="ml-2" v-if="isNewValue">{{ linkValue }}</Badge>
</div> </div>
`, `,

View File

@ -43,7 +43,7 @@
'px-3 py-4': size !== 'small' 'px-3 py-4': size !== 'small'
}" }"
> >
{{ _('Add Row') }} {{ t('Add Row') }}
</div> </div>
<div v-for="i in ratio.slice(3).length" :key="i"></div> <div v-for="i in ratio.slice(3).length" :key="i"></div>
<div <div

View File

@ -19,7 +19,7 @@
<div slot="content" class="z-10 bg-white rounded w-full min-w-40"> <div slot="content" class="z-10 bg-white rounded w-full min-w-40">
<div class="p-1 max-h-64 overflow-auto text-sm"> <div class="p-1 max-h-64 overflow-auto text-sm">
<div v-if="isLoading" class="p-2 text-gray-600 italic"> <div v-if="isLoading" class="p-2 text-gray-600 italic">
{{ _('Loading...') }} {{ t('Loading...') }}
</div> </div>
<div <div
v-if="!isLoading && dropdownItems.length === 0" v-if="!isLoading && dropdownItems.length === 0"
@ -168,11 +168,11 @@ export default {
getEmptyMessage() { getEmptyMessage() {
const { emptyMessage } = this.df ?? {}; const { emptyMessage } = this.df ?? {};
if (typeof emptyMessage === 'function') { if (typeof emptyMessage === 'function') {
return _(emptyMessage(this.doc)); return this.t(emptyMessage(this.doc));
} else if (emptyMessage) { } else if (emptyMessage) {
return _(emptyMessage); return this.t(emptyMessage);
} }
return _('Empty'); return this.t('Empty');
}, },
selectItem(d) { selectItem(d) {
if (d.action) { if (d.action) {

View File

@ -9,7 +9,7 @@
{{ filterAppliedMessage }} {{ filterAppliedMessage }}
</template> </template>
<template v-else> <template v-else>
{{ _('Filter') }} {{ t('Filter') }}
</template> </template>
</span> </span>
</span> </span>
@ -80,7 +80,7 @@
</template> </template>
<template v-else> <template v-else>
<span class="text-base text-gray-600">{{ <span class="text-base text-gray-600">{{
_('No filters selected') t('No filters selected')
}}</span> }}</span>
</template> </template>
</div> </div>
@ -89,7 +89,7 @@
@click="addNewFilter" @click="addNewFilter"
> >
<feather-icon name="plus" class="w-4 h-4" /> <feather-icon name="plus" class="w-4 h-4" />
<span class="ml-2">{{ _('Add a filter') }}</span> <span class="ml-2">{{ t('Add a filter') }}</span>
</div> </div>
</div> </div>
</Popover> </Popover>
@ -180,9 +180,9 @@ export default {
}, },
filterAppliedMessage() { filterAppliedMessage() {
if (this.activeFilterCount === 1) { if (this.activeFilterCount === 1) {
return this._('1 filter applied'); return this.t('1 filter applied');
} }
return this._('{0} filters applied', [this.activeFilterCount]); return this.t('{0} filters applied', [this.activeFilterCount]);
} }
} }
}; };

View File

@ -6,7 +6,7 @@
<h4>Customize</h4> <h4>Customize</h4>
</div> </div>
<div class="col-6 text-right"> <div class="col-6 text-right">
<f-button secondary @click="saveAndClose">{{ _('Save & Close') }}</f-button> <f-button secondary @click="saveAndClose">{{ t('Save & Close') }}</f-button>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -14,7 +14,7 @@
<form-layout :doc="doc" :fields="fields" @updateDoc="saveDoc" /> <form-layout :doc="doc" :fields="fields" @updateDoc="saveDoc" />
<sketch-picker v-model="color" class="shadow-none" /> <sketch-picker v-model="color" class="shadow-none" />
<div class="mt-3"> <div class="mt-3">
<f-button secondary @click="openCompanySettings">{{ _('Company Settings') }}</f-button> <f-button secondary @click="openCompanySettings">{{ t('Company Settings') }}</f-button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -28,14 +28,14 @@
class="w-1/2 text-gray-900" class="w-1/2 text-gray-900"
@click="inlineEditField = null" @click="inlineEditField = null"
> >
{{ _('Cancel') }} {{ t('Cancel') }}
</Button> </Button>
<Button <Button
type="primary" type="primary"
class="ml-2 w-1/2 text-white" class="ml-2 w-1/2 text-white"
@click="saveInlineEditDoc" @click="saveInlineEditDoc"
> >
{{ df.inlineSaveText || _('Save') }} {{ df.inlineSaveText || t('Save') }}
</Button> </Button>
</div> </div>
</div> </div>

View File

@ -49,9 +49,8 @@ import { outsideClickDirective } from './ui';
}, },
}, },
methods: { methods: {
_(...args) { t: frappe.t,
return frappe._(...args); T: frappe.T,
},
}, },
}); });

View File

@ -2,7 +2,7 @@
<div class="flex flex-col overflow-y-hidden"> <div class="flex flex-col overflow-y-hidden">
<PageHeader> <PageHeader>
<h1 slot="title" class="text-2xl font-bold"> <h1 slot="title" class="text-2xl font-bold">
{{ _('Chart of Accounts') }} {{ t('Chart of Accounts') }}
</h1> </h1>
<template slot="actions"> <template slot="actions">
<SearchBar class="ml-2" /> <SearchBar class="ml-2" />
@ -37,13 +37,13 @@
class="text-xs text-gray-800 hover:text-gray-900 focus:outline-none" class="text-xs text-gray-800 hover:text-gray-900 focus:outline-none"
@click.stop="addAccount(account, 'addingAccount')" @click.stop="addAccount(account, 'addingAccount')"
> >
{{ _('Add Account') }} {{ t('Add Account') }}
</button> </button>
<button <button
class="ml-3 text-xs text-gray-800 hover:text-gray-900 focus:outline-none" class="ml-3 text-xs text-gray-800 hover:text-gray-900 focus:outline-none"
@click.stop="addAccount(account, 'addingGroupAccount')" @click.stop="addAccount(account, 'addingGroupAccount')"
> >
{{ _('Add Group') }} {{ t('Add Group') }}
</button> </button>
</div> </div>
</div> </div>
@ -67,7 +67,7 @@
<input <input
class="focus:outline-none bg-transparent" class="focus:outline-none bg-transparent"
:class="{ 'text-gray-600': insertingAccount }" :class="{ 'text-gray-600': insertingAccount }"
:placeholder="_('New Account')" :placeholder="t('New Account')"
:ref="account.name" :ref="account.name"
@keydown.esc="cancelAddingAccount(account)" @keydown.esc="cancelAddingAccount(account)"
@keydown.enter=" @keydown.enter="
@ -86,7 +86,7 @@
class="ml-4 text-xs text-gray-800 hover:text-gray-900 focus:outline-none" class="ml-4 text-xs text-gray-800 hover:text-gray-900 focus:outline-none"
@click="cancelAddingAccount(account)" @click="cancelAddingAccount(account)"
> >
{{ _('Cancel') }} {{ t('Cancel') }}
</button> </button>
</div> </div>
</div> </div>

View File

@ -2,15 +2,15 @@
<div class="mt-4 mx-4"> <div class="mt-4 mx-4">
<template v-if="hasData"> <template v-if="hasData">
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<div class="font-medium">{{ _('Cashflow') }}</div> <div class="font-medium">{{ t('Cashflow') }}</div>
<div class="flex text-base"> <div class="flex text-base">
<div class="flex items-center"> <div class="flex items-center">
<span class="w-3 h-3 rounded-sm inline-block bg-blue-500"></span> <span class="w-3 h-3 rounded-sm inline-block bg-blue-500"></span>
<span class="ml-2">{{ _('Inflow') }}</span> <span class="ml-2">{{ t('Inflow') }}</span>
</div> </div>
<div class="flex items-center ml-6"> <div class="flex items-center ml-6">
<span class="w-3 h-3 rounded-sm inline-block bg-gray-500"></span> <span class="w-3 h-3 rounded-sm inline-block bg-gray-500"></span>
<span class="ml-2">{{ _('Outflow') }}</span> <span class="ml-2">{{ t('Outflow') }}</span>
</div> </div>
</div> </div>
<PeriodSelector :value="period" @change="(value) => (period = value)" /> <PeriodSelector :value="period" @change="(value) => (period = value)" />
@ -31,7 +31,7 @@
</defs> </defs>
<g fill="none" fill-rule="evenodd"> <g fill="none" fill-rule="evenodd">
<text fill="#112B42" class="font-medium"> <text fill="#112B42" class="font-medium">
<tspan y="16">{{ _('Cashflow') }}</tspan> <tspan y="16">{{ t('Cashflow') }}</tspan>
</text> </text>
<g fill="#E9E9ED"> <g fill="#E9E9ED">
<path d="M371 2h12v12h-12zM391 2h53v12h-53z" /> <path d="M371 2h12v12h-12zM391 2h53v12h-53z" />

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="flex flex-col"> <div class="flex flex-col">
<PageHeader> <PageHeader>
<h1 slot="title" class="text-2xl font-bold">{{ _('Dashboard') }}</h1> <h1 slot="title" class="text-2xl font-bold">{{ t('Dashboard') }}</h1>
<template slot="actions"> <template slot="actions">
<SearchBar class="ml-2" /> <SearchBar class="ml-2" />
</template> </template>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="flex flex-col h-full"> <div class="flex flex-col h-full">
<SectionHeader> <SectionHeader>
<template slot="title">{{ _('Top Expenses') }}</template> <template slot="title">{{ t('Top Expenses') }}</template>
<PeriodSelector <PeriodSelector
slot="action" slot="action"
:value="period" :value="period"
@ -31,13 +31,13 @@
:active="active" :active="active"
:sectors="sectors" :sectors="sectors"
:value-formatter="(value) => frappe.format(value, 'Currency')" :value-formatter="(value) => frappe.format(value, 'Currency')"
:total-label="_('Total Spending')" :total-label="t('Total Spending')"
@change="(value) => (active = value)" @change="(value) => (active = value)"
/> />
</div> </div>
<div v-if="expenses.length === 0" class="flex-1 w-full h-full flex-center"> <div v-if="expenses.length === 0" class="flex-1 w-full h-full flex-center">
<span class="text-base text-gray-600"> <span class="text-base text-gray-600">
{{ _('No expenses in this period') }} {{ t('No expenses in this period') }}
</span> </span>
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="flex flex-col h-full"> <div class="flex flex-col h-full">
<SectionHeader> <SectionHeader>
<template slot="title">{{ _('Profit and Loss') }}</template> <template slot="title">{{ t('Profit and Loss') }}</template>
<PeriodSelector <PeriodSelector
slot="action" slot="action"
:value="period" :value="period"
@ -11,7 +11,7 @@
<div v-show="hasData" class="chart-wrapper" ref="profit-and-loss"></div> <div v-show="hasData" class="chart-wrapper" ref="profit-and-loss"></div>
<div class="flex-1 w-full h-full flex-center my-20" v-if="!hasData"> <div class="flex-1 w-full h-full flex-center my-20" v-if="!hasData">
<span class="text-base text-gray-600"> <span class="text-base text-gray-600">
{{ _('No transactions yet') }} {{ t('No transactions yet') }}
</span> </span>
</div> </div>
</div> </div>

View File

@ -31,7 +31,7 @@
> >
{{ frappe.format(invoice.paid, 'Currency') }} {{ frappe.format(invoice.paid, 'Currency') }}
<span :class="{ 'text-gray-600': invoice.hasData }">{{ <span :class="{ 'text-gray-600': invoice.hasData }">{{
_('Paid') t('Paid')
}}</span> }}</span>
</div> </div>
<div <div
@ -40,7 +40,7 @@
> >
{{ frappe.format(invoice.unpaid, 'Currency') }} {{ frappe.format(invoice.unpaid, 'Currency') }}
<span :class="{ 'text-gray-600': invoice.hasData }">{{ <span :class="{ 'text-gray-600': invoice.hasData }">{{
_('Unpaid') t('Unpaid')
}}</span> }}</span>
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<div class="p-4"> <div class="p-4">
<h4 class="pb-2">{{ _('Data Import') }}</h4> <h4 class="pb-2">{{ t('Data Import') }}</h4>
<frappe-control <frappe-control
:docfield="{ :docfield="{
fieldtype: 'Select', fieldtype: 'Select',
@ -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(

View File

@ -9,15 +9,15 @@
<div class="w-full"> <div class="w-full">
<div class="px-12"> <div class="px-12">
<h1 class="text-2xl font-semibold"> <h1 class="text-2xl font-semibold">
{{ _('Welcome to Frappe Books') }} {{ t('Welcome to Frappe Books') }}
</h1> </h1>
<p class="text-gray-600 text-base" v-if="!showFiles"> <p class="text-gray-600 text-base" v-if="!showFiles">
{{ {{
_('Create a new file or select an existing one from your computer') t('Create a new file or select an existing one from your computer')
}} }}
</p> </p>
<p class="text-gray-600 text-base" v-if="showFiles"> <p class="text-gray-600 text-base" v-if="showFiles">
{{ _('Select a file to load the company transactions') }} {{ t('Select a file to load the company transactions') }}
</p> </p>
</div> </div>
<div class="px-12 mt-10 window-no-drag" v-if="!showFiles"> <div class="px-12 mt-10 window-no-drag" v-if="!showFiles">
@ -49,14 +49,14 @@
<template <template
v-if="loadingDatabase && fileSelectedFrom === 'New File'" v-if="loadingDatabase && fileSelectedFrom === 'New File'"
> >
{{ _('Loading...') }} {{ t('Loading...') }}
</template> </template>
<template v-else> <template v-else>
{{ _('New File') }} {{ t('New File') }}
</template> </template>
</div> </div>
<div class="mt-2 text-sm text-gray-600 text-center"> <div class="mt-2 text-sm text-gray-600 text-center">
{{ _('Create a new file and store it in your computer.') }} {{ t('Create a new file and store it in your computer.') }}
</div> </div>
</div> </div>
<div <div
@ -85,14 +85,14 @@
<template <template
v-if="loadingDatabase && fileSelectedFrom === 'Existing File'" v-if="loadingDatabase && fileSelectedFrom === 'Existing File'"
> >
{{ _('Loading...') }} {{ t('Loading...') }}
</template> </template>
<template v-else> <template v-else>
{{ _('Existing File') }} {{ t('Existing File') }}
</template> </template>
</div> </div>
<div class="mt-2 text-sm text-gray-600 text-center"> <div class="mt-2 text-sm text-gray-600 text-center">
{{ _('Load an existing .db file from your computer.') }} {{ t('Load an existing .db file from your computer.') }}
</div> </div>
</div> </div>
</div> </div>
@ -127,7 +127,7 @@
<div class="flex items-baseline"> <div class="flex items-baseline">
<span> <span>
<template v-if="loadingDatabase && fileSelectedFrom === file"> <template v-if="loadingDatabase && fileSelectedFrom === file">
{{ _('Loading...') }} {{ t('Loading...') }}
</template> </template>
<template v-else> <template v-else>
{{ file.companyName }} {{ file.companyName }}
@ -195,7 +195,7 @@ export default {
this.fileSelectedFrom = 'Existing File'; this.fileSelectedFrom = 'Existing File';
const filePath = ( const filePath = (
await ipcRenderer.invoke(IPC_ACTIONS.GET_OPEN_FILEPATH, { await ipcRenderer.invoke(IPC_ACTIONS.GET_OPEN_FILEPATH, {
title: this._('Select file'), title: this.t('Select file'),
properties: ['openFile'], properties: ['openFile'],
filters: [{ name: 'SQLite DB File', extensions: ['db'] }], filters: [{ name: 'SQLite DB File', extensions: ['db'] }],
}) })

View File

@ -2,7 +2,7 @@
<div class="flex flex-col overflow-y-hidden"> <div class="flex flex-col overflow-y-hidden">
<PageHeader> <PageHeader>
<h1 slot="title" class="text-2xl font-bold"> <h1 slot="title" class="text-2xl font-bold">
{{ _('Setup your workspace') }} {{ t('Setup your workspace') }}
</h1> </h1>
</PageHeader> </PageHeader>
<div class="px-8"> <div class="px-8">
@ -59,7 +59,7 @@
@click="handleAction(item)" @click="handleAction(item)"
> >
<span class="text-base text-white"> <span class="text-base text-white">
{{ item.actionLabel || _('Setup') }} {{ item.actionLabel || t('Setup') }}
</span> </span>
</Button> </Button>
<Button <Button
@ -69,7 +69,7 @@
@click="handleDocumentation(item)" @click="handleDocumentation(item)"
> >
<span class="text-base"> <span class="text-base">
{{ _('Documentation') }} {{ t('Documentation') }}
</span> </span>
</Button> </Button>
</div> </div>
@ -83,7 +83,7 @@
<script> <script>
import frappe from 'frappe'; import frappe from 'frappe';
import { _ } from 'frappe/utils'; import { t } from 'frappe';
import PageHeader from '@/components/PageHeader'; import PageHeader from '@/components/PageHeader';
import Icon from '@/components/Icon'; import Icon from '@/components/Icon';
import Button from '@/components/Button'; import Button from '@/components/Button';
@ -104,12 +104,12 @@ export default {
/* eslint-disable vue/no-side-effects-in-computed-properties */ /* eslint-disable vue/no-side-effects-in-computed-properties */
return [ return [
{ {
label: _('Organisation'), label: t('Organisation'),
items: [ items: [
{ {
key: 'Invoice', key: 'Invoice',
label: _('Invoice'), label: t('Invoice'),
icon: 'invoice', icon: 'invoice',
description: description:
'Customize your invoices by adding a logo and address details', 'Customize your invoices by adding a logo and address details',
@ -120,7 +120,7 @@ export default {
}, },
{ {
key: 'General', key: 'General',
label: _('General'), label: t('General'),
icon: 'general', icon: 'general',
description: description:
'Setup your company information, email, country and fiscal year', 'Setup your company information, email, country and fiscal year',
@ -131,7 +131,7 @@ export default {
}, },
{ {
key: 'System', key: 'System',
label: _('System'), label: t('System'),
icon: 'system', icon: 'system',
description: description:
'Setup system defaults like date format and display precision', 'Setup system defaults like date format and display precision',
@ -143,12 +143,12 @@ export default {
], ],
}, },
{ {
label: _('Accounts'), label: t('Accounts'),
items: [ items: [
{ {
key: 'Review Accounts', key: 'Review Accounts',
label: _('Review Accounts'), label: t('Review Accounts'),
icon: 'review-ac', icon: 'review-ac',
description: description:
'Review your chart of accounts, add any account or tax heads as needed', 'Review your chart of accounts, add any account or tax heads as needed',
@ -161,7 +161,7 @@ export default {
}, },
{ {
key: 'Opening Balances', key: 'Opening Balances',
label: _('Opening Balances'), label: t('Opening Balances'),
icon: 'opening-ac', icon: 'opening-ac',
fieldname: 'openingBalanceChecked', fieldname: 'openingBalanceChecked',
description: description:
@ -171,7 +171,7 @@ export default {
}, },
{ {
key: 'Add Taxes', key: 'Add Taxes',
label: _('Add Taxes'), label: t('Add Taxes'),
icon: 'percentage', icon: 'percentage',
fieldname: 'taxesAdded', fieldname: 'taxesAdded',
description: description:
@ -183,12 +183,12 @@ export default {
], ],
}, },
{ {
label: _('Sales'), label: t('Sales'),
items: [ items: [
{ {
key: 'Add Sales Items', key: 'Add Sales Items',
label: _('Add Items'), label: t('Add Items'),
icon: 'item', icon: 'item',
description: description:
'Add products or services that you sell to your customers', 'Add products or services that you sell to your customers',
@ -199,7 +199,7 @@ export default {
}, },
{ {
key: 'Add Customers', key: 'Add Customers',
label: _('Add Customers'), label: t('Add Customers'),
icon: 'customer', icon: 'customer',
description: 'Add a few customers to create your first invoice', description: 'Add a few customers to create your first invoice',
action: () => routeTo('/list/Customer'), action: () => routeTo('/list/Customer'),
@ -209,7 +209,7 @@ export default {
}, },
{ {
key: 'Create Invoice', key: 'Create Invoice',
label: _('Create Invoice'), label: t('Create Invoice'),
icon: 'sales-invoice', icon: 'sales-invoice',
description: description:
'Create your first invoice and mail it to your customer', 'Create your first invoice and mail it to your customer',
@ -220,12 +220,12 @@ export default {
], ],
}, },
{ {
label: _('Purchase'), label: t('Purchase'),
items: [ items: [
{ {
key: 'Add Purchase Items', key: 'Add Purchase Items',
label: _('Add Items'), label: t('Add Items'),
icon: 'item', icon: 'item',
description: description:
'Add products or services that you buy from your suppliers', 'Add products or services that you buy from your suppliers',
@ -234,7 +234,7 @@ export default {
}, },
{ {
key: 'Add Suppliers', key: 'Add Suppliers',
label: _('Add Suppliers'), label: t('Add Suppliers'),
icon: 'supplier', icon: 'supplier',
description: 'Add a few suppliers to create your first bill', description: 'Add a few suppliers to create your first bill',
action: () => routeTo('/list/Supplier'), action: () => routeTo('/list/Supplier'),
@ -242,7 +242,7 @@ export default {
}, },
{ {
key: 'Create Bill', key: 'Create Bill',
label: _('Create Bill'), label: t('Create Bill'),
icon: 'purchase-invoice', icon: 'purchase-invoice',
description: description:
'Create your first bill and mail it to your supplier', 'Create your first bill and mail it to your supplier',

View File

@ -19,14 +19,14 @@
class="text-white text-xs ml-2" class="text-white text-xs ml-2"
@click="onSaveClick" @click="onSaveClick"
> >
{{ _('Save') }} {{ t('Save') }}
</Button> </Button>
<Button <Button
v-if="!doc._dirty && !doc._notInserted && !doc.submitted" v-if="!doc._dirty && !doc._notInserted && !doc.submitted"
type="primary" type="primary"
class="text-white text-xs ml-2" class="text-white text-xs ml-2"
@click="onSubmitClick" @click="onSubmitClick"
>{{ _('Submit') }}</Button >{{ t('Submit') }}</Button
> >
</template> </template>
</PageHeader> </PageHeader>
@ -63,8 +63,8 @@
{{ {{
doc._notInserted doc._notInserted
? doc.doctype === 'SalesInvoice' ? doc.doctype === 'SalesInvoice'
? _('New Invoice') ? t('New Invoice')
: _('New Bill') : t('New Bill')
: doc.name : doc.name
}} }}
</h1> </h1>
@ -132,7 +132,7 @@
</div> </div>
<div class="w-64"> <div class="w-64">
<div class="flex pl-2 justify-between py-3 border-b"> <div class="flex pl-2 justify-between py-3 border-b">
<div>{{ _('Subtotal') }}</div> <div>{{ t('Subtotal') }}</div>
<div>{{ formattedValue('netTotal') }}</div> <div>{{ formattedValue('netTotal') }}</div>
</div> </div>
<div <div
@ -162,7 +162,7 @@
text-base text-base
" "
> >
<div>{{ _('Grand Total') }}</div> <div>{{ t('Grand Total') }}</div>
<div>{{ formattedValue('grandTotal') }}</div> <div>{{ formattedValue('grandTotal') }}</div>
</div> </div>
<div <div
@ -178,7 +178,7 @@
text-base text-base
" "
> >
<div>{{ _('Outstanding Amount') }}</div> <div>{{ t('Outstanding Amount') }}</div>
<div>{{ formattedValue('outstandingAmount') }}</div> <div>{{ formattedValue('outstandingAmount') }}</div>
</div> </div>
</div> </div>
@ -288,19 +288,19 @@ export default {
onSubmitClick() { onSubmitClick() {
let message = let message =
this.doctype === 'SalesInvoice' this.doctype === 'SalesInvoice'
? this._('Are you sure you want to submit this Invoice?') ? this.t('Are you sure you want to submit this Invoice?')
: this._('Are you sure you want to submit this Bill?'); : this.t('Are you sure you want to submit this Bill?');
showMessageDialog({ showMessageDialog({
message, message,
buttons: [ buttons: [
{ {
label: this._('Yes'), label: this.t('Yes'),
action: () => { action: () => {
this.doc.submit().catch(this.handleError); this.doc.submit().catch(this.handleError);
}, },
}, },
{ {
label: this._('No'), label: this.t('No'),
action() {}, action() {},
}, },
], ],

View File

@ -11,7 +11,7 @@
class="text-white text-xs ml-2" class="text-white text-xs ml-2"
@click="onSaveClick" @click="onSaveClick"
> >
{{ _('Save') }} {{ t('Save') }}
</Button> </Button>
<Button <Button
v-if="!doc._dirty && !doc._notInserted && !doc.submitted" v-if="!doc._dirty && !doc._notInserted && !doc.submitted"
@ -19,7 +19,7 @@
class="text-white text-xs ml-2" class="text-white text-xs ml-2"
@click="onSubmitClick" @click="onSubmitClick"
> >
{{ _('Submit') }} {{ t('Submit') }}
</Button> </Button>
</template> </template>
</PageHeader> </PageHeader>
@ -31,7 +31,7 @@
<div> <div>
<div class="mt-8 px-6"> <div class="mt-8 px-6">
<h1 class="text-2xl font-semibold"> <h1 class="text-2xl font-semibold">
{{ doc._notInserted ? _('New Journal Entry') : doc.name }} {{ doc._notInserted ? t('New Journal Entry') : doc.name }}
</h1> </h1>
<div class="flex justify-between mt-2"> <div class="flex justify-between mt-2">
<div class="w-1/3"> <div class="w-1/3">
@ -200,16 +200,16 @@ export default {
}, },
async onSubmitClick() { async onSubmitClick() {
showMessageDialog({ showMessageDialog({
message: this._('Are you sure you want to submit this Journal Entry?'), message: this.t('Are you sure you want to submit this Journal Entry?'),
buttons: [ buttons: [
{ {
label: this._('Yes'), label: this.t('Yes'),
action: () => { action: () => {
this.doc.submit().catch(this.handleError); this.doc.submit().catch(this.handleError);
}, },
}, },
{ {
label: this._('No'), label: this.t('No'),
action() {}, action() {},
}, },
], ],

View File

@ -8,10 +8,10 @@
class="text-gray-900 text-xs ml-2" class="text-gray-900 text-xs ml-2"
@click="showCustomiser = !showCustomiser" @click="showCustomiser = !showCustomiser"
> >
{{ _('Customise') }} {{ t('Customise') }}
</Button> </Button>
<Button class="text-gray-900 text-xs ml-2" @click="makePDF"> <Button class="text-gray-900 text-xs ml-2" @click="makePDF">
{{ _('Save as PDF') }} {{ t('Save as PDF') }}
</Button> </Button>
</template> </template>
</PageHeader> </PageHeader>
@ -39,7 +39,7 @@
</div> </div>
<div class="border-l w-80" v-if="showCustomiser"> <div class="border-l w-80" v-if="showCustomiser">
<div class="mt-4 px-4 flex items-center justify-between"> <div class="mt-4 px-4 flex items-center justify-between">
<h2 class="font-semibold">{{ _('Customise') }}</h2> <h2 class="font-semibold">{{ t('Customise') }}</h2>
<Button :icon="true" @click="showCustomiser = false"> <Button :icon="true" @click="showCustomiser = false">
<feather-icon name="x" class="w-4 h-4" /> <feather-icon name="x" class="w-4 h-4" />
</Button> </Button>
@ -100,7 +100,7 @@ export default {
}, },
async getSavePath() { async getSavePath() {
const options = { const options = {
title: this._('Select folder'), title: this.t('Select folder'),
defaultPath: `${this.name}.pdf`, defaultPath: `${this.name}.pdf`,
}; };

View File

@ -19,7 +19,7 @@
v-if="doc && doc._notInserted" v-if="doc && doc._notInserted"
class="ml-2 text-white text-xs" class="ml-2 text-white text-xs"
> >
{{ _('Save') }} {{ t('Save') }}
</Button> </Button>
<Button <Button
:icon="true" :icon="true"
@ -35,7 +35,7 @@
" "
class="ml-2 text-white text-xs" class="ml-2 text-white text-xs"
> >
{{ _('Submit') }} {{ t('Submit') }}
</Button> </Button>
</div> </div>
</div> </div>
@ -78,7 +78,7 @@
<script> <script>
import frappe from 'frappe'; import frappe from 'frappe';
import { _ } from 'frappe'; import { t } from 'frappe';
import Button from '@/components/Button'; import Button from '@/components/Button';
import StatusBadge from '@/components/StatusBadge'; import StatusBadge from '@/components/StatusBadge';
import FormControl from '@/components/Controls/FormControl'; import FormControl from '@/components/Controls/FormControl';
@ -183,7 +183,7 @@ export default {
}); });
}); });
this.doc.on('beforeUpdate', () => { this.doc.on('beforeUpdate', () => {
this.statusText = _('Saving...'); this.statusText = t('Saving...');
}); });
this.doc.on('afterUpdate', () => { this.doc.on('afterUpdate', () => {
setTimeout(() => { setTimeout(() => {

View File

@ -295,7 +295,7 @@ export default {
}) })
) ?? []), ) ?? []),
{ {
label: this._('Reset Filters'), label: this.t('Reset Filters'),
action: this.resetFilters, action: this.resetFilters,
}, },
]; ];

View File

@ -2,7 +2,7 @@
<div class="flex flex-col overflow-hidden"> <div class="flex flex-col overflow-hidden">
<PageHeader> <PageHeader>
<h1 slot="title" class="text-2xl font-bold"> <h1 slot="title" class="text-2xl font-bold">
{{ _('Settings') }} {{ t('Settings') }}
</h1> </h1>
</PageHeader> </PageHeader>
<div class="flex justify-center flex-1 mb-8 mt-2"> <div class="flex justify-center flex-1 mb-8 mt-2">
@ -47,7 +47,7 @@
</div> </div>
</template> </template>
<script> <script>
import { _ } from 'frappe/utils'; import { t } from 'frappe';
import frappe from 'frappe'; import frappe from 'frappe';
import WindowControls from '@/components/WindowControls'; import WindowControls from '@/components/WindowControls';
import TabGeneral from './TabGeneral.vue'; import TabGeneral from './TabGeneral.vue';
@ -77,17 +77,17 @@ export default {
fieldsChanged: [], fieldsChanged: [],
tabs: [ tabs: [
{ {
label: _('Invoice'), label: t('Invoice'),
icon: 'invoice', icon: 'invoice',
component: TabInvoice, component: TabInvoice,
}, },
{ {
label: _('General'), label: t('General'),
icon: 'general', icon: 'general',
component: TabGeneral, component: TabGeneral,
}, },
{ {
label: _('System'), label: t('System'),
icon: 'system', icon: 'system',
component: TabSystem, component: TabSystem,
}, },
@ -114,8 +114,8 @@ export default {
methods: { methods: {
showReloadToast() { showReloadToast() {
showToast({ showToast({
message: _('Settings changes will be visible on reload'), message: t('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');
@ -131,7 +131,7 @@ export default {
}, },
setActiveTab() { setActiveTab() {
const { tab } = this.$route.query; const { tab } = this.$route.query;
const index = this.tabs.findIndex((t) => t.label === _(tab || 'Invoice')); const index = this.tabs.findIndex((i) => i.label === t(tab || 'Invoice'));
if (index !== -1) { if (index !== -1) {
this.activeTab = index; this.activeTab = index;
} }

View File

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

View File

@ -6,7 +6,7 @@
}" }"
> >
<div class="px-12"> <div class="px-12">
<h1 class="text-2xl font-semibold">{{ _('Setup your organization') }}</h1> <h1 class="text-2xl font-semibold">{{ t('Setup your organization') }}</h1>
</div> </div>
<div class="px-8 mt-5 window-no-drag" v-if="doc"> <div class="px-8 mt-5 window-no-drag" v-if="doc">
<div class="flex items-center px-6 py-5 mb-4 border bg-brand rounded-xl"> <div class="flex items-center px-6 py-5 mb-4 border bg-brand rounded-xl">
@ -128,7 +128,7 @@ export default {
}, },
async submit() { async submit() {
if (!this.allValuesFilled()) { if (!this.allValuesFilled()) {
showMessageDialog({ message: this._('Please fill all values') }); showMessageDialog({ message: this.t('Please fill all values') });
return; return;
} }
@ -176,7 +176,7 @@ export default {
return this.meta.getQuickEditFields(); return this.meta.getQuickEditFields();
}, },
buttonText() { buttonText() {
return this.loading ? this._('Setting Up...') : this._('Submit'); return this.loading ? this.t('Setting Up...') : this.t('Submit');
}, },
}, },
}; };

View File

@ -1,5 +1,5 @@
import frappe from 'frappe'; import frappe from 'frappe';
import { _ } from 'frappe/utils'; import { t } from 'frappe';
import Icon from './components/Icon'; import Icon from './components/Icon';
const config = { const config = {
@ -9,120 +9,120 @@ const config = {
}, },
getGroups: () => [ getGroups: () => [
{ {
title: _('Get Started'), title: t('Get Started'),
route: '/get-started', route: '/get-started',
icon: getIcon('general', '24', '5'), icon: getIcon('general', '24', '5'),
}, },
{ {
title: _('Dashboard'), title: t('Dashboard'),
route: '/', route: '/',
icon: getIcon('dashboard'), icon: getIcon('dashboard'),
}, },
{ {
title: _('Sales'), title: t('Sales'),
icon: getIcon('sales'), icon: getIcon('sales'),
route: '/list/SalesInvoice', route: '/list/SalesInvoice',
items: [ items: [
{ {
label: _('Invoices'), label: t('Invoices'),
route: '/list/SalesInvoice', route: '/list/SalesInvoice',
doctype: 'SalesInvoice', doctype: 'SalesInvoice',
}, },
{ {
label: _('Customers'), label: t('Customers'),
route: '/list/Customer', route: '/list/Customer',
doctype: 'Customer', doctype: 'Customer',
}, },
], ],
}, },
{ {
title: _('Purchases'), title: t('Purchases'),
icon: getIcon('purchase'), icon: getIcon('purchase'),
route: '/list/PurchaseInvoice', route: '/list/PurchaseInvoice',
items: [ items: [
{ {
label: _('Bills'), label: t('Bills'),
route: '/list/PurchaseInvoice', route: '/list/PurchaseInvoice',
doctype: 'PurchaseInvoice', doctype: 'PurchaseInvoice',
}, },
{ {
label: _('Suppliers'), label: t('Suppliers'),
route: '/list/Supplier', route: '/list/Supplier',
doctype: 'Supplier', doctype: 'Supplier',
}, },
], ],
}, },
{ {
title: _('Common Entries'), title: t('Common Entries'),
icon: getIcon('common-entries'), icon: getIcon('common-entries'),
route: '/list/Item', route: '/list/Item',
items: [ items: [
{ {
label: _('Items'), label: t('Items'),
route: '/list/Item', route: '/list/Item',
doctype: 'Item', doctype: 'Item',
}, },
{ {
label: _('Payments'), label: t('Payments'),
route: '/list/Payment', route: '/list/Payment',
doctype: 'Payment', doctype: 'Payment',
}, },
{ {
label: _('Journal Entry'), label: t('Journal Entry'),
route: '/list/JournalEntry', route: '/list/JournalEntry',
doctype: 'JournalEntry', doctype: 'JournalEntry',
}, },
], ],
}, },
{ {
title: _('Reports'), title: t('Reports'),
icon: getIcon('reports'), icon: getIcon('reports'),
route: '/report/general-ledger', route: '/report/general-ledger',
items: [ items: [
{ {
label: _('General Ledger'), label: t('General Ledger'),
route: '/report/general-ledger', route: '/report/general-ledger',
}, },
{ {
label: _('Profit And Loss'), label: t('Profit And Loss'),
route: '/report/profit-and-loss', route: '/report/profit-and-loss',
}, },
{ {
label: _('Balance Sheet'), label: t('Balance Sheet'),
route: '/report/balance-sheet', route: '/report/balance-sheet',
}, },
{ {
label: _('Trial Balance'), label: t('Trial Balance'),
route: '/report/trial-balance', route: '/report/trial-balance',
}, },
{ {
label: _('GSTR1'), label: t('GSTR1'),
route: '/report/gstr-1', route: '/report/gstr-1',
hidden: () => frappe.AccountingSettings.country !== 'India', hidden: () => frappe.AccountingSettings.country !== 'India',
}, },
{ {
label: _('GSTR2'), label: t('GSTR2'),
route: '/report/gstr-2', route: '/report/gstr-2',
hidden: () => frappe.AccountingSettings.country !== 'India', hidden: () => frappe.AccountingSettings.country !== 'India',
}, },
], ],
}, },
{ {
title: _('Setup'), title: t('Setup'),
icon: getIcon('settings'), icon: getIcon('settings'),
route: '/chart-of-accounts', route: '/chart-of-accounts',
items: [ items: [
{ {
label: _('Chart of Accounts'), label: t('Chart of Accounts'),
route: '/chart-of-accounts', route: '/chart-of-accounts',
}, },
{ {
label: _('Taxes'), label: t('Taxes'),
route: '/list/Tax', route: '/list/Tax',
doctype: 'Tax', doctype: 'Tax',
}, },
{ {
label: _('Settings'), label: t('Settings'),
route: '/settings', route: '/settings',
}, },
], ],

View File

@ -3,7 +3,7 @@ import Toast from '@/components/Toast';
import router from '@/router'; import router from '@/router';
import { ipcRenderer } from 'electron'; import { ipcRenderer } from 'electron';
import frappe from 'frappe'; import frappe from 'frappe';
import { isPesa, _ } from 'frappe/utils'; import { isPesa, t } from 'frappe/utils';
import lodash from 'lodash'; import lodash from 'lodash';
import Vue from 'vue'; import Vue from 'vue';
import { IPC_ACTIONS, IPC_MESSAGES } from './messages'; import { IPC_ACTIONS, IPC_MESSAGES } from './messages';
@ -43,14 +43,14 @@ export async function showErrorDialog({ title, content }) {
export function deleteDocWithPrompt(doc) { export function deleteDocWithPrompt(doc) {
return new Promise((resolve) => { return new Promise((resolve) => {
showMessageDialog({ showMessageDialog({
message: _('Are you sure you want to delete {0} "{1}"?', [ message: t('Are you sure you want to delete {0} "{1}"?', [
doc.doctype, doc.doctype,
doc.name, doc.name,
]), ]),
description: _('This action is permanent'), description: t('This action is permanent'),
buttons: [ buttons: [
{ {
label: _('Delete'), label: t('Delete'),
action: () => { action: () => {
doc doc
.delete() .delete()
@ -61,7 +61,7 @@ export function deleteDocWithPrompt(doc) {
}, },
}, },
{ {
label: _('Cancel'), label: t('Cancel'),
action() { action() {
resolve(false); resolve(false);
}, },
@ -74,14 +74,14 @@ export function deleteDocWithPrompt(doc) {
export function cancelDocWithPrompt(doc) { export function cancelDocWithPrompt(doc) {
return new Promise((resolve) => { return new Promise((resolve) => {
showMessageDialog({ showMessageDialog({
message: _('Are you sure you want to cancel {0} "{1}"?', [ message: t('Are you sure you want to cancel {0} "{1}"?', [
doc.doctype, doc.doctype,
doc.name, doc.name,
]), ]),
description: _('This action is permanent'), description: t('This action is permanent'),
buttons: [ buttons: [
{ {
label: _('Yes'), label: t('Yes'),
async action() { async action() {
const entryDoc = await frappe.getDoc(doc.doctype, doc.name); const entryDoc = await frappe.getDoc(doc.doctype, doc.name);
entryDoc.cancelled = 1; entryDoc.cancelled = 1;
@ -95,7 +95,7 @@ export function cancelDocWithPrompt(doc) {
}, },
}, },
{ {
label: _('No'), label: t('No'),
action() { action() {
resolve(false); resolve(false);
}, },
@ -152,16 +152,16 @@ export function openQuickEdit({ doctype, name, hideFields, defaults = {} }) {
} }
export function getErrorMessage(e, doc) { export function getErrorMessage(e, doc) {
let errorMessage = e.message || _('An error occurred.'); let errorMessage = e.message || t('An error occurred.');
const { doctype, name } = doc; const { doctype, name } = doc;
const canElaborate = doctype && name; const canElaborate = doctype && name;
if (e.type === frappe.errors.LinkValidationError && canElaborate) { if (e.type === frappe.errors.LinkValidationError && canElaborate) {
errorMessage = _('{0} {1} is linked with existing records.', [ errorMessage = t('{0} {1} is linked with existing records.', [
doctype, doctype,
name, name,
]); ]);
} else if (e.type === frappe.errors.DuplicateEntryError && canElaborate) { } else if (e.type === frappe.errors.DuplicateEntryError && canElaborate) {
errorMessage = _('{0} {1} already exists.', [doctype, name]); errorMessage = t('{0} {1} already exists.', [doctype, name]);
} }
return errorMessage; return errorMessage;
} }
@ -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);
@ -201,7 +201,7 @@ export function getActionsForDocument(doc) {
let deleteAction = { let deleteAction = {
component: { component: {
template: `<span class="text-red-700">{{ _('Delete') }}</span>`, template: `<span class="text-red-700">{{ t('Delete') }}</span>`,
}, },
condition: (doc) => condition: (doc) =>
!doc.isNew() && !doc.submitted && !doc.meta.isSingle && !doc.cancelled, !doc.isNew() && !doc.submitted && !doc.meta.isSingle && !doc.cancelled,
@ -215,7 +215,7 @@ export function getActionsForDocument(doc) {
let cancelAction = { let cancelAction = {
component: { component: {
template: `<span class="text-red-700">{{ _('Cancel') }}</span>`, template: `<span class="text-red-700">{{ t('Cancel') }}</span>`,
}, },
condition: (doc) => doc.submitted && !doc.cancelled, condition: (doc) => doc.submitted && !doc.cancelled,
action: () => { action: () => {
@ -323,7 +323,7 @@ export async function getSavePath(name, extention) {
let { canceled, filePath } = await ipcRenderer.invoke( let { canceled, filePath } = await ipcRenderer.invoke(
IPC_ACTIONS.GET_SAVE_FILEPATH, IPC_ACTIONS.GET_SAVE_FILEPATH,
{ {
title: _('Select Folder'), title: t('Select Folder'),
defaultPath: `${name}.${extention}`, defaultPath: `${name}.${extention}`,
} }
); );