Skip to content

Pseudo-Localization Pro

Pseudo-localization is a testing technique that transforms your strings to simulate translated text without actual translations.

Why Use Pseudo-Localization?

IssueHow Pseudo-Localization Helps
Text truncationBracket encapsulation reveals when UI clips text
Text expansionSimulates 30-40% length increase typical of German/Finnish
Character encodingAccented characters reveal encoding problems
Hardcoded stringsUntransformed text stands out as missing localization
Placeholder handlingVerifies {0} and Smart Strings work correctly

Transformations

Character Substitution

Replaces ASCII letters with visually similar accented equivalents:

  • aà, eè, oò
  • AÀ, EÈ, OÒ
  • Result: "Hello" → "Ĥèĺĺò"

Text Expansion

Adds padding to simulate longer translations:

  • Factor 1.3 = 30% longer (typical for German)
  • Factor 1.5 = 50% longer (worst-case scenarios)
  • Result: "Hello" → "Hello~~~"

Bracket Encapsulation

Wraps text to detect truncation:

  • Prefix: [, Suffix: ]
  • Result: "Hello" → "[Hello]"

Combined Output

"Hello World" → "[Ĥèĺĺò Ŵòŕĺð~~~]"

Settings Configuration

Create Settings Asset

  1. Right-click in Project window
  2. Navigate to Create → KitStack → Lexis → Pseudo-Localization Settings
  3. Place in Assets/Resources/ for automatic loading

Settings Options

SettingDefaultDescription
EnableAccentstrueReplace ASCII with accented characters
EnableExpansiontrueExpand text length
ExpansionFactor1.3Length multiplier (1.0-2.0)
EnableBracketstrueWrap text in brackets
BracketPrefix[Opening bracket character(s)
BracketSuffix]Closing bracket character(s)
ExpansionMethodPaddingPadding or WordBased expansion
PaddingCharacter~Character for padding expansion
ExclusionPatternsURLs, EmailsRegex patterns to exclude
ExcludedKeys(empty)Specific keys to skip

Preview Window

Menu: Tools → KitStack → Lexis → Pseudo-Localization Preview

The preview window allows testing transformations interactively:

  1. Enter text in the Input Text field
  2. Adjust settings using the checkboxes and sliders
  3. View transformed output in real-time
  4. Click Copy to Clipboard to use the result

Example Texts: Quick-access buttons for common test cases.

String Table Browser Integration

The String Table Browser includes a "Pseudo" toggle in the toolbar:

  1. Open Tools → KitStack → Lexis → String Table Browser
  2. Click the Pseudo button in the toolbar (turns green when active)
  3. All displayed translations show pseudo-localized versions
  4. Toggle off to return to normal view

Runtime API

csharp
using Lexis.PseudoLocalization;

// Transform a single string
string result = PseudoLocalizer.Transform("Hello World");
// Result: "[Ĥèĺĺò Ŵòŕĺð~~~]"

// Transform with custom settings
var settings = PseudoLocalizationSettings.Instance;
settings.ExpansionFactor = 1.5f;
string expanded = PseudoLocalizer.Transform("Button", settings);

// Individual transformations
string accented = PseudoLocalizer.ApplyAccents("Hello");           // "Ĥèĺĺò"
string expanded = PseudoLocalizer.ApplyExpansion("Hello", 1.4f);   // "Hello~~"
string bracketed = PseudoLocalizer.ApplyBrackets("Hello");         // "[Hello]"

// Check if text is pseudo-localized
bool isPseudo = PseudoLocalizer.IsPseudoLocalized(result, settings);

Placeholder Preservation

Pseudo-localization automatically preserves:

  • Positional placeholders: {0}, {1}
  • Named placeholders: {playerName}, {count}
  • Format specifiers: {0:N0}, {0:C}
  • Smart Strings: {count:plural:one=# item|other=# items}
  • URLs: https://example.com
  • Email addresses: user@example.com

Example:

Input:  "Welcome, {playerName}! Visit https://example.com"
Output: "[Ŵèĺçòmè, {playerName}! Vïšïť https://example.com~~~]"

Integration with LocalizationService

Enable pseudo-localization in your LocalizationSettings:

  1. Select your LocalizationSettings asset
  2. Find Pseudo-Localization (Pro) section
  3. Check Enable Pseudo Localization
  4. Optionally assign a custom settings asset

When enabled (in Editor and Development builds only), Localization.Get() returns pseudo-localized strings.

Production Safety

Pseudo-localization is automatically disabled in Release builds.

Best Practices

  1. Test Early: Enable pseudo-localization during UI development, not after
  2. Check Expansion: German and Finnish can be 30-40% longer than English
  3. Verify Truncation: Missing brackets indicate clipped text
  4. Review Formatting: Ensure placeholders and Smart Strings render correctly
  5. Screenshot Tests: Compare UI screenshots with pseudo-localization enabled

Professional Unity Development Tools