# ~~Function: onReplaceTextAfterTranslation()~~ (/jsdoc/pixi-vn-ink/index/functions/onReplaceTextAfterTranslation)



\> **onReplaceTextAfterTranslation**(`getTextToReplace`): `void`

Defined in: [src/functions/replace.ts:30](https://github.com/DRincs-Productions/pixi-vn-ink/blob/cf876d4db655e65b32a20a362a828ecba73f4786/src/functions/replace.ts#L30)

Parameters [#parameters]

getTextToReplace [#gettexttoreplace]

(`key`) => `string` | `undefined`

The function to get the text to replace

Returns [#returns]

`void`

Deprecated [#deprecated]

Use [TextReplaces](/jsdoc/pixi-vn-ink/index/namespaces/TextReplaces) instead.

This function is called after the [onInkTranslate](/jsdoc/pixi-vn-ink/index/functions/onInkTranslate) function is called.
It will replace the text between square brackets.
It can be used for example to replace the character id with the character name:
If there are a character with a name "John" and id "john", and the text is "Hello, my name is \[john]",
the following function will return "Hello, my name is John"

Example [#example]

```ts
import { onReplaceTextAfterTranslation } from 'pixi-vn-ink'
import { getCharacterById } from "@drincs/pixi-vn";

onReplaceTextAfterTranslation((key) => {
    let character = getCharacterById(key)
    if (character) {
        return character.name
    }

    // if return undefined, the system will not replace the character id
    return undefined
})
```
