2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +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 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;
}

View File

@ -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',

View File

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

View File

@ -211,7 +211,7 @@ module.exports = class BaseDocument extends Observable {
if (missingMandatory.length > 0) {
let fields = missingMandatory.join('\n');
let message = frappe._('Value missing for {0}', fields);
let message = frappe.t('Value missing for {0}', fields);
throw new frappe.errors.MandatoryError(message);
}
@ -409,7 +409,7 @@ module.exports = class BaseDocument extends Observable {
// check for conflict
if (currentDoc && this.modified != currentDoc.modified) {
throw new frappe.errors.Conflict(
frappe._('Document {0} {1} has been modified after loading', [
frappe.t('Document {0} {1} has been modified after loading', [
this.doctype,
this.name,
])
@ -418,7 +418,7 @@ module.exports = class BaseDocument extends Observable {
if (this.submitted && !this.meta.isSubmittable) {
throw new frappe.errors.ValidationError(
frappe._('Document type {1} is not submittable', [this.doctype])
frappe.t('Document type {1} is not submittable', [this.doctype])
);
}

View File

@ -33,7 +33,7 @@ module.exports = class BaseMeta extends BaseDocument {
if (!this.fields.find(df => df.fieldname === 'name') && !this.isSingle) {
this.fields = [
{
label: frappe._('ID'),
label: frappe.t('ID'),
fieldname: 'name',
fieldtype: 'Data',
required: 1,
@ -176,7 +176,7 @@ module.exports = class BaseMeta extends BaseDocument {
_add({
fieldtype: 'Check',
fieldname: 'submitted',
label: frappe._('Submitted')
label: frappe.t('Submitted')
});
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@
<div>
<div class="row no-gutters">
<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 ref="printComponent" class="col-8 bg-white mt-4 mx-auto border shadow">

View File

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

View File

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

View File

@ -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',

View File

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

View File

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

View File

@ -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,
},
{

View File

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

View File

@ -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 Bill'),
label: t('Create Bill'),
condition: (doc) => !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({

View File

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

View File

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

View File

@ -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',
{

View File

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

View File

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

View File

@ -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',

View File

@ -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',

View File

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

View File

@ -96,7 +96,7 @@
</div>
<div class="w-1/2">
<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>
<div
@ -110,7 +110,7 @@
<div
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>
</div>

View File

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

View File

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

View File

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

View File

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

View File

@ -101,5 +101,5 @@ export default function getCommonExportActions(reportName) {
export async function saveExportData(data, filePath) {
await saveData(data, filePath);
showExportInFolder(frappe._('Export Successful'), filePath);
showExportInFolder(frappe.t('Export Successful'), filePath);
}

View File

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

View File

@ -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') }}
</div>
</div>
</template>
@ -58,7 +58,7 @@ export default {
methods: {
async openFileSelector() {
const options = {
title: frappe._('Select Image'),
title: frappe.t('Select Image'),
properties: ['openFile'],
filters: [{ name: 'Image', extensions: ['png', 'jpg', 'jpeg', 'webp'] }]
};

View File

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

View File

@ -66,7 +66,7 @@ export default {
action: () => this.openNewDoc(),
component: {
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>
</div>
`,

View File

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

View File

@ -19,7 +19,7 @@
<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 v-if="isLoading" class="p-2 text-gray-600 italic">
{{ _('Loading...') }}
{{ t('Loading...') }}
</div>
<div
v-if="!isLoading && dropdownItems.length === 0"
@ -168,11 +168,11 @@ export default {
getEmptyMessage() {
const { emptyMessage } = this.df ?? {};
if (typeof emptyMessage === 'function') {
return _(emptyMessage(this.doc));
return this.t(emptyMessage(this.doc));
} else if (emptyMessage) {
return _(emptyMessage);
return this.t(emptyMessage);
}
return _('Empty');
return this.t('Empty');
},
selectItem(d) {
if (d.action) {

View File

@ -9,7 +9,7 @@
{{ filterAppliedMessage }}
</template>
<template v-else>
{{ _('Filter') }}
{{ t('Filter') }}
</template>
</span>
</span>
@ -80,7 +80,7 @@
</template>
<template v-else>
<span class="text-base text-gray-600">{{
_('No filters selected')
t('No filters selected')
}}</span>
</template>
</div>
@ -89,7 +89,7 @@
@click="addNewFilter"
>
<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>
</Popover>
@ -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]);
}
}
};

View File

@ -6,7 +6,7 @@
<h4>Customize</h4>
</div>
<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 class="row">
@ -14,7 +14,7 @@
<form-layout :doc="doc" :fields="fields" @updateDoc="saveDoc" />
<sketch-picker v-model="color" class="shadow-none" />
<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>

View File

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

View File

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

View File

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

View File

@ -2,15 +2,15 @@
<div class="mt-4 mx-4">
<template v-if="hasData">
<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 items-center">
<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 class="flex items-center ml-6">
<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>
<PeriodSelector :value="period" @change="(value) => (period = value)" />
@ -31,7 +31,7 @@
</defs>
<g fill="none" fill-rule="evenodd">
<text fill="#112B42" class="font-medium">
<tspan y="16">{{ _('Cashflow') }}</tspan>
<tspan y="16">{{ t('Cashflow') }}</tspan>
</text>
<g fill="#E9E9ED">
<path d="M371 2h12v12h-12zM391 2h53v12h-53z" />

View File

@ -1,7 +1,7 @@
<template>
<div class="flex flex-col">
<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">
<SearchBar class="ml-2" />
</template>

View File

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

View File

@ -1,7 +1,7 @@
<template>
<div class="flex flex-col h-full">
<SectionHeader>
<template slot="title">{{ _('Profit and Loss') }}</template>
<template slot="title">{{ t('Profit and Loss') }}</template>
<PeriodSelector
slot="action"
:value="period"
@ -11,7 +11,7 @@
<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">
<span class="text-base text-gray-600">
{{ _('No transactions yet') }}
{{ t('No transactions yet') }}
</span>
</div>
</div>

View File

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

View File

@ -1,7 +1,7 @@
<template>
<div>
<div class="p-4">
<h4 class="pb-2">{{ _('Data Import') }}</h4>
<h4 class="pb-2">{{ t('Data Import') }}</h4>
<frappe-control
:docfield="{
fieldtype: 'Select',
@ -77,12 +77,12 @@ export default {
? path.resolve('.')
: frappe.store.documentsPath;
let title = frappe._('Message');
let message = frappe._('Template saved successfully.');
let title = frappe.t('Message');
let message = frappe.t('Template saved successfully.');
if (documentsPath === undefined) {
title = frappe._('Error');
message = frappe._('Template could not be saved.');
title = frappe.t('Error');
message = frappe.t('Template could not be saved.');
} else {
await writeFile(
path.resolve(

View File

@ -9,15 +9,15 @@
<div class="w-full">
<div class="px-12">
<h1 class="text-2xl font-semibold">
{{ _('Welcome to Frappe Books') }}
{{ t('Welcome to Frappe Books') }}
</h1>
<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 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>
</div>
<div class="px-12 mt-10 window-no-drag" v-if="!showFiles">
@ -49,14 +49,14 @@
<template
v-if="loadingDatabase && fileSelectedFrom === 'New File'"
>
{{ _('Loading...') }}
{{ t('Loading...') }}
</template>
<template v-else>
{{ _('New File') }}
{{ t('New File') }}
</template>
</div>
<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
@ -85,14 +85,14 @@
<template
v-if="loadingDatabase && fileSelectedFrom === 'Existing File'"
>
{{ _('Loading...') }}
{{ t('Loading...') }}
</template>
<template v-else>
{{ _('Existing File') }}
{{ t('Existing File') }}
</template>
</div>
<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>
@ -127,7 +127,7 @@
<div class="flex items-baseline">
<span>
<template v-if="loadingDatabase && fileSelectedFrom === file">
{{ _('Loading...') }}
{{ t('Loading...') }}
</template>
<template v-else>
{{ 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'] }],
})

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -90,7 +90,7 @@ export default {
methods: {
async openFileSelector() {
const options = {
title: frappe._('Select Logo'),
title: frappe.t('Select Logo'),
properties: ['openFile'],
filters: [{ name: 'Invoice Logo', extensions: ['png', 'jpg', 'svg'] }],
};

View File

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

View File

@ -3,7 +3,7 @@ import Toast from '@/components/Toast';
import router from '@/router';
import { ipcRenderer } from 'electron';
import frappe from 'frappe';
import { isPesa, _ } from 'frappe/utils';
import { isPesa, t } from 'frappe/utils';
import lodash from 'lodash';
import Vue from 'vue';
import { IPC_ACTIONS, IPC_MESSAGES } from './messages';
@ -43,14 +43,14 @@ export async function showErrorDialog({ title, content }) {
export function deleteDocWithPrompt(doc) {
return new Promise((resolve) => {
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.name,
]),
description: _('This action is permanent'),
description: t('This action is permanent'),
buttons: [
{
label: _('Delete'),
label: t('Delete'),
action: () => {
doc
.delete()
@ -61,7 +61,7 @@ export function deleteDocWithPrompt(doc) {
},
},
{
label: _('Cancel'),
label: t('Cancel'),
action() {
resolve(false);
},
@ -74,14 +74,14 @@ export function deleteDocWithPrompt(doc) {
export function cancelDocWithPrompt(doc) {
return new Promise((resolve) => {
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.name,
]),
description: _('This action is permanent'),
description: t('This action is permanent'),
buttons: [
{
label: _('Yes'),
label: t('Yes'),
async action() {
const entryDoc = await frappe.getDoc(doc.doctype, doc.name);
entryDoc.cancelled = 1;
@ -95,7 +95,7 @@ export function cancelDocWithPrompt(doc) {
},
},
{
label: _('No'),
label: t('No'),
action() {
resolve(false);
},
@ -152,16 +152,16 @@ export function openQuickEdit({ doctype, name, hideFields, defaults = {} }) {
}
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 canElaborate = doctype && name;
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,
name,
]);
} 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;
}
@ -174,13 +174,13 @@ export function handleErrorWithDialog(e, doc) {
export async function makePDF(html, savePath) {
await ipcRenderer.invoke(IPC_ACTIONS.SAVE_HTML_AS_PDF, html, savePath);
showExportInFolder(frappe._('Save as PDF Successful'), savePath);
showExportInFolder(frappe.t('Save as PDF Successful'), savePath);
}
export function showExportInFolder(message, filePath) {
showToast({
message,
actionText: frappe._('Open Folder'),
actionText: frappe.t('Open Folder'),
type: 'success',
action: async () => {
await showItemInFolder(filePath);
@ -201,7 +201,7 @@ export function getActionsForDocument(doc) {
let deleteAction = {
component: {
template: `<span class="text-red-700">{{ _('Delete') }}</span>`,
template: `<span class="text-red-700">{{ t('Delete') }}</span>`,
},
condition: (doc) =>
!doc.isNew() && !doc.submitted && !doc.meta.isSingle && !doc.cancelled,
@ -215,7 +215,7 @@ export function getActionsForDocument(doc) {
let cancelAction = {
component: {
template: `<span class="text-red-700">{{ _('Cancel') }}</span>`,
template: `<span class="text-red-700">{{ t('Cancel') }}</span>`,
},
condition: (doc) => doc.submitted && !doc.cancelled,
action: () => {
@ -323,7 +323,7 @@ export async function getSavePath(name, extention) {
let { canceled, filePath } = await ipcRenderer.invoke(
IPC_ACTIONS.GET_SAVE_FILEPATH,
{
title: _('Select Folder'),
title: t('Select Folder'),
defaultPath: `${name}.${extention}`,
}
);