# General Translation Platform: formatCurrency URL: https://generaltranslation.com/en-GB/docs/platform/core/reference/gt-class-methods/formatting/format-currency.mdx --- title: formatCurrency description: Format a currency value by locale on a GT instance. API reference for formatCurrency. --- General Translation uses the built-in `Intl.NumberFormat` API with the currency style, so amounts render with the correct symbol, grouping and decimal conventions for each locale. ## Overview [#overview] Call `formatCurrency` on a [`GT`](/docs/platform/core/reference/gt-class/constructor) instance with a numeric value, a currency code, and an optional options object. It returns the formatted currency string. ```typescript const gt = new GT({ targetLocale: 'en-US' }); const price = gt.formatCurrency(1234.56, 'USD'); // "$1,234.56" ``` Signature: ```typescript formatCurrency( value: number, currency: string, options?: { locales?: string | string[] } & Intl.NumberFormatOptions ): string ``` *Note: `formatCurrency` runs locally using `Intl.NumberFormat` and does not require an API key. By default it formats for the instance's target locale, falling back to the source locale and then the library default (`en`); pass `locales` to override. For formatting without a `GT` instance, see the standalone [`formatCurrency`](/docs/platform/core/reference/utility-functions/formatting/format-currency).* ## How it works [#how-it-works] * **Currency style.** Formatting is delegated to [`Intl.NumberFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) with `style: 'currency'` and the provided `currency` code. * **Locale resolution.** By default the method formats for the instance's target locale, falling back to the source locale and then the library default (`en`) — not the `locales` config array. Pass `locales` in the options to override. * **Symbol placement.** The currency symbol, grouping separators, and decimal format follow the resolved locale, not the currency's country. ## Parameters [#parameters] | Parameter | Description | Type | Optional | Default | | ----------------------- | ----------------------------------------------------------------------------------------- | -------- | -------- | ------- | | [`value`](#value) | The numeric amount to format. | `number` | No | — | | [`currency`](#currency) | The ISO 4217 currency code, such as `USD` or `EUR`. | `string` | No | — | | [`options`](#options) | Formatting configuration, extending `Intl.NumberFormatOptions` with a `locales` override. | `object` | Yes | — | ### `value` [#value] **Type** `number` · **Required** The numeric amount to format. ### `currency` [#currency] **Type** `string` · **Required** The ISO 4217 currency code, such as `USD`, `EUR`, or `JPY`. ### `options` [#options] **Type** `{ locales?: string | string[] } & Intl.NumberFormatOptions` · **Optional** Formatting configuration. The table lists common currency options exposed by the published Core types and their effective Core defaults. See the [`Intl.NumberFormat` constructor options](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options) for supplementary standard and runtime-specific details. | Name | Description | Type | Optional | Default | | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------- | | `locales` | Override locales for formatting. | `string \| string[]` | Yes | `targetLocale` → `sourceLocale` → `en` | | `localeMatcher` | Locale matching algorithm. | `'lookup' \| 'best fit'` | Yes | `'best fit'` | | `numberingSystem` | Numbering system, such as `latn` or `arab`. | `string` | Yes | `'latn'` | | `style` | Number formatting style. `formatCurrency` supplies the currency style unless you override it. | `'decimal' \| 'currency' \| 'percent' \| 'unit'` | Yes | `'currency'` | | `currency` | Currency code used by the formatter. The positional `currency` argument supplies this value unless you override it. | `string` | Yes | positional `currency` argument | | `currencyDisplay` | How to display the currency. | `'symbol' \| 'narrowSymbol' \| 'code' \| 'name'` | Yes | `'symbol'` | | `currencySign` | Currency sign to use. | `'standard' \| 'accounting'` | Yes | `'standard'` | | `unit` | Unit identifier. Required when `style` is `'unit'`. | `string` | Yes | — | | `unitDisplay` | How to display the unit. | `'short' \| 'narrow' \| 'long'` | Yes | `'short'` | | `minimumFractionDigits` | Minimum fraction digits (0–100). | `number` | Yes | currency minor-unit digits; `0` with compact defaults | | `maximumFractionDigits` | Maximum fraction digits (0–100), at least `minimumFractionDigits`. | `number` | Yes | currency minor-unit digits; `0` with compact defaults | | `minimumSignificantDigits` | Minimum significant digits (1–21), when significant-digit rounding is active. | `number` | Yes | `1` | | `maximumSignificantDigits` | Maximum significant digits (1–21), when significant-digit rounding is active. | `number` | Yes | `21`; `2` with compact defaults | | `roundingPriority` | How fraction- and significant-digit settings interact. | `'auto' \| 'morePrecision' \| 'lessPrecision'` | Yes | `'auto'`; `'morePrecision'` with compact defaults | | `roundingMode` | Rounding mode. | `'ceil' \| 'floor' \| 'expand' \| 'trunc' \| 'halfCeil' \| 'halfFloor' \| 'halfExpand' \| 'halfTrunc' \| 'halfEven'` | Yes | `'halfExpand'` | | `roundingIncrement` | Rounding increment. Non-default values require equal effective minimum and maximum fraction digits and cannot be combined with significant-digit rounding or a non-`'auto'` `roundingPriority`. | `1 \| 2 \| 5 \| 10 \| 20 \| 25 \| 50 \| 100 \| 200 \| 250 \| 500 \| 1000 \| 2000 \| 2500 \| 5000` | Yes | `1` | | `useGrouping` | Whether and when to use grouping separators. | `boolean \| 'always' \| 'auto' \| 'min2'` | Yes | `'auto'`; `'min2'` with compact defaults | | `notation` | Number notation format. | `'standard' \| 'scientific' \| 'engineering' \| 'compact'` | Yes | `'standard'` | | `compactDisplay` | Compact notation display style. | `'short' \| 'long'` | Yes | `'short'` | | `signDisplay` | When to display the sign. | `'auto' \| 'never' \| 'always' \| 'exceptZero' \| 'negative'` | Yes | `'auto'` | | `trailingZeroDisplay` | Whether to display trailing zeros. | `'auto' \| 'stripIfInteger'` | Yes | `'auto'` | When `notation: 'compact'` is set without any fraction- or significant-digit option, the effective digit defaults are `minimumFractionDigits: 0`, `maximumFractionDigits: 0`, `minimumSignificantDigits: 1`, and `maximumSignificantDigits: 2`. In that case, `roundingPriority` defaults to `'morePrecision'` and `useGrouping` defaults to `'min2'`. Setting `style: 'unit'` also requires a valid `unit`. ## Returns [#returns] **Type** `string` The value formatted as a localised currency string. ## Examples [#examples] ```typescript import { GT } from 'generaltranslation'; const gt = new GT({ targetLocale: 'en-US' }); // Default instance target locale console.log(gt.formatCurrency(1234.56, 'USD')); // Output: "$1,234.56" // Override the locale per call console.log(gt.formatCurrency(1234.56, 'EUR', { locales: ['de-DE'] })); // Output: "1.234,56 €" // No fractional digits console.log(gt.formatCurrency(1234, 'JPY', { locales: ['ja-JP'] })); // Output: "¥1,234" ``` ## Notes [#notes] * The method uses browser-native `Intl.NumberFormat` under the hood, so amounts follow the locale's conventions. * Pass any `Intl.NumberFormatOptions` (for example, `minimumFractionDigits`) alongside `locales` to fine-tune the output.