# Localized Text

When game is good enough to be translated to different languages this script will help

## How to use

* We use this [**package**](https://assetstore.unity.com/packages/tools/gui/simple-localization-with-google-sheets-120113) with little tweaks
* Swap <mark style="color:green;">**Text.cs**</mark> to <mark style="color:green;">**LocalizedText.cs**</mark> or <mark style="color:blue;">**TextMeshProUGUI.cs**</mark> to <mark style="color:blue;">**LocalizedTextMeshProUI.cs**</mark> with debug mode in the inspector:

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2F0c8QdJs2heh22pWxAzMk%2Fimage.png?alt=media&#x26;token=4b64dd83-2520-4fff-af50-cde98cf5fa6b" alt=""><figcaption><p>Enable Debug mode</p></figcaption></figure>

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2F6GJIpZIfXYGyXUMeHHAH%2Fimage.png?alt=media&#x26;token=75ac8003-ddea-4b74-90c5-8e1a889181dc" alt=""><figcaption><p>Change Text.cs to LocalizedText.cs or TextMeshProUGUI.cs to LocalizedTextMeshProUI.cs</p></figcaption></figure>

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2Fa6GFT7QgPjlz4ijGepsq%2Fimage.png?alt=media&#x26;token=c4a21d9e-2864-4595-8456-f3e7ad3d4b5d" alt=""><figcaption><p>Now you can specify Localized Key</p></figcaption></figure>

* Default implementation of LocalizedText.cs is to translate it in Awake with a key by your localization system. We recomend to reload scene on localization language change so all texts will translate again. Or you can implement events handle in LocalizationText.cs.
