$npx -y skills add TabooHarmony/roblox-brain --skill roblox-localizationUse when implementing Roblox multi-language support, translation tables, auto-translation, locale-specific content, or region detection.
| 1 | # Roblox Localization |
| 2 | |
| 3 | ## When to Load |
| 4 | |
| 5 | Load when implementing multi-language support, translation systems, locale-specific content, or region detection. Covers LocalizationService, LocalizationTable, auto-translation, and country/region detection. |
| 6 | |
| 7 | ## Quick Reference |
| 8 | |
| 9 | ### Locale Detection |
| 10 | - `player.LocaleId` — locale the player set for their Roblox account (e.g. `en-us`, `pt-br`, `ja-jp`) |
| 11 | - `LocalizationService.RobloxLocaleId` — locale for core/internal features |
| 12 | - `LocalizationService.SystemLocaleId` — player's OS locale |
| 13 | - `LocalizationService:GetCountryRegionForPlayerAsync(player)` — country code from IP geolocation (e.g. `US`, `BR`, `JP`) |
| 14 | |
| 15 | ### Translation Tables |
| 16 | - `LocalizationTable` — stores translation entries (key → translations per locale) |
| 17 | - Parent `LocalizationTable` under `LocalizationService` for auto-translation |
| 18 | - Set `GuiBase2d.RootLocalizationTable` on GUI objects for per-element tables |
| 19 | - Studio can auto-extract strings into a table via the Localization Tools plugin |
| 20 | |
| 21 | ### Auto-Translation |
| 22 | - Roblox auto-translates GUI text if `RootLocalizationTable` is set and entries exist |
| 23 | - Set `TextLabel.Text` normally — the engine replaces it with the translated string for the player's locale |
| 24 | - Missing translations fall back to the source text |
| 25 | |
| 26 | ### Manual Translation |
| 27 | ```luau |
| 28 | local translator = LocalizationService:GetTranslatorForPlayerAsync(player) |
| 29 | local translated = translator:Translate(game, "Welcome!") |
| 30 | local formatted = translator:FormatTranslate(game, "Coins: {0}", {count}) |
| 31 | ``` |
| 32 | |
| 33 | ### Country/Region Detection |
| 34 | ```luau |
| 35 | local country = LocalizationService:GetCountryRegionForPlayerAsync(player) |
| 36 | if country == "US" then -- USD pricing |
| 37 | elseif country == "GB" then -- GBP pricing end |
| 38 | ``` |
| 39 | |
| 40 | ### Key Rules |
| 41 | - `GetCountryRegionForPlayerAsync` is async — wrap in pcall, may fail |
| 42 | - `GetTranslatorForPlayerAsync` is async — cache the translator |
| 43 | - Auto-translation only works on GUI elements with `RootLocalizationTable` set |
| 44 | - Translation entries: `SourceText`, `SourceLocaleId`, then `en-us`, `pt-br`, etc. columns |
| 45 | - Export/import tables as CSV from Studio for bulk editing |
| 46 | - Test with different locales using Studio's locale simulator |
| 47 | |
| 48 | ### Pitfalls |
| 49 | - Not all locales supported — check `player.LocaleId` |
| 50 | - Auto-translation does NOT work on non-GUI text — use manual `Translator:Translate` |
| 51 | - `GetCountryRegionForPlayerAsync` uses IP geolocation — VPNs give wrong results |
| 52 | - Missing entries fall back to source text silently |
| 53 | |
| 54 | **Need more detail?** Load `references/full.md`. |