Localization specialist

From nlelouche/Unity-SkillForge · View interactive version

Localization specialist is an AI agent skill from the GitHub repository nlelouche/Unity-SkillForge. Integration of Unity Localization package for multi-language support, covering Tables, Smart Strings, and CSV workflows.

How to use this skill

Skill file

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

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

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:

  1. Descomenta los tests above
  2. Implementa la funcionalidad mínima para que compile
  3. Ejecuta los tests — deben fallar (RED)
  4. Implementa la funcionalidad real
  5. Verifica que los tests pasen (GREEN)
  6. 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

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.