Info
- Built on Unity Localization package (
com.unity.localization) with Polis helpers in Polis.Core.Localization
- Shared data in the content kit
Localization/, the Localization Settings asset in the project (Assets/Settings)
- Locales (
English, Czech, German, Portuguese, Turkish, Chinese (Simplified))
- String tables (
StringTables/UI) and asset tables (AssetTables/LocalizedAssets)
Localization Google Sheets Service - Google Sheets provider used for import/export
- Tables are edited in the Odin Localization Editor or in Google Sheets, then pulled into Unity
LocalizedString fields, string table collections and the Google Sheets extension have Odin inspectors: term dropdown with search, fallback, values per locale with a smart string toggle, local variables, button to open the term in the Localization Editor
Editor tools
Polis/Localization (CTRL + L) opens LocalizationConfig
Localization Editor button (Odin)
- Defaults: Sheets Provider with
Log In / Log Out, Spreadsheet ID (opens in browser), Columns (Default = key plus a column per project locale)
- Tables: every string table with its sheet and columns, per row
Pull (Merge), Pull (Override), Push
- Selected: the same for the checked tables,
Apply Defaults (links them to the default spreadsheet, a sheet per table, default columns), Copy columns from another table
- Sheet columns are found by the ID in their header cell note (
key, locale code, key-comment, locale code + -comment), so columns can be moved in the sheet. Older letter based extensions are converted on sync
- Toolbar locale selector (Unity 6.3+,
Polis/Locale Selector) - switches locale in the editor and refreshes all LocalizeStringEvents in the scene or open prefab
- Localization credentials (Google OAuth client for the Sheets Service Provider)
GoogleSheetsLocalization.json
Google Sheets workflow
- Load the credentials above into the Sheets Service Provider and authorize (OAuth)
- Set the Spreadsheet ID and columns in
LocalizationConfig, select the tables and press Apply Defaults once
- Pull to get translations into Unity, Push to send new keys to the sheet
Pull (Merge) adds and updates keys, keeps keys missing in the sheet. Pull (Override) mirrors the sheet and deletes keys missing in it
- Push overwrites the mapped sheet columns. Override and Push ask first
Strings in code
SafeLocalizedString - LocalizedString that never throws
ToString() / implicit string returns the localized text, the fallback, or "Undefined Term" when empty
Term = "Table/Entry" (e.g. "UI/Start"), constructors new SafeLocalizedString("UI/Start") or new("UI", "Start")
- JSON (Newtonsoft) stores it as
Term + optional Fallback, so it can be used in remote content and save data
SafeLocalizedString.EMPTY, UNDEFINED, EmptyWithFallback(text)
LocalizationUtility extensions on LocalizedString
SetTerm, GetTerm, GetSafe(), GetLocalizedStringSafe(fallback)
SetParameter<TValue, TVariable>(name, value), WithLocalizedParameters(dictionary) - smart string parameters
WithLocaleOverride(locale), Locale.GetNativeName(), Locale.GetEnglishName()