Multi-Language Localization Setup

Texturge provides runtime language switching through ULocalizationSubsystem (a UGameInstanceSubsystem), and the FSemanticAnchor LCS matching mechanism ensures per-character animation correspondence survives translation.

NOTE

Texturge does not use UE5’s native UStringTable for text localization. The proprietary ULocalizationSubsystem and semantic anchoring mechanism are independent of the engine’s localization framework — they only reuse the engine’s culture switch event (FInternationalization::OnCultureChanged).

Supported Languages

The Texturge.uplugin localization targets support 15 languages (NativeCulture = en):

LanguageCodeLanguageCode
EnglishenPolishpl
Simplified Chinesezh-HansGermande
JapanesejaRussianru
KoreankoFrenchfr
SpanishesBrazilian Portuguesept-BR
PortugueseptTurkishtr
ArabicarLatin American Spanishes-419
Italianit

Runtime Language Switching

// Get the subsystem
ULocalizationSubsystem* Localization = GetGameInstance()->GetSubsystem<ULocalizationSubsystem>();

// Switch language (Culture Code)
Localization->SetLanguage(TEXT("ja"));       // Japanese
Localization->SetLanguage(TEXT("zh-Hans"));  // Simplified Chinese
Localization->SetLanguage(TEXT("ar"));       // Arabic

SetLanguage sets the current culture and broadcasts OnLanguageChanged(FString NewCulture) (multicast delegate). UAnimatedTextBlock / UAnimatedRichTextBlock listen to this event and automatically trigger re-bake and replay after a language switch.

Semantic Anchoring

FSemanticAnchor (AnchorId / ContextualSnippet / SourceOffset) uses the LCS (longest common substring) algorithm to locate anchors across translated texts.

The Problem Scenario

Translated text differs in length and character sequence:

  • English "Hello" (5 chars) → Simplified Chinese "你好" (2 chars)
  • Each character owns independent scheduling and curve data in the animation

Anchoring Principle

static TMap<FName, int32> ULocalizationSubsystem::RelocateAnchors(
    const TArray<FSemanticAnchor>& InAnchors,
    const FString& InSourceText,
    const FString& InTargetText);
  1. Exact matching (case-insensitive) takes priority
  2. Unmatched anchors use FindLongestCommonSubstring for approximate matching
  3. CalculateConfidence computes match confidence (0.0–1.0); low-confidence matches are deduplicated
  4. Offsets are clamped within the target text range

Guaranteed Behavior

  • Existing character animation curves carry over to the new language
  • Deleted / added characters never misalign or crash animation data
  • Animation start / end timings stay consistent across languages

Localization Asset Configuration

The plugin’s .uplugin declares 7 localization targets, all covering 15 languages:

TargetLoading policyContent
TexturgeRuntimeAlwaysruntime text (node display names, prompts)
TexturgeEditorEditoreditor UI text
TexturgeEditorTutorialsNevereditor tutorials
TexturgePropertyNamesPropertyNamesproperty name translations
TexturgeToolTipsToolTipstooltip translations
TexturgeKeywordsEditorkeywords
TexturgeCategoryEditorcategory names

The preconfigured localization targets require no manual creation — they register automatically when the plugin loads.

Unicode Support

Internally Texturge uses the Texturge::Unicode namespace utilities for code-point-level classification (IsCJK / IsCJKPunctuation / IsHiragana / IsKatakana / IsHangulSyllables etc.), together with FCharBreakIterator precomputed break points (CJK attachment, surrogate-pair Emoji, Hangul syllables), ensuring correct per-glyph animation for CJK and RTL text.

images/language-selector.png — Runtime language selector diagram: dropdown listing all 15 cultures (en/zh-Hans/ja/ko/es/pt/ar/pl/de/ru/fr/pt-BR/tr/es-419/it), text animation re-bakes immediately on selection
images/localization-setup.png — Localization setup diagram: ULocalizationSubsystem lifecycle (Initialize binds culture change → SetLanguage broadcasts OnLanguageChanged → widgets re-bake), below the RelocateAnchors LCS matching flow (exact match → longest common substring → confidence dedup)