Validation System Pro
The validation system helps you catch localization issues before they reach players.
Validation Rules
| Rule | Severity | Description |
|---|---|---|
| Missing Translations | Error | Keys with empty values for some locales |
| Empty Values | Error | Completely empty translation entries |
| Placeholder Mismatch | Error | Different placeholder counts between locales |
| Invalid Smart Strings | Error | Syntax errors in Smart String templates |
| Character Limit | Warning | Translations exceeding defined limits |
| Duplicate Keys | Warning | Same key in multiple tables |
| Unused Keys | Info | Keys not referenced in code |
Running Validation
From String Table Browser
- Open Tools → KitStack → Lexis → String Table Browser
- Click the Validation tab
- Click Run Validation
- Review and fix reported issues
From Menu
- Tools → KitStack → Lexis → Validate All Tables
Validation Results
Results are grouped by severity:
- Errors (Red): Must be fixed before release
- Warnings (Yellow): Should be reviewed
- Info (Blue): Suggestions for improvement
Example Results
[Error] Missing translation for key 'ui.button.start' in locale 'ja'
[Error] Placeholder mismatch in 'score.format': en has {0}, de has {0} {1}
[Warning] Character limit exceeded for 'menu.title' (50 chars, limit 40)
[Info] Unused key 'ui.old_button' in table 'UI'Configuring Validation
Character Limits
Set maximum character lengths in your StringTable entries:
- Open String Table Browser
- Select an entry
- Set Max Length in the entry details
- Validation will warn when translations exceed this limit
Exclusion Patterns
Exclude certain keys from validation:
csharp
var settings = new ValidationSettings
{
ExcludedKeyPatterns = new[]
{
"^debug_.*", // Exclude debug keys
"^test_.*", // Exclude test keys
".*_placeholder$" // Exclude placeholder keys
}
};Source Quality Checker
Before translation, Lexis can analyze source text for common issues.
Detected Issues
| Issue Type | Severity | Example |
|---|---|---|
| Unbalanced placeholders | Error | Hello {name (missing }) |
| Empty placeholders | Error | Hello {}! |
| Encoding issues | Error | Replacement character \uFFFD |
| Multiple spaces | Warning | Hello world |
| Leading/trailing whitespace | Warning | Hello |
| Hardcoded large numbers | Warning | You scored 10000 points |
| URLs in text | Info | Visit https://example.com |
Quality Levels
| Level | Meaning |
|---|---|
| Good | No issues detected |
| Fair | Warnings only |
| Poor | Contains errors |
API Usage
csharp
using Lexis.Editor.Translation;
var checker = new SourceQualityChecker(() => openAiApiKey);
var result = checker.CheckBasicQuality("Hello {name}!");
if (result.HasIssues)
{
foreach (var issue in result.Issues)
{
Debug.LogWarning($"{issue.Type}: {issue.Description}");
}
}CI/CD Integration
Run validation from the command line for automated pipelines:
bash
Unity -batchmode -projectPath /path/to/project \
-executeMethod Lexis.Editor.Validation.ValidationRunner.RunFromCommandLine \
-quitExit Codes
0: No errors1: Validation errors found2: Error running validation
Best Practices
- Run validation regularly - Include in your build pipeline
- Fix errors first - Warnings can wait, errors cannot
- Set character limits - Prevent UI overflow issues
- Review placeholders - Mismatched placeholders cause runtime errors
- Clean unused keys - Reduces translation costs
