diff --git a/src/UsingCash.Api/Endpoints/AccountEndpoints.cs b/src/UsingCash.Api/Endpoints/AccountEndpoints.cs
index 83d2935b..d51d33a3 100644
--- a/src/UsingCash.Api/Endpoints/AccountEndpoints.cs
+++ b/src/UsingCash.Api/Endpoints/AccountEndpoints.cs
@@ -1,4 +1,5 @@
using UsingCash.Api.Configuration;
+using UsingCash.Api.Support;
using UsingCash.Common.Enums;
using UsingCash.Database.Repositories;
@@ -15,7 +16,7 @@ public static class AccountEndpoints
var accounts = await repo.GetAccountsForOrganization(orgId);
return Results.Ok(accounts.Select(a => new
{
- a.FinancialAccountId, a.Name, accountType = a.AccountType.ToString(),
+ a.FinancialAccountId, name = AccountNameResolver.Resolve(a.Name), accountType = a.AccountType.ToString(),
a.ParentFinancialAccountId, a.OwnerUserId, a.Open, a.OpenedYear, a.ClosedYear,
a.Expensable, a.EnabledForExpensing, a.EnabledForInvoicing
}));
diff --git a/src/UsingCash.Api/Endpoints/InspectLedgerEndpoints.cs b/src/UsingCash.Api/Endpoints/InspectLedgerEndpoints.cs
index e60e4980..1922b418 100644
--- a/src/UsingCash.Api/Endpoints/InspectLedgerEndpoints.cs
+++ b/src/UsingCash.Api/Endpoints/InspectLedgerEndpoints.cs
@@ -1,3 +1,4 @@
+using UsingCash.Api.Support;
using UsingCash.Database.Repositories;
namespace UsingCash.Api.Endpoints;
@@ -46,7 +47,7 @@ public static class InspectLedgerEndpoints
}
bool isGroup = accountIds.Count > 1;
- var accountNameMap = allAccounts.ToDictionary(a => a.FinancialAccountId, a => a.Name);
+ var accountNameMap = allAccounts.ToDictionary(a => a.FinancialAccountId, a => AccountNameResolver.Resolve(a.Name));
var allRows = new List<(UsingCash.Basic.Types.BasicFinancialTransactionRow Row, int AccountId)>();
long priorBalance = 0;
@@ -96,7 +97,7 @@ public static class InspectLedgerEndpoints
return Results.Ok(new
{
accountId,
- accountName = selectedAccount.Name,
+ accountName = AccountNameResolver.Resolve(selectedAccount.Name),
isGroup,
groupAccountCount = accountIds.Count,
year = yr,
@@ -115,7 +116,7 @@ public static class InspectLedgerEndpoints
return Results.Ok(accounts.Select(a => new
{
id = a.FinancialAccountId,
- name = a.Name,
+ name = AccountNameResolver.Resolve(a.Name),
parentId = a.ParentFinancialAccountId,
accountType = a.AccountType.ToString(),
open = a.Open,
@@ -147,8 +148,8 @@ public static class InspectLedgerEndpoints
{
if (!accountMap.TryGetValue(acctId, out var acct)) return $"#{acctId}";
if (acct.ParentFinancialAccountId != 0 && accountMap.TryGetValue(acct.ParentFinancialAccountId, out var parent))
- return $"{parent.Name} » {acct.Name}";
- return acct.Name;
+ return $"{AccountNameResolver.Resolve(parent.Name)} » {AccountNameResolver.Resolve(acct.Name)}";
+ return AccountNameResolver.Resolve(acct.Name);
}
// Get ALL rows for ALL accounts in this org for the period, sorted by transaction
diff --git a/src/UsingCash.Api/Endpoints/TreeReportEndpoints.cs b/src/UsingCash.Api/Endpoints/TreeReportEndpoints.cs
index 42a9f883..7d40b37a 100644
--- a/src/UsingCash.Api/Endpoints/TreeReportEndpoints.cs
+++ b/src/UsingCash.Api/Endpoints/TreeReportEndpoints.cs
@@ -1,3 +1,4 @@
+using UsingCash.Api.Support;
using UsingCash.Common.Enums;
using UsingCash.Database.Repositories;
@@ -49,7 +50,7 @@ public static class TreeReportEndpoints
nodes.Add(new
{
id = acct.Identity,
- name = acct.Name,
+ name = AccountNameResolver.Resolve(acct.Name),
parentId = acct.ParentFinancialAccountId,
accountType = acct.AccountType.ToString(),
ownValues = values,
@@ -102,7 +103,7 @@ public static class TreeReportEndpoints
nodes.Add(new
{
id = acct.Identity,
- name = acct.Name,
+ name = AccountNameResolver.Resolve(acct.Name),
parentId = acct.ParentFinancialAccountId,
accountType = acct.AccountType.ToString(),
ownValues = values,
diff --git a/src/UsingCash.Api/Support/AccountNameResolver.cs b/src/UsingCash.Api/Support/AccountNameResolver.cs
new file mode 100644
index 00000000..34811409
--- /dev/null
+++ b/src/UsingCash.Api/Support/AccountNameResolver.cs
@@ -0,0 +1,99 @@
+namespace UsingCash.Api.Support;
+
+///
+/// Resolves [LOC] prefixed account names to human-readable display names.
+/// In v5, these were looked up from .resx resource files. In v6, we use a
+/// static dictionary for the English defaults. Future: load per-language
+/// from resource files or database.
+///
+public static class AccountNameResolver
+{
+ private static readonly Dictionary EnglishNames = new(StringComparer.OrdinalIgnoreCase)
+ {
+ ["Asset_BankAccount"] = "Bank Account",
+ ["Asset_BankAccounts"] = "Bank Accounts",
+ ["Asset_BitcoinCold"] = "Bitcoin Cold Storage",
+ ["Asset_BitcoinHot"] = "Bitcoin Hot Wallet",
+ ["Asset_CashAdvances"] = "Cash Advances",
+ ["Asset_Hardware"] = "Hardware, Machinery, etc.",
+ ["Asset_InboundVat"] = "Inbound VAT",
+ ["Asset_InboundVatReported"] = "Surplus inbound VAT in report",
+ ["Asset_InboundVatUnreported"] = "Inbound VAT to report",
+ ["Asset_OutboundInvoices"] = "Outbound Invoices",
+ ["Asset_Paypal"] = "PayPal Account",
+ ["Asset_PrivateWithdrawals"] = "Private Withdrawals",
+ ["Asset_PrivateWithdrawals_HealthInsurance"] = "Health Insurance",
+ ["Asset_ShortTerm"] = "Short Term Assets",
+ ["Asset_TaxAdvances"] = "Taxes Prepayment",
+ ["Asset_TransfersInProgress"] = "Internal Transfers in Progress",
+ ["Cost_AccountingErrors"] = "Accounting Errors",
+ ["Cost_AllocatedFunds"] = "Allocated Funds",
+ ["Cost_AnnualResult"] = "Annual Profit/Loss",
+ ["Cost_AssetDepreciation"] = "Asset Depreciation",
+ ["Cost_BankFees"] = "Bank Fees",
+ ["Cost_BitcoinFees"] = "Bitcoin Miner Fees",
+ ["Cost_BusinessServices"] = "Business Services",
+ ["Cost_CentRounding"] = "Cent Rounding",
+ ["Cost_Conferences"] = "Conferences",
+ ["Cost_EventTickets"] = "Event Tickets",
+ ["Cost_FinancialFees"] = "Financial Fees",
+ ["Cost_ForexLosses"] = "Forex Capital Losses",
+ ["Cost_Hospitality"] = "Hospitality",
+ ["Cost_IctInfrastructure"] = "ICT and Infrastructure",
+ ["Cost_InterestLosses"] = "Interest Losses",
+ ["Cost_LegalFees"] = "Legal Fees",
+ ["Cost_LodgingFiveStar"] = "5 Star",
+ ["Cost_LodgingFourStar"] = "4 Star",
+ ["Cost_LodgingHostel"] = "Hostel or budget equivalent",
+ ["Cost_LodgingShared"] = "Shared lodging (AirBnB etc)",
+ ["Cost_LodgingThreeStar"] = "3 Star",
+ ["Cost_MaintenanceDonations"] = "Maintenance Donations",
+ ["Cost_MarketingCampaigns"] = "Marketing and Campaigns",
+ ["Cost_OfficeEquipment"] = "Office Equipment",
+ ["Cost_Offices"] = "Offices",
+ ["Cost_OfficeSpace"] = "Office Space",
+ ["Cost_OfficeSupplies"] = "Office Supplies",
+ ["Cost_PublicTransit"] = "Public Transit",
+ ["Cost_ResearchDevelopment"] = "Research and Development",
+ ["Cost_Staff"] = "Staff",
+ ["Cost_StaffBenefits"] = "Staff Benefits",
+ ["Cost_StaffExpenses"] = "Staff Expenses",
+ ["Cost_StaffPerDiem"] = "Staff Per-Diem",
+ ["Cost_StaffSalaries"] = "Staff Salaries",
+ ["Cost_Taxes"] = "Taxes",
+ ["Cost_TaxiTransport"] = "Taxi, Limo, etc.",
+ ["Cost_TrainsFerries"] = "Trains and Ferries",
+ ["Cost_Transportation"] = "Transportation",
+ ["Cost_Travel"] = "Travel",
+ ["Cost_TravelLodging"] = "Lodging",
+ ["Cost_TravelPerDiem"] = "Per Diems",
+ ["Cost_Unforeseen"] = "Unforeseen",
+ ["Debt_Equity"] = "Equity",
+ ["Debt_EquityRestricted"] = "Restricted Equity",
+ ["Debt_EquityUnrestricted"] = "Unrestricted Equity",
+ ["Debt_ExpenseClaims"] = "Expense Claims",
+ ["Debt_General"] = "General Debt",
+ ["Debt_InboundInvoices"] = "Inbound Invoices",
+ ["Debt_OutboundVat"] = "Outbound VAT",
+ ["Debt_OutboundVatReported"] = "Reported VAT to pay",
+ ["Debt_OutboundVatUnreported"] = "Outbound VAT to report",
+ ["Debt_PrivateDeposits"] = "Private Deposits",
+ ["Debt_Salaries"] = "Salaries Due",
+ ["Debt_Taxes"] = "Taxes Due",
+ ["Income_Donations"] = "Donations",
+ ["Income_ForexGains"] = "Forex Capital Gains",
+ ["Income_InterestGains"] = "Interest Gains",
+ ["Income_MembershipDues"] = "Membership Dues",
+ ["Income_Sales"] = "Sales",
+ ["Income_SubsidiesGrants"] = "Subsidies and Grants",
+ };
+
+ public static string Resolve(string name)
+ {
+ if (!name.StartsWith("[LOC]"))
+ return name;
+
+ var key = name[5..];
+ return EnglishNames.TryGetValue(key, out var localized) ? localized : name;
+ }
+}