Localization framework that comes with adaptor for GDatabase backend, bundled caching, runtime caching, and more.
(Cycling through some localized languages for PHASERBEAK)
DTLocalization supports caching your localization data as part of the build (bundled). You can cache it manually in the editor or integrate it as a step in your build pipeline (recommended).
It also supports downloading the localization data during runtime and also caching that data to prevent repeated requests within a period of time.
Add Google service account credentials to your project and DTLocalization will automatically populate new keys with a placeholder translations through the Google Translate API!
Placeholder translations are marked as needsUpdating in the localization table and can be sent to external translators for final translation.
DTLocalization comes with support for TextMeshPro, including an automated workflow for downloading all used characters to be built into the font atlas and also automatically downgrading the TextMeshPro text into Unity text if characters are missing from the atlas.
In combination with DTCommandPalette, DTLocalization comes with handy commands for searching through localization keys, adding new localization keys, and more. All these commands can be run right inside the Unity editor!
Currently DTLocalization supports storing localization data inside Google spreadsheets through the GDataDB API, but can be easily extended to support other types of backends.
- Download the DTLocalization project from this repository by pressing this link. It should automatically download the latest state of the master branch.
- Place the downloaded folder in your project. I recommend placing it in the Assets/Plugins directory so it doesn’t add to your compile time.
- Follow the steps to setup a Google developer account and create a service account address and p12 key here.
- Create a spreadsheet named 'Localization Database' in Google Drive with two sheets: we'll name them 'Localization' and 'Localization Master'.
- 'Localization' should have the columns 'Key | Language Code | LocalizedText | NeedsUpdating'. See example here.
- 'Localization Master' should have the columns 'Key | Context'. See example here.
- Share the spreadsheet with read-only access to the service account address (looks like xxxx.gserviceaccount.com).
- (In Unity) Create a GDatabaseSource asset in your project by right-clicking in the project window and going to Create -> DTLocalization -> GDatabaseSource.
- Setup your newly created GDatabaseSource with a table key, a unique key used to identify this localization table.
- Set the Service Account Address_ under the OAuth2 properties to the service account with read-only access. Link the p12 file renamed with .bytes extension as the Private Key P12 Asset_.
- Create another service account, this time set it up with edit access (read-write). Set this under the Editor Service Account Address_ so editor tools can write to the localization table.
- (In Unity) Create an EditorLocalizationConfiguration asset in your project by right-clicking, Create -> DTLocalization -> EditorLocalizationConfiguration.
- Set your master language using the language codes from this page.
- Set which languages to localize to using the language codes from this page.
- These values are just used for the editor tools and have no restriction on what types of languages can be localized in the database.
- (In Unity) Create an GoogleTranslateSource asset in your project by right-clicking, Create -> DTLocalization -> GoogleTranslateSource.
- Setup the Google Translate Source with a service account + enable Google Translate API access for your account.
- Add DTCommandPalette to your project (along with DT_COMMAND_PALETTE compile define) to access editor commands.
- Press Cmd-shift-M to open command palette.
- Type in "Add Localization Key".
- Fill out localization key along with initial translation.
- Now you should have the localized key and translated values in the spreadsheet!
- Add a LocalizedText component to your text component and link a UI Text component to it.
- Set the localization key.
- Press play!
- Check out the different languages localized by pressing cmd-shift-M and running the "EnableLocalizationAutoSwitch" command.