Pseudo-Localization Pro
Pseudo-localization is a testing technique that transforms your strings to simulate translated text without actual translations.
Why Use Pseudo-Localization?
| Issue | How Pseudo-Localization Helps |
|---|---|
| Text truncation | Bracket encapsulation reveals when UI clips text |
| Text expansion | Simulates 30-40% length increase typical of German/Finnish |
| Character encoding | Accented characters reveal encoding problems |
| Hardcoded strings | Untransformed text stands out as missing localization |
| Placeholder handling | Verifies {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
- Right-click in Project window
- Navigate to Create → KitStack → Lexis → Pseudo-Localization Settings
- Place in
Assets/Resources/for automatic loading
Settings Options
| Setting | Default | Description |
|---|---|---|
EnableAccents | true | Replace ASCII with accented characters |
EnableExpansion | true | Expand text length |
ExpansionFactor | 1.3 | Length multiplier (1.0-2.0) |
EnableBrackets | true | Wrap text in brackets |
BracketPrefix | [ | Opening bracket character(s) |
BracketSuffix | ] | Closing bracket character(s) |
ExpansionMethod | Padding | Padding or WordBased expansion |
PaddingCharacter | ~ | Character for padding expansion |
ExclusionPatterns | URLs, Emails | Regex 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:
- Enter text in the Input Text field
- Adjust settings using the checkboxes and sliders
- View transformed output in real-time
- 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:
- Open Tools → KitStack → Lexis → String Table Browser
- Click the Pseudo button in the toolbar (turns green when active)
- All displayed translations show pseudo-localized versions
- Toggle off to return to normal view
Runtime API
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:
- Select your
LocalizationSettingsasset - Find Pseudo-Localization (Pro) section
- Check Enable Pseudo Localization
- 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
- Test Early: Enable pseudo-localization during UI development, not after
- Check Expansion: German and Finnish can be 30-40% longer than English
- Verify Truncation: Missing brackets indicate clipped text
- Review Formatting: Ensure placeholders and Smart Strings render correctly
- Screenshot Tests: Compare UI screenshots with pseudo-localization enabled
