diff --git a/accounting/gst.js b/accounting/gst.js
index c3f8f9d0..8f9687e9 100644
--- a/accounting/gst.js
+++ b/accounting/gst.js
@@ -1,6 +1,6 @@
import { showMessageDialog } from '@/utils';
import frappe from 'frappe';
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
import { DateTime } from 'luxon';
import { exportCsv, saveExportData } from '../reports/commonExporter';
import { getSavePath } from '../src/utils';
@@ -89,8 +89,8 @@ export async function generateGstr1Json(getReportData) {
const { gstin } = frappe.AccountingSettings;
if (!gstin) {
showMessageDialog({
- message: _('Export Failed'),
- description: _('Please set GSTIN in General Settings.'),
+ message: t('Export Failed'),
+ description: t('Please set GSTIN in General Settings.'),
});
return;
}
@@ -269,8 +269,8 @@ export async function generateGstr2Csv(getReportData) {
const { gstin } = frappe.AccountingSettings;
if (!gstin) {
showMessageDialog({
- message: _('Export Failed'),
- description: _('Please set GSTIN in General Settings.'),
+ message: t('Export Failed'),
+ description: t('Please set GSTIN in General Settings.'),
});
return;
}
@@ -350,8 +350,8 @@ export async function generateGstr1Csv(getReportData) {
const { gstin } = frappe.AccountingSettings;
if (!gstin) {
showMessageDialog({
- message: _('Export Failed'),
- description: _('Please set GSTIN in General Settings.'),
+ message: t('Export Failed'),
+ description: t('Please set GSTIN in General Settings.'),
});
return;
}
diff --git a/fixtures/standardCOA.js b/fixtures/standardCOA.js
index f793474d..35441735 100644
--- a/fixtures/standardCOA.js
+++ b/fixtures/standardCOA.js
@@ -1,171 +1,170 @@
-import frappe from 'frappe';
-const _ = frappe._.bind(frappe);
+import { t } from 'frappe';
export default {
- [_('Application of Funds (Assets)')]: {
- [_('Current Assets')]: {
- [_('Accounts Receivable')]: {
- [_('Debtors')]: {
+ [t('Application of Funds (Assets)')]: {
+ [t('Current Assets')]: {
+ [t('Accounts Receivable')]: {
+ [t('Debtors')]: {
accountType: 'Receivable',
},
},
- [_('Bank Accounts')]: {
+ [t('Bank Accounts')]: {
accountType: 'Bank',
isGroup: 1,
},
- [_('Cash In Hand')]: {
- [_('Cash')]: {
+ [t('Cash In Hand')]: {
+ [t('Cash')]: {
accountType: 'Cash',
},
accountType: 'Cash',
},
- [_('Loans and Advances (Assets)')]: {
+ [t('Loans and Advances (Assets)')]: {
isGroup: 1,
},
- [_('Securities and Deposits')]: {
- [_('Earnest Money')]: {},
+ [t('Securities and Deposits')]: {
+ [t('Earnest Money')]: {},
},
- [_('Stock Assets')]: {
- [_('Stock In Hand')]: {
+ [t('Stock Assets')]: {
+ [t('Stock In Hand')]: {
accountType: 'Stock',
},
accountType: 'Stock',
},
- [_('Tax Assets')]: {
+ [t('Tax Assets')]: {
isGroup: 1,
},
},
- [_('Fixed Assets')]: {
- [_('Capital Equipments')]: {
+ [t('Fixed Assets')]: {
+ [t('Capital Equipments')]: {
accountType: 'Fixed Asset',
},
- [_('Electronic Equipments')]: {
+ [t('Electronic Equipments')]: {
accountType: 'Fixed Asset',
},
- [_('Furnitures and Fixtures')]: {
+ [t('Furnitures and Fixtures')]: {
accountType: 'Fixed Asset',
},
- [_('Office Equipments')]: {
+ [t('Office Equipments')]: {
accountType: 'Fixed Asset',
},
- [_('Plants and Machineries')]: {
+ [t('Plants and Machineries')]: {
accountType: 'Fixed Asset',
},
- [_('Buildings')]: {
+ [t('Buildings')]: {
accountType: 'Fixed Asset',
},
- [_('Softwares')]: {
+ [t('Softwares')]: {
accountType: 'Fixed Asset',
},
- [_('Accumulated Depreciation')]: {
+ [t('Accumulated Depreciation')]: {
accountType: 'Accumulated Depreciation',
},
},
- [_('Investments')]: {
+ [t('Investments')]: {
isGroup: 1,
},
- [_('Temporary Accounts')]: {
- [_('Temporary Opening')]: {
+ [t('Temporary Accounts')]: {
+ [t('Temporary Opening')]: {
accountType: 'Temporary',
},
},
rootType: 'Asset',
},
- [_('Expenses')]: {
- [_('Direct Expenses')]: {
- [_('Stock Expenses')]: {
- [_('Cost of Goods Sold')]: {
+ [t('Expenses')]: {
+ [t('Direct Expenses')]: {
+ [t('Stock Expenses')]: {
+ [t('Cost of Goods Sold')]: {
accountType: 'Cost of Goods Sold',
},
- [_('Expenses Included In Valuation')]: {
+ [t('Expenses Included In Valuation')]: {
accountType: 'Expenses Included In Valuation',
},
- [_('Stock Adjustment')]: {
+ [t('Stock Adjustment')]: {
accountType: 'Stock Adjustment',
},
},
},
- [_('Indirect Expenses')]: {
- [_('Administrative Expenses')]: {},
- [_('Commission on Sales')]: {},
- [_('Depreciation')]: {
+ [t('Indirect Expenses')]: {
+ [t('Administrative Expenses')]: {},
+ [t('Commission on Sales')]: {},
+ [t('Depreciation')]: {
accountType: 'Depreciation',
},
- [_('Entertainment Expenses')]: {},
- [_('Freight and Forwarding Charges')]: {
+ [t('Entertainment Expenses')]: {},
+ [t('Freight and Forwarding Charges')]: {
accountType: 'Chargeable',
},
- [_('Legal Expenses')]: {},
- [_('Marketing Expenses')]: {
+ [t('Legal Expenses')]: {},
+ [t('Marketing Expenses')]: {
accountType: 'Chargeable',
},
- [_('Miscellaneous Expenses')]: {
+ [t('Miscellaneous Expenses')]: {
accountType: 'Chargeable',
},
- [_('Office Maintenance Expenses')]: {},
- [_('Office Rent')]: {},
- [_('Postal Expenses')]: {},
- [_('Print and Stationery')]: {},
- [_('Round Off')]: {
+ [t('Office Maintenance Expenses')]: {},
+ [t('Office Rent')]: {},
+ [t('Postal Expenses')]: {},
+ [t('Print and Stationery')]: {},
+ [t('Round Off')]: {
accountType: 'Round Off',
},
- [_('Salary')]: {},
- [_('Sales Expenses')]: {},
- [_('Telephone Expenses')]: {},
- [_('Travel Expenses')]: {},
- [_('Utility Expenses')]: {},
- [_('Write Off')]: {},
- [_('Exchange Gain/Loss')]: {},
- [_('Gain/Loss on Asset Disposal')]: {},
+ [t('Salary')]: {},
+ [t('Sales Expenses')]: {},
+ [t('Telephone Expenses')]: {},
+ [t('Travel Expenses')]: {},
+ [t('Utility Expenses')]: {},
+ [t('Write Off')]: {},
+ [t('Exchange Gain/Loss')]: {},
+ [t('Gain/Loss on Asset Disposal')]: {},
},
rootType: 'Expense',
},
- [_('Income')]: {
- [_('Direct Income')]: {
- [_('Sales')]: {},
- [_('Service')]: {},
+ [t('Income')]: {
+ [t('Direct Income')]: {
+ [t('Sales')]: {},
+ [t('Service')]: {},
},
- [_('Indirect Income')]: {
+ [t('Indirect Income')]: {
isGroup: 1,
},
rootType: 'Income',
},
- [_('Source of Funds (Liabilities)')]: {
- [_('Current Liabilities')]: {
- [_('Accounts Payable')]: {
- [_('Creditors')]: {
+ [t('Source of Funds (Liabilities)')]: {
+ [t('Current Liabilities')]: {
+ [t('Accounts Payable')]: {
+ [t('Creditors')]: {
accountType: 'Payable',
},
- [_('Payroll Payable')]: {},
+ [t('Payroll Payable')]: {},
},
- [_('Stock Liabilities')]: {
- [_('Stock Received But Not Billed')]: {
+ [t('Stock Liabilities')]: {
+ [t('Stock Received But Not Billed')]: {
accountType: 'Stock Received But Not Billed',
},
},
- [_('Duties and Taxes')]: {
+ [t('Duties and Taxes')]: {
accountType: 'Tax',
isGroup: 1,
},
- [_('Loans (Liabilities)')]: {
- [_('Secured Loans')]: {},
- [_('Unsecured Loans')]: {},
- [_('Bank Overdraft Account')]: {},
+ [t('Loans (Liabilities)')]: {
+ [t('Secured Loans')]: {},
+ [t('Unsecured Loans')]: {},
+ [t('Bank Overdraft Account')]: {},
},
},
rootType: 'Liability',
},
- [_('Equity')]: {
- [_('Capital Stock')]: {
+ [t('Equity')]: {
+ [t('Capital Stock')]: {
accountType: 'Equity',
},
- [_('Dividends Paid')]: {
+ [t('Dividends Paid')]: {
accountType: 'Equity',
},
- [_('Opening Balance Equity')]: {
+ [t('Opening Balance Equity')]: {
accountType: 'Equity',
},
- [_('Retained Earnings')]: {
+ [t('Retained Earnings')]: {
accountType: 'Equity',
},
rootType: 'Equity',
diff --git a/frappe/index.js b/frappe/index.js
index 363a2c55..f9a0c676 100644
--- a/frappe/index.js
+++ b/frappe/index.js
@@ -1,4 +1,5 @@
const Observable = require('./utils/observable');
+const { T, t } = require('./utils/translation');
const utils = require('./utils');
const { getMoneyMaker } = require('pesa');
const {
@@ -227,8 +228,10 @@ module.exports = {
return this.metaCache[doctype];
},
- async getDoc(doctype, name, options = {skipDocumentCache: false}) {
- let doc = options.skipDocumentCache ? null : this.getDocFromCache(doctype, name);
+ async getDoc(doctype, name, options = { skipDocumentCache: false }) {
+ let doc = options.skipDocumentCache
+ ? null
+ : this.getDocFromCache(doctype, name);
if (!doc) {
doc = new (this.getDocumentClass(doctype))({
doctype: doctype,
@@ -369,4 +372,6 @@ module.exports = {
this.server.close();
}
},
+ t,
+ T,
};
diff --git a/frappe/model/document.js b/frappe/model/document.js
index bdf2f7e9..3552cf7d 100644
--- a/frappe/model/document.js
+++ b/frappe/model/document.js
@@ -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])
);
}
diff --git a/frappe/model/meta.js b/frappe/model/meta.js
index f8a7b567..47cafc10 100644
--- a/frappe/model/meta.js
+++ b/frappe/model/meta.js
@@ -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')
});
}
diff --git a/frappe/models/doctype/SystemSettings/SystemSettings.js b/frappe/models/doctype/SystemSettings/SystemSettings.js
index fc011f4f..e785f1f6 100644
--- a/frappe/models/doctype/SystemSettings/SystemSettings.js
+++ b/frappe/models/doctype/SystemSettings/SystemSettings.js
@@ -1,5 +1,5 @@
const { DateTime } = require('luxon');
-const { _ } = require('frappe/utils');
+const { t } = require('frappe');
const {
DEFAULT_DISPLAY_PRECISION,
DEFAULT_INTERNAL_PRECISION,
@@ -42,14 +42,14 @@ module.exports = {
options: dateFormatOptions,
default: 'MMM d, y',
required: 1,
- description: _('Sets the app-wide date display format.'),
+ description: t('Sets the app-wide date display format.'),
},
{
fieldname: 'locale',
label: 'Locale',
fieldtype: 'Data',
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',
@@ -64,10 +64,10 @@ module.exports = {
return;
}
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',
@@ -75,7 +75,7 @@ module.exports = {
fieldtype: 'Int',
minValue: 0,
default: DEFAULT_INTERNAL_PRECISION,
- description: _(
+ description: t(
'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',
fieldtype: 'Check',
default: 0,
- description: _(
+ description: t(
'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',
fieldtype: 'Check',
default: 1,
- description: _(
+ description: t(
'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',
fieldtype: 'Check',
default: 0,
- description: _(
+ description: t(
'Automatically report all errors. User will still be notified when an error pops up.'
),
},
diff --git a/frappe/utils/index.js b/frappe/utils/index.js
index d7573af0..0abdacf7 100644
--- a/frappe/utils/index.js
+++ b/frappe/utils/index.js
@@ -1,5 +1,4 @@
const { pesa } = require('pesa');
-const { T, t } = require('./translation');
Array.prototype.equals = function (array) {
return (
@@ -88,9 +87,6 @@ function isPesa(value) {
}
module.exports = {
- _: t,
- t,
- T,
slug,
getRandomString,
sleep,
diff --git a/models/doctype/Account/AccountList.js b/models/doctype/Account/AccountList.js
index b4fc80d6..feb04c18 100644
--- a/models/doctype/Account/AccountList.js
+++ b/models/doctype/Account/AccountList.js
@@ -1,7 +1,7 @@
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
doctype: 'Account',
- title: _('Account'),
+ title: t('Account'),
columns: ['name', 'parentAccount', 'rootType'],
};
diff --git a/models/doctype/AccountingLedgerEntry/AccountingLedgerEntryList.js b/models/doctype/AccountingLedgerEntry/AccountingLedgerEntryList.js
index 5903eb52..9dcab704 100644
--- a/models/doctype/AccountingLedgerEntry/AccountingLedgerEntryList.js
+++ b/models/doctype/AccountingLedgerEntry/AccountingLedgerEntryList.js
@@ -1,7 +1,7 @@
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
doctype: 'AccountingLedgerEntry',
- title: _('Accounting Ledger Entries'),
+ title: t('Accounting Ledger Entries'),
columns: ['account', 'party', 'debit', 'credit', 'balance'],
};
diff --git a/models/doctype/GSTR3B/GSTR3BList.js b/models/doctype/GSTR3B/GSTR3BList.js
index f9ca5810..26f08a01 100644
--- a/models/doctype/GSTR3B/GSTR3BList.js
+++ b/models/doctype/GSTR3B/GSTR3BList.js
@@ -1,7 +1,7 @@
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
doctype: 'GSTR3B',
- title: _('GSTR 3B Report'),
+ title: t('GSTR 3B Report'),
columns: ['year', 'month'],
};
diff --git a/models/doctype/GSTR3B/GSTR3BPrintView.vue b/models/doctype/GSTR3B/GSTR3BPrintView.vue
index eed1bc93..668c00ad 100644
--- a/models/doctype/GSTR3B/GSTR3BPrintView.vue
+++ b/models/doctype/GSTR3B/GSTR3BPrintView.vue
@@ -2,7 +2,7 @@
- {{ _('PDF') }}
+ {{ t('PDF') }}
diff --git a/models/doctype/Item/Item.js b/models/doctype/Item/Item.js
index abeb4145..cea0e8a8 100644
--- a/models/doctype/Item/Item.js
+++ b/models/doctype/Item/Item.js
@@ -1,5 +1,5 @@
import frappe from 'frappe';
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
name: 'Item',
@@ -124,7 +124,7 @@ export default {
],
actions: [
{
- label: _('New Invoice'),
+ label: t('New Invoice'),
condition: (doc) => !doc.isNew(),
action: async (doc, router) => {
const invoice = await frappe.getNewDoc('SalesInvoice');
@@ -137,7 +137,7 @@ export default {
},
},
{
- label: _('New Bill'),
+ label: t('New Bill'),
condition: (doc) => !doc.isNew(),
action: async (doc, router) => {
const invoice = await frappe.getNewDoc('PurchaseInvoice');
diff --git a/models/doctype/Item/ItemList.js b/models/doctype/Item/ItemList.js
index b48bde6f..dac63fbc 100644
--- a/models/doctype/Item/ItemList.js
+++ b/models/doctype/Item/ItemList.js
@@ -1,7 +1,7 @@
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
doctype: 'Item',
- title: _('Items'),
+ title: t('Items'),
columns: ['name', 'unit', 'tax', 'rate'],
};
diff --git a/models/doctype/JournalEntry/JournalEntryList.js b/models/doctype/JournalEntry/JournalEntryList.js
index abe57328..bfdc757e 100644
--- a/models/doctype/JournalEntry/JournalEntryList.js
+++ b/models/doctype/JournalEntry/JournalEntryList.js
@@ -1,9 +1,9 @@
import Badge from '@/components/Badge';
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
doctype: 'JournalEntry',
- title: _('Journal Entry'),
+ title: t('Journal Entry'),
formRoute: (name) => `/edit/JournalEntry/${name}`,
columns: [
'date',
diff --git a/models/doctype/Party/Customer.js b/models/doctype/Party/Customer.js
index 897b84ef..c2877169 100644
--- a/models/doctype/Party/Customer.js
+++ b/models/doctype/Party/Customer.js
@@ -1,6 +1,6 @@
import router from '@/router';
import frappe from 'frappe';
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
import PartyWidget from './PartyWidget.vue';
export default {
@@ -12,7 +12,7 @@ export default {
},
actions: [
{
- label: _('Create Invoice'),
+ label: t('Create Invoice'),
condition: (doc) => !doc.isNew(),
action: async (customer) => {
let doc = await frappe.getNewDoc('SalesInvoice');
@@ -28,7 +28,7 @@ export default {
},
},
{
- label: _('View Invoices'),
+ label: t('View Invoices'),
condition: (doc) => !doc.isNew(),
action: (customer) => {
router.push({
diff --git a/models/doctype/Party/CustomerList.js b/models/doctype/Party/CustomerList.js
index 0118f9b3..4ceb651d 100644
--- a/models/doctype/Party/CustomerList.js
+++ b/models/doctype/Party/CustomerList.js
@@ -1,7 +1,7 @@
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
doctype: 'Customer',
- title: _('Customers'),
+ title: t('Customers'),
columns: ['name', 'phone', 'outstandingAmount'],
};
diff --git a/models/doctype/Party/Party.js b/models/doctype/Party/Party.js
index a7931866..336cc716 100644
--- a/models/doctype/Party/Party.js
+++ b/models/doctype/Party/Party.js
@@ -1,5 +1,5 @@
import frappe from 'frappe';
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
name: 'Party',
@@ -86,7 +86,7 @@ export default {
label: 'Address',
fieldtype: 'Link',
target: 'Address',
- placeholder: _('Click to create'),
+ placeholder: t('Click to create'),
inline: true,
},
{
diff --git a/models/doctype/Party/PartyWidget.vue b/models/doctype/Party/PartyWidget.vue
index dd06058e..6ac80727 100644
--- a/models/doctype/Party/PartyWidget.vue
+++ b/models/doctype/Party/PartyWidget.vue
@@ -1,7 +1,7 @@
- {{ _('Recent Invoices') }}
+ {{ t('Recent Invoices') }}
!doc.isNew(),
action: async (supplier) => {
let doc = await frappe.getNewDoc('PurchaseInvoice');
@@ -28,7 +28,7 @@ export default {
},
},
{
- label: _('View Bills'),
+ label: t('View Bills'),
condition: (doc) => !doc.isNew(),
action: (supplier) => {
router.push({
diff --git a/models/doctype/Party/SupplierList.js b/models/doctype/Party/SupplierList.js
index d87e4af3..1c9df8dc 100644
--- a/models/doctype/Party/SupplierList.js
+++ b/models/doctype/Party/SupplierList.js
@@ -1,7 +1,7 @@
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
doctype: 'Supplier',
- title: _('Supplier'),
+ title: t('Supplier'),
columns: ['name', 'phone', 'outstandingAmount'],
};
diff --git a/models/doctype/Payment/Payment.js b/models/doctype/Payment/Payment.js
index 05d7c991..97e2db17 100644
--- a/models/doctype/Payment/Payment.js
+++ b/models/doctype/Payment/Payment.js
@@ -113,7 +113,7 @@ export default {
validate(value, doc) {
if (value.isNegative()) {
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)) {
throw new frappe.errors.ValidationError(
- frappe._(
+ frappe.t(
`Payment amount cannot exceed ${frappe.format(
amount,
'Currency'
@@ -131,7 +131,7 @@ export default {
);
} else if (value.isZero()) {
throw new frappe.errors.ValidationError(
- frappe._(
+ frappe.t(
`Payment amount cannot be ${frappe.format(value, 'Currency')}.`
)
);
diff --git a/models/doctype/Payment/PaymentList.js b/models/doctype/Payment/PaymentList.js
index 86333e37..825e8d06 100644
--- a/models/doctype/Payment/PaymentList.js
+++ b/models/doctype/Payment/PaymentList.js
@@ -1,9 +1,9 @@
import Badge from '@/components/Badge';
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
doctype: 'Payment',
- title: _('Payments'),
+ title: t('Payments'),
columns: [
'party',
{
diff --git a/models/doctype/Payment/PaymentServer.js b/models/doctype/Payment/PaymentServer.js
index f4b07d77..97554795 100644
--- a/models/doctype/Payment/PaymentServer.js
+++ b/models/doctype/Payment/PaymentServer.js
@@ -84,7 +84,7 @@ export default class PaymentServer extends BaseDocument {
: '';
throw new Error(
- frappe._(
+ frappe.t(
`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;
}
if (this.amount.lte(0) || this.amount.gt(outstandingAmount)) {
- let message = frappe._(
+ let message = frappe.t(
`Payment amount: ${frappe.format(
this.amount,
'Currency'
@@ -127,7 +127,7 @@ export default class PaymentServer extends BaseDocument {
if (this.amount.lte(0)) {
const amt = frappe.format(this.amount, 'Currency');
- message = frappe._(
+ message = frappe.t(
`Payment amount: ${amt} should be greater than 0.`
);
}
diff --git a/models/doctype/PaymentFor/PaymentFor.js b/models/doctype/PaymentFor/PaymentFor.js
index b2076ed7..05c99c5a 100644
--- a/models/doctype/PaymentFor/PaymentFor.js
+++ b/models/doctype/PaymentFor/PaymentFor.js
@@ -1,9 +1,9 @@
import frappe from 'frappe';
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
const referenceTypeMap = {
- SalesInvoice: _('Invoice'),
- PurchaseInvoice: _('Bill'),
+ SalesInvoice: t('Invoice'),
+ PurchaseInvoice: t('Bill'),
};
export default {
diff --git a/models/doctype/PurchaseInvoice/PurchaseInvoiceList.js b/models/doctype/PurchaseInvoice/PurchaseInvoiceList.js
index b05bb8f4..7dd8264d 100644
--- a/models/doctype/PurchaseInvoice/PurchaseInvoiceList.js
+++ b/models/doctype/PurchaseInvoice/PurchaseInvoiceList.js
@@ -1,9 +1,9 @@
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
import { getStatusColumn } from '../Transaction/Transaction';
export default {
doctype: 'PurchaseInvoice',
- title: _('Bills'),
+ title: t('Bills'),
formRoute: (name) => `/edit/PurchaseInvoice/${name}`,
columns: [
'supplier',
diff --git a/models/doctype/SalesInvoice/SalesInvoiceList.js b/models/doctype/SalesInvoice/SalesInvoiceList.js
index 773a6e4b..73b8ca4d 100644
--- a/models/doctype/SalesInvoice/SalesInvoiceList.js
+++ b/models/doctype/SalesInvoice/SalesInvoiceList.js
@@ -1,9 +1,9 @@
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
import { getStatusColumn } from '../Transaction/Transaction';
export default {
doctype: 'SalesInvoice',
- title: _('Invoices'),
+ title: t('Invoices'),
formRoute: (name) => `/edit/SalesInvoice/${name}`,
columns: [
'customer',
diff --git a/models/doctype/SalesInvoice/SalesInvoicePrint.vue b/models/doctype/SalesInvoice/SalesInvoicePrint.vue
index be1dec4a..b1935517 100644
--- a/models/doctype/SalesInvoice/SalesInvoicePrint.vue
+++ b/models/doctype/SalesInvoice/SalesInvoicePrint.vue
@@ -3,9 +3,9 @@
- {{ _('Send') }}
- {{ _('Customize') }}
- {{ _('PDF') }}
+ {{ t('Send') }}
+ {{ t('Customize') }}
+ {{ t('PDF') }}
diff --git a/models/doctype/SalesInvoice/Templates/Basic.vue b/models/doctype/SalesInvoice/Templates/Basic.vue
index 035d8101..6c21243c 100644
--- a/models/doctype/SalesInvoice/Templates/Basic.vue
+++ b/models/doctype/SalesInvoice/Templates/Basic.vue
@@ -96,7 +96,7 @@
-
{{ _('Subtotal') }}
+
{{ t('Subtotal') }}
{{ frappe.format(doc.netTotal, 'Currency') }}
-
{{ _('Grand Total') }}
+
{{ t('Grand Total') }}
{{ frappe.format(doc.grandTotal, 'Currency') }}
diff --git a/models/doctype/SalesInvoice/Templates/Business.vue b/models/doctype/SalesInvoice/Templates/Business.vue
index 7ed8c329..6c400439 100644
--- a/models/doctype/SalesInvoice/Templates/Business.vue
+++ b/models/doctype/SalesInvoice/Templates/Business.vue
@@ -82,7 +82,7 @@
-
{{ _('Subtotal') }}
+
{{ t('Subtotal') }}
{{ frappe.format(doc.netTotal, 'Currency') }}
@@ -105,7 +105,7 @@
:style="{ backgroundColor: printSettings.color }"
>
-
{{ _('Grand Total') }}
+
{{ t('Grand Total') }}
{{ frappe.format(doc.grandTotal, 'Currency') }}
diff --git a/models/doctype/SalesInvoice/Templates/Minimal.vue b/models/doctype/SalesInvoice/Templates/Minimal.vue
index 82453d25..5dd973b5 100644
--- a/models/doctype/SalesInvoice/Templates/Minimal.vue
+++ b/models/doctype/SalesInvoice/Templates/Minimal.vue
@@ -103,7 +103,7 @@
-
{{ _('Subtotal') }}
+
{{ t('Subtotal') }}
{{ frappe.format(doc.netTotal, 'Currency') }}
-
{{ _('Grand Total') }}
+
{{ t('Grand Total') }}
{{ frappe.format(doc.grandTotal, 'Currency') }}
diff --git a/models/doctype/SalesInvoiceItem/SalesInvoiceItem.js b/models/doctype/SalesInvoiceItem/SalesInvoiceItem.js
index 6c32030f..40ac5e7c 100644
--- a/models/doctype/SalesInvoiceItem/SalesInvoiceItem.js
+++ b/models/doctype/SalesInvoiceItem/SalesInvoiceItem.js
@@ -41,7 +41,7 @@ export default {
}
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(
- frappe._(
+ frappe.t(
`Rate (${frappe.format(value, 'Currency')}) cannot be less zero.`
)
);
diff --git a/models/doctype/Tax/TaxList.js b/models/doctype/Tax/TaxList.js
index 4a2b2c27..801e9213 100644
--- a/models/doctype/Tax/TaxList.js
+++ b/models/doctype/Tax/TaxList.js
@@ -1,7 +1,7 @@
-import { _ } from 'frappe/utils';
+import { t } from 'frappe';
export default {
doctype: 'Tax',
- title: _('Taxes'),
+ title: t('Taxes'),
columns: ['name'],
};
diff --git a/reports/commonExporter.js b/reports/commonExporter.js
index 88acf1f3..86d85769 100644
--- a/reports/commonExporter.js
+++ b/reports/commonExporter.js
@@ -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);
}
diff --git a/src/components/BackLink.vue b/src/components/BackLink.vue
index f4a001e9..0ccee779 100644
--- a/src/components/BackLink.vue
+++ b/src/components/BackLink.vue
@@ -5,6 +5,6 @@
@click="$router.back()"
>
-
{{ _('Back') }}
+
{{ t('Back') }}
diff --git a/src/components/Controls/AttachImage.vue b/src/components/Controls/AttachImage.vue
index 2806891e..fa7b28c0 100644
--- a/src/components/Controls/AttachImage.vue
+++ b/src/components/Controls/AttachImage.vue
@@ -33,7 +33,7 @@
v-show="showEdit"
class="absolute bottom-0 text-gray-500 text-center text-xs pt-3 pb-1"
>
- {{ _('Edit') }}
+ {{ t('Edit') }}
@@ -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'] }]
};
diff --git a/src/components/Controls/Color.vue b/src/components/Controls/Color.vue
index 0b46d593..1e70ccf5 100644
--- a/src/components/Controls/Color.vue
+++ b/src/components/Controls/Color.vue
@@ -40,7 +40,7 @@
setColorValue(e.target.value)"
diff --git a/src/components/Controls/Link.vue b/src/components/Controls/Link.vue
index b4496d82..f14ae78c 100644
--- a/src/components/Controls/Link.vue
+++ b/src/components/Controls/Link.vue
@@ -66,7 +66,7 @@ export default {
action: () => this.openNewDoc(),
component: {
template: `
-
{{ _('Create') }}
+
{{ t('Create') }}
{{ linkValue }}
`,
diff --git a/src/components/Controls/Table.vue b/src/components/Controls/Table.vue
index 345fbeb2..30493b69 100644
--- a/src/components/Controls/Table.vue
+++ b/src/components/Controls/Table.vue
@@ -43,7 +43,7 @@
'px-3 py-4': size !== 'small'
}"
>
- {{ _('Add Row') }}
+ {{ t('Add Row') }}
- {{ _('Loading...') }}
+ {{ t('Loading...') }}
- {{ _('Filter') }}
+ {{ t('Filter') }}
@@ -80,7 +80,7 @@
{{
- _('No filters selected')
+ t('No filters selected')
}}
@@ -89,7 +89,7 @@
@click="addNewFilter"
>
-
{{ _('Add a filter') }}
+
{{ t('Add a filter') }}
@@ -180,9 +180,9 @@ export default {
},
filterAppliedMessage() {
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]);
}
}
};
diff --git a/src/components/InvoiceCustomizer.vue b/src/components/InvoiceCustomizer.vue
index c3285ee8..f67cc850 100644
--- a/src/components/InvoiceCustomizer.vue
+++ b/src/components/InvoiceCustomizer.vue
@@ -6,7 +6,7 @@
Customize
- {{ _('Save & Close') }}
+ {{ t('Save & Close') }}
@@ -14,7 +14,7 @@
- {{ _('Company Settings') }}
+ {{ t('Company Settings') }}
diff --git a/src/components/TwoColumnForm.vue b/src/components/TwoColumnForm.vue
index 253be824..2398fdcd 100644
--- a/src/components/TwoColumnForm.vue
+++ b/src/components/TwoColumnForm.vue
@@ -28,14 +28,14 @@
class="w-1/2 text-gray-900"
@click="inlineEditField = null"
>
- {{ _('Cancel') }}
+ {{ t('Cancel') }}
diff --git a/src/main.js b/src/main.js
index 69423217..3263dd56 100644
--- a/src/main.js
+++ b/src/main.js
@@ -49,9 +49,8 @@ import { outsideClickDirective } from './ui';
},
},
methods: {
- _(...args) {
- return frappe._(...args);
- },
+ t: frappe.t,
+ T: frappe.T,
},
});
diff --git a/src/pages/ChartOfAccounts.vue b/src/pages/ChartOfAccounts.vue
index 01be1acc..e3dfd63a 100644
--- a/src/pages/ChartOfAccounts.vue
+++ b/src/pages/ChartOfAccounts.vue
@@ -2,7 +2,7 @@
- {{ _('Chart of Accounts') }}
+ {{ t('Chart of Accounts') }}
@@ -37,13 +37,13 @@
class="text-xs text-gray-800 hover:text-gray-900 focus:outline-none"
@click.stop="addAccount(account, 'addingAccount')"
>
- {{ _('Add Account') }}
+ {{ t('Add Account') }}
@@ -67,7 +67,7 @@
- {{ _('Cancel') }}
+ {{ t('Cancel') }}
diff --git a/src/pages/Dashboard/Cashflow.vue b/src/pages/Dashboard/Cashflow.vue
index 4f136d0f..9d0c6c5a 100644
--- a/src/pages/Dashboard/Cashflow.vue
+++ b/src/pages/Dashboard/Cashflow.vue
@@ -2,15 +2,15 @@
-
{{ _('Cashflow') }}
+
{{ t('Cashflow') }}
- {{ _('Inflow') }}
+ {{ t('Inflow') }}
- {{ _('Outflow') }}
+ {{ t('Outflow') }}
(period = value)" />
@@ -31,7 +31,7 @@
- {{ _('Cashflow') }}
+ {{ t('Cashflow') }}
diff --git a/src/pages/Dashboard/Dashboard.vue b/src/pages/Dashboard/Dashboard.vue
index 3062d446..b050a316 100644
--- a/src/pages/Dashboard/Dashboard.vue
+++ b/src/pages/Dashboard/Dashboard.vue
@@ -1,7 +1,7 @@
- {{ _('Dashboard') }}
+ {{ t('Dashboard') }}
diff --git a/src/pages/Dashboard/Expenses.vue b/src/pages/Dashboard/Expenses.vue
index d5885de3..8f99bc3f 100644
--- a/src/pages/Dashboard/Expenses.vue
+++ b/src/pages/Dashboard/Expenses.vue
@@ -1,7 +1,7 @@
- {{ _('Top Expenses') }}
+ {{ t('Top Expenses') }}
(active = value)"
/>
- {{ _('No expenses in this period') }}
+ {{ t('No expenses in this period') }}
diff --git a/src/pages/Dashboard/ProfitAndLoss.vue b/src/pages/Dashboard/ProfitAndLoss.vue
index f9d22902..8b2dee7d 100644
--- a/src/pages/Dashboard/ProfitAndLoss.vue
+++ b/src/pages/Dashboard/ProfitAndLoss.vue
@@ -1,7 +1,7 @@
- {{ _('Profit and Loss') }}
+ {{ t('Profit and Loss') }}
- {{ _('No transactions yet') }}
+ {{ t('No transactions yet') }}
diff --git a/src/pages/Dashboard/UnpaidInvoices.vue b/src/pages/Dashboard/UnpaidInvoices.vue
index 98a353c4..5827f35e 100644
--- a/src/pages/Dashboard/UnpaidInvoices.vue
+++ b/src/pages/Dashboard/UnpaidInvoices.vue
@@ -31,7 +31,7 @@
>
{{ frappe.format(invoice.paid, 'Currency') }}
{{
- _('Paid')
+ t('Paid')
}}
{{ frappe.format(invoice.unpaid, 'Currency') }}
{{
- _('Unpaid')
+ t('Unpaid')
}}
diff --git a/src/pages/DataImport/index.vue b/src/pages/DataImport/index.vue
index 091804c6..939479c1 100644
--- a/src/pages/DataImport/index.vue
+++ b/src/pages/DataImport/index.vue
@@ -1,7 +1,7 @@
-
{{ _('Data Import') }}
+
{{ t('Data Import') }}
- {{ _('Welcome to Frappe Books') }}
+ {{ t('Welcome to Frappe Books') }}
{{
- _('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')
}}
- {{ _('Select a file to load the company transactions') }}
+ {{ t('Select a file to load the company transactions') }}
@@ -49,14 +49,14 @@
- {{ _('Loading...') }}
+ {{ t('Loading...') }}
- {{ _('New File') }}
+ {{ t('New File') }}
- {{ _('Create a new file and store it in your computer.') }}
+ {{ t('Create a new file and store it in your computer.') }}
- {{ _('Loading...') }}
+ {{ t('Loading...') }}
- {{ _('Existing File') }}
+ {{ t('Existing File') }}
- {{ _('Load an existing .db file from your computer.') }}
+ {{ t('Load an existing .db file from your computer.') }}
@@ -127,7 +127,7 @@
- {{ _('Loading...') }}
+ {{ t('Loading...') }}
{{ file.companyName }}
@@ -195,7 +195,7 @@ export default {
this.fileSelectedFrom = 'Existing File';
const filePath = (
await ipcRenderer.invoke(IPC_ACTIONS.GET_OPEN_FILEPATH, {
- title: this._('Select file'),
+ title: this.t('Select file'),
properties: ['openFile'],
filters: [{ name: 'SQLite DB File', extensions: ['db'] }],
})
diff --git a/src/pages/GetStarted.vue b/src/pages/GetStarted.vue
index b81c1bad..a33af28c 100644
--- a/src/pages/GetStarted.vue
+++ b/src/pages/GetStarted.vue
@@ -2,7 +2,7 @@
- {{ _('Setup your workspace') }}
+ {{ t('Setup your workspace') }}
@@ -59,7 +59,7 @@
@click="handleAction(item)"
>
- {{ item.actionLabel || _('Setup') }}
+ {{ item.actionLabel || t('Setup') }}
@@ -83,7 +83,7 @@