NarraLeaf

Localization

Reading and switching the game's player-facing language, and reading translation keys.

These six nodes are how a game changes its own language and reads its translation keys: a settings screen lists the project's locales, the player picks one, and the choice is remembered. The languages, the translation tables, and the translation keys are set up in Localization — the nodes only read what is already there. A seventh node, Format Text, is no longer offered in the palette; graphs that hold one keep running.

Conventions

  • One is pure, the rest are latent. Translation Key Text computes its value where it is read, so it works in a Blueprint Value and in a function. The other five return asynchronously and run in event and macro graphs only.
  • This is the game's language, not the editor's. Studio's own interface language is a separate setting that no node here reads or writes. The two are free to differ, and normally do — you author in your language while the game runs in the player's.
  • Where the choice lives. Set Language writes to the host's persistent store under the key nls.locale, one record per project, on the same channel as persistent variables. It survives quitting the game and is not part of a save file, so loading a save never changes the language. On first launch, when nothing valid is stored, the player's system language is matched against the configured locales and persisted; from then on the stored choice wins.
  • A key reads the same everywhere. Get Text, Translation Key Text and a widget whose words come from a translation key give one answer for the same key: the current locale's translation; then the translation of that locale's configured fallback, and so on along the chain; then the key's source text; and, for a key the project does not have, the key's name, so a deleted or mistyped key shows up in the running game instead of rendering blank. Keys are read whether or not the project has a source language.
  • A Blueprint Value follows the language. A Blueprint Value that reads the player's language, through Translation Key Text or through Get Text or Get Current Language in a function it calls, is evaluated again when the player switches language.
  • The voice language is separate. Dub language and subtitle language are deliberately different settings; nothing here touches the voice track.
  • The editor canvas cannot run the latent ones. There is no host on the author-time canvas, so every latent node here except Format Text fails there with This node runs only in a running game. Open Dev Mode to run it., and the canvas renders source-language text by design.

Get Current Language

blueprint.localization.getCurrentLanguage · Latent

The locale code the game is running in: the player's stored choice while it is still one of the project's locales, otherwise the project's source language. A project with no localization set up reads an empty string.

PinDirectionTypeNotes
inin · exec—
nextout · exec—
valueout · datastringLabelled Language.

Set Language

blueprint.localization.setLanguage · Latent

Switches the game's language and remembers the choice.

PinDirectionTypeNotes
inin · exec—
nextout · exec—
languagein · datastringA locale code from the project's configured locales.

The code is checked against the configured locales before anything is written, so a typo cannot strand a player in a language that does not exist: an unknown or empty code is an execution error, and so is running this node in a project with no languages configured at all.

When no playthrough is running, on a title screen for example, the switch takes effect at once:

  • Text on widgets — a Text's content, a Button's label, a Text Input's placeholder — re-resolves and re-renders straight away. Nothing has to be remounted.
  • A Blueprint Value that reads the language is evaluated again and shows the new language.
  • Words a graph already wrote with Set Text or Set Label show as written in every language until the page is opened again. Run the graph again to write them in the new language.

During a playthrough, what happens is set per project under Project → Game → Language, in Changing language during a game:

OptionWhat the player gets
Restart and continue where they wereThe default. The game restarts and returns to the line the player was on, with everything in the new language.
Restart without keeping the playthroughThe game restarts as it launches, on its title screen. The running playthrough is not kept; the player's saves are.
Apply the next time the game is startedNothing in the current session changes, interface text included. The game starts in the new language the next time it is launched.

Get Available Languages

blueprint.localization.getAvailableLanguages · Latent

Every locale the project is configured for, in the order the project lists them.

PinDirectionTypeNotes
inin · exec—
nextout · exec—
valueout · dataarray<struct:nl.language>Labelled Languages, a Language list. Empty when the project has no localization.

Each entry carries code, displayName, and isSource. displayName is the autonym the author entered — 日本語, never "Japanese" — which is what a language picker shows the player; code is what you hand back to Set Language. Read a field with Get Field.

Translation Key Text

blueprint.localization.keyText · Pure

A translation key's words in the player's current language. It gives the same answer as Get Text but has no execution pins, so a Blueprint Value or a function can show a translated word.

PinDirectionTypeNotes
keyin · datastringOverrides the on-card field when wired.
valueout · datastringLabelled Text. An empty string when no key is chosen.

On-card fields

FieldWhat
KeyThe translation key, chosen from the project's keys.

A Blueprint Value that shows it changes language on the same frame as a widget whose words come from a translation key.

To put a value into translated words, wire it into template on Format. With a key settings.seconds whose source text is {0} s and whose Chinese translation is {0} 秒, Translation Key Text into template and a Make Array holding 3 into values shows 3 s in English and 3 秒 in Chinese.

Get Text

blueprint.localization.getText · Latent

Resolves one translation key to its words in the current language. A translation key holds words that every widget and graph naming it shares, and it is translated once.

PinDirectionTypeNotes
inin · exec—
nextout · exec—
keyin · datastringOverrides the on-card field when wired. An empty key is an execution error.
valueout · datastringLabelled Text.

On-card fields

FieldWhat
KeyThe translation key, chosen from the project's keys. Each option shows its source text with the key name after it, so you pick by what the words say.

The answer follows the order under Conventions: the translation along the fallback chain, then the key's source text, then the key's name for a key the project does not have.

Words on a widget do not need this node: a widget whose words are written directly or come from a translation key shows them in the player's language. Reach for Get Text when a graph decides the words, and for Translation Key Text inside a Blueprint Value.

Has Text

blueprint.localization.hasText · Latent

Whether a translation key exists in the project, whether or not the project has a source language.

PinDirectionTypeNotes
inin · exec—
nextout · exec—
keyin · datastringOverrides the on-card field when wired. An empty key reads false rather than failing.
valueout · databooleanLabelled Exists.

On-card fields

FieldWhat
KeyThe translation key, chosen from the project's keys.

This answers is the key defined, not is it translated. A key with no translation for the current locale still reports true, because its source text is what will render. Translation coverage is a question for the localization editor, not for a running game.

Format Text

blueprint.localization.formatText · Latent

Hidden from the palette; graphs that already hold one keep running as before. Use Format instead: it fills the same {0}, {1}, … placeholders from an array, also fills {name} from an object, and works in a Blueprint Value and in a function.

Fills the {0}, {1}, … placeholders of a template with values, by position.

PinDirectionTypeNotes
inin · exec—
nextout · exec—
textin · datastringThe template, usually a Get Text result.
valuesin · datalistSubstituted by index.
valueout · datastringLabelled Result.

The placeholder form is the one translators see, so a translation is free to move a placeholder to wherever its language needs it. That is the reason to format rather than concatenate: concatenation fixes the word order of whichever language you wrote first.

A placeholder with no matching value renders as an empty string, and surplus values are ignored. A values input that is not a list is treated as a single value; an empty one as no values at all.

On this page