In this video, I'll show you how to use the Unity Localization Package to translate your game into multiple languages. I'll also introduce a third-party asset that can automatically translate your game using Google Translate.
Written Steps:
1. Import the Localization Package: Start by importing the Unity Localization Package into your project. This will automatically install the Addressable Package.
2. Open Localization Tables: Go to `Window - Asset Management - Localization Tables`.
3. Create Localization Settings: In your project, create a Localization Settings asset inside a dedicated "Localization" folder.
4. Generate Locales: Use the Locale Generator to create a folder named "Locale" where you can store all your languages (e.g., English and German).
5. Create a Table: In a "Tables" folder, create a new table named "Main Menu" (for this example).
6. Add Translation Keys: For each piece of translated text, create a unique key, give it a descriptive name, and input your translations.
7. Link Keys to Text: Navigate to your text components, add a Localized String Event, select the appropriate key, and apply it to the TextMeshPro (TMPro) text component.
8. Test Language Switching: Implement the above steps for all text elements. When you play the game and change the language via the upper-right corner menu, the text should update accordingly.
9. Allow In-Game Language Switching: To let players change the language in-game, create a new script, import the using UnityEngine.Localization; directive, and change the language using the command:
LocalizationSettings.SelectedLocale = LocalizationSettings.AvailableLocales.Locales[0];
10. Automatic Translation: If you want to automatically translate your game into more languages, import the "Auto Translate for Unity Localization" asset from the Unity Asset Store.
11. Translate String Tables: Go to Window - Auto Localization- Auto Translate for String Tables, select the source language, and click "Translate." If done correctly, all your string tables should now be translated.
Globe by: Serhio Magpie, CC BY-SA 4.0 https://creativecommons.org/licenses/..., via Wikimedia Commons
00:00 Introduction
00:25 Tutorial
01:40 Automatic Translation
02:08 Localize Scripts