RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
ui/ambientSound - Ambient Sound Stream PlayerUI Apps ManagerUI AudioBindings LegendCamera Distance AppConsole (consoleNG)Credits MusicExternal App (WebSocket UI Server)Fade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsUI Navigation / MapVehicle Paint EditorVehicle Vicinity AppUI Visibility
Button ModuleDisplay Data ModuleFilter ModuleTiles ModuleTranslate Helper

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE ExtensionsuigridSelectorUtils

Translate Helper

Translation utility with caching and nested translation pattern resolution.

Translation utility with caching and nested translation pattern resolution.


Overview

translateHelper wraps the engine's translateLanguage function with a cache layer and handles nested translation patterns commonly found in BeamNG content strings.

Module path: lua/ge/extensions/ui/gridSelectorUtils/translateHelper.lua (loaded via require)


Exports (M)

FunctionSignatureDescription
translate(key)Translates a key, resolves nested patterns, caches results.

Internals

Basic Translation

local function translate(key)
  if not key or type(key) ~= "string" then
    return key or "Missing Translation Key!"
  end
  if translateCache[key] then return translateCache[key] end
  local translated = translateLanguage(key, key, true)
  translated = processNestedTranslations(translated)
  translateCache[key] = translated
  return translated
end

Nested Translation Patterns

Handles Angular-style patterns found in BeamNG translation strings:

PatternExampleBehavior
{{ 'key' | translate}}{{ 'ui.menu.title' | translate}}Quoted key with pipe
{{:: 'key' | translate}}{{:: 'ui.label' | translate}}One-time binding syntax
{{ key | translate}}{{ ui.button | translate}}Unquoted key with pipe
{{key}}{{ui.name}}Simple variable substitution

Recursive Resolution

Nested patterns are resolved iteratively (up to 10 iterations) to handle translations that contain further translation keys:

local changed = true
local iterations = 0
while changed and iterations < maxIterations do
  changed = false
  iterations = iterations + 1
  -- Process each pattern type...
end

Caching

Results are cached in translateCache keyed by the original input string. The cache persists for the module's lifetime.

Usage in Grid Selectors

local translate = require("ge/extensions/ui/gridSelectorUtils/translateHelper").translate

-- Translate item names
item.name = translate(campaign.title)
item.level = translate(core_levels.getLevelTitle(item.level))

-- Translate specification labels
{label = translate("ui.common.property.difficulty"), value = translate(difficultyValue)}

How It Works

  1. Caller passes a translation key (e.g., "ui.menu.start")
  2. Cache is checked first for instant return
  3. translateLanguage(key, key, true) queries the engine's localization system
  4. Result is scanned for nested {{ ... | translate}} patterns
  5. Each nested pattern is recursively translated (up to 10 iterations)
  6. Final result is cached and returned

Additional Exports

The following exports are available but not yet documented in detail:

  • M.translate

Tiles Module

Generic tile processing framework for grid selectors - provides path routing, grouping, clustering, and special group handling.

Livery Editor - Camera

Camera management for the livery editor - orthographic views, orbit camera, and layer-based positioning.

On this page

OverviewExports (M)InternalsBasic TranslationNested Translation PatternsRecursive ResolutionCachingUsage in Grid SelectorsHow It WorksAdditional Exports