API ReferenceGE Extensionsflowgraphnodesui
Context Translation (Flowgraph Node)
- **Node Name:** `Context Translation`
Overview
- Node Name:
Context Translation - Category:
repeat_instant - File:
extensions/flowgraph/nodes/ui/contextTranslation.lua
Creates a context-sensitive translation object for localized UI strings with variable substitution.
Pin Schema
Input Pins
| Pin | Type | Description |
|---|---|---|
translationString | string | Translation key (e.g., "ui.missions.speed.description") |
| (dynamic) | (various) | Context variables extracted from the translation string |
Output Pins
| Pin | Type | Description |
|---|---|---|
value | table (translationObject) | Translation object with txt and context fields |
Allowed Manual Pin Types
string, number, bool, any, table, vec3, quat, color
How It Works
init()- EnablessavePinsandallowCustomInPinsfor dynamic pin creation.work()- Builds a translation object:{ txt = translationString, context = { var1 = val1, ... } }from all non-flow, non-translationString input pins.drawCustomProperties()- When the translation string is hardcoded, provides a "Load Variables" button that:- Calls
translateLanguage()to resolve the translation string. - Extracts
{{variableName}}placeholders from the translated text. - Creates input pins for each variable automatically.
- Calls
Translation Object Format
{
txt = "ui.missions.speed.description", -- translation key
context = {
speed = 120, -- variable values
unit = "km/h"
}
}Example Usage
-- Translation string: "Reach {{speed}} {{unit}}"
-- After loading variables, pins 'speed' and 'unit' are created.
-- Connect number/string sources to fill in the context.
-- Output translation object is used by UI message nodes.See Also
- Medal / Auto Medal (Flowgraph Node) - Related reference
- Clear Messages (Flowgraph Node) - Related reference
- ConvertUnit (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide