Localization Specialist
Overview
Management of multi-language support using Unity's Localization package. Covers String Tables, Asset Tables, Smart Strings for dynamic values, and CSV import/export workflows.
When to Use
- Use for translating UI text
- Use for regional asset swapping (flags, voiceover)
- Use for dynamic text (player names, numbers)
- Use when preparing for global release
- Use for managing enormous text databases
Key Concepts
| Concept | Description |
|---------|-------------|
| String Table | Key-Value pairs for text (Key -> "Hello") |
| Asset Table | Key-Value pairs for assets (Key -> Texture/Audio) |
| Locale | Represents a language/region (en-US, ja-JP) |
| Smart String | Text with logic: "You have {count} coin{count:plural(s)}" |
| Key | Unique identifier string (e.g., HUD_Health_Label) |
Architecture
┌─────────────────────────────────────────────────────────────┐
│ LOCALIZATION ARCHITECTURE │
├─────────────────────────────────────────────────────────────┤
│ │
│ LOCALIZATION SETTINGS │
│ ┌──────────────────────┐ │
│ │ Locales: [EN, ES, JP]│ │
│ │ Default: EN │ │
│ └──────────┬───────────┘ │
│ │ │
│ ▼ │
│ STRING TABLES COLLECTION │
│ ┌──────────┬───────────┬───────────┐ │
│ │ EN Table │ ES Table │ JP Table │ │
│ ├──────────┼───────────┼───────────┤ │
│ │ "Play" │ "Jugar" │ "Play" │ │
│ └──────────┴───────────┴───────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Best Practices
- ✅ Use descriptive Keys (
Screen_Widget_Description) - ✅ Separate Tables by context (
UI,Dialogues,Items) - ✅ Use Smart Strings for pluralization and gender
- ✅ Use CSV for external translation workflow
- ✅ Load Locales asynchronously
- ❌ NEVER hardcode text in C# strings
- ❌ NEVER use auto-generated Keys (hard to maintain)
- ❌ NEVER mix assets and strings in the same table
Few-Shot Examples
Example 1: Localizing Logic (C#)
User: "Get localized string in code."
Agent:
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
public class LocalizationHelper : MonoBehaviour
{
[SerializeField] private LocalizedString _welcomeMessage;
public async void UpdateText()
{
// Approach 1: Async handle (Recommended)
string text = await _welcomeMessage.GetLocalizedStringAsync().Task;
Debug.Log(text);
// Approach 2: Direct Table Key
var op = LocalizationSettings.StringDatabase.GetLocalizedStringAsync("UI_Table", "HUD_Welcome");
if (op.IsDone)
Debug.Log(op.Result);
}
}
Example 2: Smart String (Pluralization)
User: "Text should say '1 coin' or '5 coins'."
Agent:
Key: `HUD_Coins_Found`
Values:
- EN: "Found {count} coin{count:plural(s)}!"
- ES: "¡Encontraste {count} moneda{count:plural(s)}!"
C# Usage:
_localizedString.Arguments = new object[] { coinCount };
_localizedString.RefreshString();
Example 3: Changing Language
User: "Switch language to Spanish."
Agent:
using UnityEngine.Localization.Settings;
public void SetLanguage(string localeCode) // "es"
{
var locale = LocalizationSettings.AvailableLocales.GetLocale(localeCode);
if (locale != null)
{
LocalizationSettings.SelectedLocale = locale;
}
}
TDD Contract
⚠️ Legacy Skill — Refactor Pending
Este skill NO tiene tests automatizados aún. El siguiente boilerplate es un punto de partida.
// Escribe estos tests ANTES de implementar:
// Test 1: should [expected behavior] when [condition]
[Test]
public void LocalizationSpecialist_Should{ExpectedBehavior}_When{Condition}()
{{
// Arrange
// TODO: Setup test fixtures
// Act
// TODO: Execute system under test
// Assert
Assert.Fail("Not implemented — write test first");
}}
// Test 2: should handle [edge case]
[Test]
public void LocalizationSpecialist_ShouldHandle{EdgeCase}()
{{
// Arrange
// TODO: Setup edge case scenario
// Act
// TODO: Execute
// Assert
Assert.Fail("Not implemented");
}}
// Test 3: should throw when [invalid input]
[Test]
public void LocalizationSpecialist_ShouldThrow_When{InvalidInput}()
{{
// Arrange
var invalidInput = default;
// Act & Assert
Assert.Throws<Exception>(() => {{ /* execute */ }});
}}
Pasos para completar el TDD:
- Descomenta los tests above
- Implementa la funcionalidad mínima para que compile
- Ejecuta los tests — deben fallar (RED)
- Implementa la funcionalidad real
- Verifica que los tests pasen (GREEN)
- Refactorea manteniendo los tests verdes
Nota: Este skill fue marcado como tdd_first: false durante la auditoría v2.0.1. La sección TDD fue agregada automáticamente pero requiere customización manual para reflejar el comportamiento real del skill.
Related Skills
@ui-toolkit-modern- Binding localized strings@addressables-asset-management- Localization uses Addressables@data-driven-design- Structure keys effectively