---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [i18n](../index.md) / t

# Function: t()

> **t**(`key`, `defaultValue`, `options?`): `string`

Defined in: [packages/b2c-tooling-sdk/src/i18n/index.ts:190](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/i18n/index.ts#L190)

Translate a message key with an inline default.

The default string is used directly during development and serves as
the English translation. Future localization adds translations via
locale files without changing call sites.

## Parameters

### key

`string`

Dot-notation key (e.g., 'error.serverRequired')

### defaultValue

`string`

The default English string

### options?

[`TOptions`](../type-aliases/TOptions.md)

Optional interpolation values

## Returns

`string`

The translated string

## Examples

```ts
// Simple usage
t('error.serverRequired', 'Server is required.')
```

```ts
// With interpolation
t('error.fileNotFound', 'File {{path}} not found.', { path: filePath })
```

```ts
// With multiple interpolations
t('info.uploadProgress', 'Uploading {{file}} ({{percent}}%)', { file: name, percent: 50 })
```
