Repository navigation
Quick Start
Use the Unity package manager to import the package from GitHub with te following url: https://github.com/3Dimensions-NL/Localization.git
The samples contain important starter files for your localization and some examples of how you can use the package. Go to the samples tab in the Unity Package Manager to import the samples.

You can find the folder here: Assets/Samples/3Dimensions Localization/(version number)/Sample assets
In the samples folder under Localizations you will find to premade 'LanguageObjects'.
These are scriptable objects that define the available languages in your project. Every Language Objects needs a corresponding Flag and a list of locales (f.e. en-US for United States English, but also en-UK for United Kingdom)

You can make new ones simply by duplicating one of these and renaming them and filling the needed data.

Translations can be three things (for now):
- A string
- A sprite (image)
- A audio clip
In a Unity Project window, navigate to a folder where you want to store your translations.
Rightclick somewhere in the project window and navigate to Create > 3Dimensions > Localization
Select the translation asset type you want to create (string, sprite or audio clip) and name it to something logical.

Now select your newly created Translation Asset and add some translation info.

On the GameObject you want to translate, Click the "Add Component" button in the inspector and add the TranslationComponent.
This is a generic component that can translate other Unity components. Compatible components are:
- UnityEngine.UI.Image object (sprite)
- TextMeshPro text object (string)
- TextMeshPro Input Field (string)
- Legacy Text object (string)
- UnityEngine.AudioClipt (audio clip)
We are planning to add more, but these are the most used ones for now. Let us know which components you want to see supported.
Alright, drag n drop your Translation Asset created in step 4 into the Translation Asset slot on the component.
To preview the translation, click the Apply Translation button or the Switch Translation button This way you can check if the used text is not to large for certain UI elements for example.

The Localization Manager is used to setup all the Translation Components.

When an application is first started it will try to set the language based on the locale of the device it is running on. It also handles the changing to other languages and stores the player selected default language in player prefs of the device.
You can find the prefab in the samples folder under Prefabs. Add the prefab to the first scene that is loaded to work directly from the start. The prefab will be persistent through the applications lifetime.
Why localizing a project and not give the players the option to change to a different language?! Add the Prefab LanguageSelectButton in your settings page (or wherever you want). You can off course style it the way you want.

We also added an editor window if you want to change multiple translations at once. The window is found in the top menu under: 3Dimensions > Localization > Localization Editor

When you open it for the first time, you will get the question to specify a folder for your translations. After that, all new translation (created by the editor window) will be stored in this folder. You can change te folder at any time you want, but remember that the editor window will only load translations present in that folder.
Another neat feature is that you can export or import csv files to create or update translations in bulk. The csv needs to be (off course) in the right format. The easiest way is to create a few string translations assets and export the file to see the csv structure.
Unfortunately this does not work for sprits or audio clips... duh!
Alright, you can now create a localized unity project!