> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.itential.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.itential.com/_mcp/server.

# toLocaleString

> Use the toLocaleString task to convert array elements to a locale-specific string.

The `toLocaleString` task converts the elements of a given array to a locale-specific string. Elements are typically separated by a locale-specific delimiter. The result is similar to the `toString` method, except it is locale-aware.

## Potential use case

Use this task when you need to format data in a language-specific way — for example, displaying currency values in the correct format and symbol for a target locale, such as `"USD"` for US dollars, `"EUR"` for euros, or `"INR"` for Indian rupees.

## Properties

| Input     | Type   | Description                                                                                                                                                              |
| :-------- | :----- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `arr`     | Array  | Required. The array to convert.                                                                                                                                          |
| `locales` | Array  | Required. A BCP 47 language tag string, or an array of such tags. If not provided or `undefined`, the default locale is used.                                            |
| `options` | Object | Required. An object with configuration properties. For number objects, use `Number.prototype.toLocaleString()`. For date objects, use `Date.prototype.toLocaleString()`. |

| Output          | Type   | Description                                                                     |
| :-------------- | :----- | :------------------------------------------------------------------------------ |
| `elementString` | String | A string representing the elements of the array in the specified locale format. |

## Examples

All incoming variables for `toLocaleString` are required.

![](/_fern-img/f2192485f293bc297680b16966c6401d5f35e5f16ceadc4bd08d76b841e3ec39.webp)

The following examples convert numbers into locale-specific currency representations. The `elementString` output is shown in **Task History**, accessed from Jobs in Operations Manager.

**Euro examples**

![](/_fern-img/6ada83ccbfdb99ee83e43dece278cad7c4b1e535bba8e206419883e2f0514bc9.webp)![](/_fern-img/10dfeb4fe1049ceb3a6fb365f720271ce9f0b3bf53bb0c161dc3717b55924baf.webp)

**USD examples**

![](/_fern-img/cc3b7a7fafc7379cb763bc03a3c5896fa5bcd2e16fc96fe83df693a1864f4770.webp)![](/_fern-img/700765c8eafa2b79618808fb1044e2fcc6862c9022be9c440b1b3eaf3efbe568.webp)

## Related reading

For more information on using the `locales` parameter, see the [Intl](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl) reference on MDN.