|
| 1 | +# 🌐 Language Change Tools for Unity |
| 2 | + |
| 3 | +A handy Unity Editor tool for managing localization keys and language files directly within the Editor. Easily find, edit, and save localization keys, auto-attach components, and generate language files with zero hassle. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 🚀 Features |
| 10 | + |
| 11 | +- 🔍 Find all `TMP_Localizer` components in project prefabs |
| 12 | +- ✏️ Edit `localizationKey` values directly in the Editor window |
| 13 | +- 📅 Save changes back into `.txt` files and update prefab assets |
| 14 | +- ➕ Automatically add `TMP_Localizer` to all `TMP_Text` components |
| 15 | +- 🌍 Generate new language files based on any existing base language |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## 🖼️ Screenshots |
| 20 | + |
| 21 | +| Localization File View | Add Missing Localizers | Create Language View | |
| 22 | +|------------------------|------------------------|----------------------| |
| 23 | +|  |  |  | |
| 24 | + |
| 25 | +More views: |
| 26 | +-  |
| 27 | +-  |
| 28 | +-  |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## 📆 Requirements |
| 33 | + |
| 34 | +- Unity 2022.3+ |
| 35 | +- TextMeshPro |
| 36 | +- [Odin Inspector](https://odininspector.com/) (Editor-only, for UI rendering) |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## 🛠️ How To Use |
| 41 | + |
| 42 | +1. Open the editor via `Tools > Localization Editor 🇨` |
| 43 | +2. Select a language from the dropdown |
| 44 | +3. Search or scroll to find any localization key |
| 45 | +4. Use `Find All TMP_Localizers in Resources` to scan all prefabs |
| 46 | +5. Edit keys and press `Save Changes To Assets` to apply |
| 47 | +6. Use `Add TMP_Localizer to All TMP_Text In Resources` to automate component attachment |
| 48 | +7. Generate new language files with the `Create New Language From Base` section |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## 📚 Project Structure |
| 53 | + |
| 54 | +- `LocalizationEditorWindow.cs` — the main Odin-powered editor window |
| 55 | +- `Resources/Localization/*.txt` — language files |
| 56 | +- `TMP_Localizer.cs` — the component that applies localized text to `TMP_Text` |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## 🔹 Usage Example |
| 61 | + |
| 62 | +Add a `TMP_Localizer` to any `TMP_Text` element. Set its `localizationKey`. |
| 63 | +On language change, it will update the text automatically. |
| 64 | + |
| 65 | +```csharp |
| 66 | +public class TMP_Localizer : LocalizeBase |
| 67 | +{ |
| 68 | + public override void UpdateLocale() |
| 69 | + { |
| 70 | + _text.text = Locale.GetLocalized(localizationKey); |
| 71 | + } |
| 72 | +} |
| 73 | +``` |
0 commit comments