# Function: replace() (/jsdoc/pixi-vn-json/index/namespaces/TextReplaces/functions/replace)



\> **replace**(`text`, `replaceOptions`): `string`

Defined in: [src/translator/TextReplaces.ts:125](https://github.com/DRincs-Productions/pixi-vn-json/blob/0ec56d6865b31246020f5a060dc38e1b07e3c8bf/src/translator/TextReplaces.ts#L125)

Applica tutti gli handler registrati del tipo specificato al testo dato.

Questa funzione NON esegue più la pre-elaborazione i18n automaticamente.
Se vuoi applicare la pre-elaborazione i18n, usa prima [runI18nPreStep](/jsdoc/pixi-vn-json/index/namespaces/TextReplaces/functions/runI18nPreStep) sul testo.

## Parameters [#parameters]

### text [#text]

`string`

Il testo sorgente da processare.

### replaceOptions [#replaceoptions]

Specifica quale fase di handler eseguire.

#### type [#type]

`"after-translation"` | `"before-translation"`

Quale fase di handler eseguire.

## Returns [#returns]

`string`

Il testo dopo che tutti gli handler sono stati applicati.

## Example [#example]

```ts
// Solo handler di tipo "before-translation"
TextReplaces.replace("Ciao [name]", { type: "before-translation" })

// Con pre-elaborazione i18n:
let t = TextReplaces.runI18nPreStep("Ciao [name]");
t = TextReplaces.replace(t, { type: "before-translation" });
```
