mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
chore: Move i18nApply localization to the account transformer
This commit is contained in:
@@ -14,6 +14,8 @@ export class AccountTransformer extends Transformer {
|
|||||||
*/
|
*/
|
||||||
public includeAttributes = (): string[] => {
|
public includeAttributes = (): string[] => {
|
||||||
return [
|
return [
|
||||||
|
'accountTypeLabel',
|
||||||
|
'accountNormalFormatted',
|
||||||
'formattedAmount',
|
'formattedAmount',
|
||||||
'flattenName',
|
'flattenName',
|
||||||
'bankBalanceFormatted',
|
'bankBalanceFormatted',
|
||||||
@@ -84,6 +86,22 @@ export class AccountTransformer extends Transformer {
|
|||||||
return account.plaidItem?.isPaused || false;
|
return account.plaidItem?.isPaused || false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves formatted account type label.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
protected accountTypeLabel = (account: any): string => {
|
||||||
|
return this.context.i18n.__(account.accountTypeLabel);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves formatted account normal.
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
protected accountNormalFormatted = (account: any): string => {
|
||||||
|
return this.context.i18n.__(account.accountNormalFormatted);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transformes the accounts collection to flat or nested array.
|
* Transformes the accounts collection to flat or nested array.
|
||||||
* @param {IAccount[]}
|
* @param {IAccount[]}
|
||||||
|
|||||||
@@ -51,10 +51,6 @@ export class GetAccount {
|
|||||||
// Triggers `onAccountViewed` event.
|
// Triggers `onAccountViewed` event.
|
||||||
await this.eventPublisher.emitAsync(events.accounts.onViewed, eventPayload);
|
await this.eventPublisher.emitAsync(events.accounts.onViewed, eventPayload);
|
||||||
|
|
||||||
return this.i18nService.i18nApply(
|
return transformed;
|
||||||
[['accountTypeLabel'], ['accountNormalFormatted']],
|
|
||||||
transformed,
|
|
||||||
tenantId
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user