There are three ways to start using the Localization Editor to manage your strings.
- Enter strings in Unity
- Import them from a Spreadsheet (Local Excel File or Google Spreadsheet)
- Import them from a Scene
I’ll start with entering your strings in Unity.
Entering String in Unity:
First, create a new Language in the String Table Editor.
Second, enter your strings.
Importing Strings From a Spreadsheet:
First, launch the Import Spreadsheet Wizard.
Second, follow the prompts to import your strings. The format is: First Column defines the keys, First Row defines the language code (or custom language name). Here is a list of the language culture names. Names not matching a culture code will be be processed as a custom language.
Importing Strings From a Scene:
Localization Editor has the ability to process a scene. Any Text, GUIText, or TextMesh components will be automatically configured with the LELocalize component. The process assigns a unique ID to each string, records the string in the LE system, and configures your scene to work with LE.
Note: Backup your project! Always backup your project before running the Process Scene action.
- Open the scene you’d like to process in Unity.
- Click the “Proces Text in Scene” menu item.
- When the process is done, you will see a summary dialog. The imported strings will appear in the String Table Manager.
Access Strings During Runtime:
If you imported your strings using the Process Text in Scene action, then you don’t need to do anything else to access your strings! To change the language during runtime, read Change Language During Runtime.
Using the LELocalize Component:
First, add the LELocalize component to any GameObject that contains a supported component (Text, GUIText, TextMesh). Second, if you’d like to create a new key for the string, select New Key and follow the prompts. If you’ve already created a key, select Use Existing Key and select a key from the drop down list. If you’d like to reconfigure the LELocalize component, remove it and add it again.
Notes: The checkbox to the right of the Key drop down and the Register LE Events toggle should remain checked. These exist to support the sample scene.
Access Strings from Scripts:
Use the “Generate Static Key Class” menu to generate a class that will contain all your keys.
To access a string from a script call LEManager.Get with the key you’d like to fetch:
string localized_name = LEManager.Get(LEKeys.name);
Changing the Language During Runtime:
You can change the language at any time. All text components that have been configured with the LELocalize component will update when a language is set. To use a language, set LEManager.CurrentLocSet to the language code (or custom language name) you’d like to use.
LEManager.CurrentLocSet = "ko-KR";
Using the Sync Tool:
LE comes with a sync tool that keeps your strings up to date with a spreadsheet. It helps manage localization when working with translators or other developers.
The sync tool will show you any differences between the spreadsheet and your local strings. Choose which version you’d like to keep, and the Sync tool will make those changes in your project and export those changes to the spreadsheet.