LogoPixi’VN
indexNamespacesTextReplacesFunctions

Function: replace()

> replace(text, replaceOptions): string

Defined in: node_modules/@drincs/pixi-vn-json/dist/translator.d.ts:200

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 sul testo.

Parameters

text

string

Il testo sorgente da processare.

replaceOptions

Specifica quale fase di handler eseguire.

type

"before-translation" | "after-translation"

Quale fase di handler eseguire.

Returns

string

Il testo dopo che tutti gli handler sono stati applicati.

Example

// 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" });

On this page