Skip to main content

Internationalization (i18n)

@drcmind/ohada-lib supports native localization for journal entry labels, ensuring your records match your users' language.

Configuring Locale

Set the locale property in the Global Configuration.

const ohada = new Ohada({
locale: 'en' // Options: 'fr' (default) or 'en'
});

How it works

When the locale is set, the engine translates labels for all generated lines, including:

  • Transaction types: Sale, Purchase, Expense, Asset Acquisition.
  • Account roles: Supplier, Client, Bank, Cash, Recoverable VAT, Collected VAT.
  • Adjustments: Financial Discount, Transport, Customs, Dismantling.

Dynamic Translation

You can also pass a locale directly to the constructor if you are using multiple instances in a multilingual application.

const ohadaEn = new Ohada({ locale: 'en' });
const ohadaFr = new Ohada({ locale: 'fr' });

// Results will be localized accordingly
const entryEn = ohadaEn.recordSale({ amount: 1000, label: "Sale" });
const entryFr = ohadaFr.recordSale({ amount: 1000, label: "Vente" });