# Simple Localization

We use this [package](https://assetstore.unity.com/packages/tools/gui/simple-localization-with-google-sheets-120113?srsltid=AfmBOoo6NhmWG9r9Am-Ol9qu66e_KDOJYWPw913H47W9l6hds3e66zJc) to translate text, but with little tweaks so it fits well to project.

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2F4tjkeCStgHtLoieByDGD%2Fimage.png?alt=media&#x26;token=283c1c80-5875-4b6e-8ac6-49b4ef39f5b2" alt=""><figcaption></figcaption></figure>

## How to setup

1. *<mark style="color:blue;">**Use google sheets**</mark>* (recomended) and export data as csv. [*<mark style="color:blue;">**Table example**</mark>*](https://docs.google.com/spreadsheets/d/14y-SsSuVeWp80vfD18GyM1o3HVOHSb-86YI3d84qmqk/edit?gid=0#gid=0)\ <mark style="color:$success;">**Add csv file**</mark> with translations to Assets\SimpleLocalization\Resources\Localization folder.
2. a. Use [localized-text](https://reddycat.gitbook.io/base-project-cube-doc/fundamentals/ready-to-use-scipts/localized-text "mention") and enter key in component to translate it on scene start.\
   b. Use <mark style="color:green;">**`LocalizationManager`**</mark>**`.`**<mark style="color:purple;">**`Localize`**</mark>**`(`**<mark style="color:blue;">**`_localizedKey`**</mark>**`)`** to get translated string, but keep in mind to subscribe to <mark style="color:green;">**`LocalizationManager`**</mark>**`.OnLocalizationChanged`** event to set new translated string if user can change language runtime without game restart.
3. <mark style="color:green;">**`LocalizationManager`**</mark>**`.`**<mark style="color:purple;">**`Language`**</mark> property to change language runtime.\
   Use <mark style="color:green;">**GameLanguagesSO**</mark> to get info about translated languages.
4. [appstart](https://reddycat.gitbook.io/base-project-cube-doc/fundamentals/appstart "mention") auto sets language at `BeforeSplashScreenAppear()`.
