If you haven't already, please consider writing a review. They really help me out!
If you have any questions, then feel free to send me an E-Mail, or Private Message.
I'm also available for freelance work if you need help with your projects.
First, make sure you back up your project files.
Next, install the latest version.
If for some reason the latest updates breaks your project (e.g. errors in the console), then try deleting the root folder for this asset, and reinstalling it.
If it still doesn't work then go back to your previous version, and let me know what the errors are, so I can fix it.
Lean Localization is a lightweight localization asset, allowing you to easily add language-specific text, images, and much more.
First you need to add the LeanLocalization component to your scene:
Your Hierarchy window should now have a new LeanLocalization GameObject added, and this should be automatically selected for you.
Inside the LeanLocalization component, click the Languages > Add button. Do this once for each language you want to support in your project.
To add a translation, simply type the name of your phrase into the Translations search box, and click the Translations > Add button.
Your new phrase will automatically be added as a child to your LeanLocalization component.
To add a translation, select your LeanPhrase component, and click the Create button next to the language you want.
Inside the phrase translation you can see two settings:
Text - Allows you to set the translated text for that phrase.
Object - Allows you to set the translated object for that phrase (e.g. Texture, Prefab, Sound).
Finally, you need to add a localization component to your scene.
Once added, you will see the Phrase Path setting, which you can set the phrase you want to use.
You can also click the List button to quickly see what's available.
That's it, your game will now automatically update based on your translations!
Select the GameObject that has the LeanLocalization component, then click the Current Language > List button.
Drag and drop the GameObject that has the LeanLocalization component into your event Object field, and select the LeanLocalization.SetCurrentLanguage function.
Simply set the Lean.Localization.LeanLocalization.CurrentLanguage static property. For example:
Lean.Localization.LeanLocalization.CurrentLanguage = "English";
If you just want to get translated text, then you can call:
Lean.Localization.LeanLocalization.GetTranslationText("YourPhraseNameHere");If you want a Unity Object (e.g. Sprite), then you can call:
Lean.Localization.LeanLocalization.GetTranslationObject("YourPhraseNameHere");
If you're not happy with the default language selection, then you can open LeanLocalization.cs, and edit the AddPresetLanguage list starting on line line 14. For example:
AddPresetLanguage("Korean", "ko", "ko-KR");Where the first string is the language name, and the other strings are all culture names associated with that language.
To localize more components, simply implement the LeanLocalizedBehavior base class in your own components.
This class has the UpdateTranslation(LeanTranslation translation); method, where the specified translation will be null if it doesn't exist. If it does exist then you can read the translation.Data value, you can then cast this to the required type before use.
Take a look at the code for LeanLocalizedSpriteRenderer to see just how easy this is.
The more translations you add to your project, the more difficult Lean Localization can be to use, because the translation name dropdown list will become increasingly long.
To fix this, you can organize your translations into groups.
To do this, simply add forward slashes to your translation names when creating them.
When using a translation name dropdown, this will automatically place MyTranslation into a group called MyGroup.
If you have many translations or use many scenes then you may want to use prefabs instead of placing everything in the scene.
Drag and drop your phrases, CSV loaders, and tokens into your Project window, turning it into a prefab.
Delete your prefab instances from the scene.
Drag and drop your prefabs (or a root folder they belong to) into the LeanLocalization.Prefabs setting.
Done!
Your localizations should now be automatically loaded from prefabs, giving you better performance, and improved organization.
If you have many LeanLocalization components in different scenes, then this may be tedious to do. To fix this you can make your LeanLocalization component itself a prefab too, so you only have to view the prefab itself to trigger the update.
Tokens allow you to find and replace text. For example, if you want to include the player's name inside a localized text field, then the tokens feature allows you to do this.
To create a token you can either:
You've now created a token, where the GameObject name controls the name of the token.
A token can be added using curly braces, like this:
Hi, my name is {NAME}!Where the token GameObject is called NAME.
Your translated text should now automatically have any tokens replaced.
You can also change the value of a token in game using the LeanToken.SetValue method.
Cultures allow you to associate language codes with language names. For example, English might be associated with en-GB, en-US, etc.
When you start your application the current device language code will be loaded, and the associated language will be chosen.
Internally, the LeanPhrase component only stores Text (string) and Object (UnityEngine.Object) types.
Sprites in the Unity project window are stored as children of their source image. This means when you drag and drop a sprite, you're usually dragging and dropping the parent image, which may give you undesired behaviour when you drag it into an Object field.
To avoid any unexpected behaviour, I added the additional Sprite setting, so you can drag and drop the sprite's parent image, and Unity will automatically drop the sprite in.
This issue doesn't occur for most other scenarios, so you can use the Object type for everything else like Mesh, Material, etc.
Here's a list of all my other assets, please check them out!
You can also view this list on my Asset Store page.
Rapidly develop your game with consistent input across desktop & mobile using Lean Touch. This lightweight asset comes with many modular components, allowing you to customize them to your exact project needs!
Lean Touch+ is an extension to the popular Lean Touch asset, adding many more example scenes.
Lean Localization is a localization library that's designed to be as simple to use as possible for both designers, and programmers.
Quickly optimize the performance of your games using Lean Pool. Within minutes you can use this lightweight asset to preload, recycle, and limit the spawning of your prefabs.
Quickly polish your games using Lean Transition. This asset allows you to easily tween or animate almost anything in your game, making it transition smoothly.
Lean GUI is a colllection of components that extend Unity's GUI system, allowing you to rapidly enhance the user experience (UX) of your game's UI.
Paint all your objects using Paint in 3D - both in game, and in editor. All features are optimized with GPU accelerated texture painting, so you can enjoy consistent performance, even if you paint your objects one million times!
Unlock the full potential of your 2D games using Destructible 2D, this asset allows you to quickly convert all your boring solid sprites into fully destructible ones!
Quickly make the space scene of your dreams using Space Graphics Toolkit. This huge collection of space effects can be customized and combined in any way you like, allowing you to quickly make realistic or fantasy worlds. Each feature has been heavily optimized to run on almost any device and platform.
This pack contains 26 high detail PBR planets, all finished using the powerful planet features of Space Graphics Toolkit (SGT). This is a standalone package, so SGT is not required. You can even use the included features to turn your own planets into beautiful worlds!
Unity sounds only emanate from a single point source. This is great for explosions and footsteps, but quite often you need something more advanced. Volumetric Audio is an easy to use package that allows you to define boxes, spheres, capsules, paths, or meshes that sounds can emanate from.
Updated documentation.
Fixed LeanLocalization.SetToken method.
Fixed "Default Language" fallback for missing translations.
Added Lean/Localization/TextMeshPro extension package.
Added missing translation warning.
Added duplicate translation warning.
Added prefab support.
Renamed LeanPhrasePathAttribute to LeanTranslationNameAttribute.
Renamed LeanLocalization Phrases list to Translations.
Renamed LeanTranslation.Text/Object to .Data.
Replaced text args with LeanToken.
Fixed CSV file export.
Improved phrase updating code.
Missing translations will now fall back to the Default Language.
Allowed multiple localizations with the same settings to be active at the same time.
Moved main build to Unity 2017.4.0f1.
Restructured project files.
Rewrote core code to be simpler.
Simplified demo scenes.
Moved phrases and translations to LeanPhrase component.
Improved phrase organization using hierarchy.
Added phrase search box.
Added LeanLocalization.SetCurrentLanguage(int) method.
This class contains useful methods used in almost all of my code.
This gives you the time-independent 't' value for lerp when used for dampening. This returns 1 in edit mode, or if dampening is less than 0.
This allows you to destroy the target object in game and in edit mode, and it returns null.
This gives you the actual object behind a SerializedProperty given to you by a property drawer.
This class allows you to quickly make custom inspectors with common features.
If you implement this interface in a component on your pooled prefab, then the OnSpawn and OnDespawn methods will be automatically called when the associated LeanGameObjectPool.Notification = PoolableInterface.
This class allows you to pool normal C# classes, for example:
var foo = Lean.Pool.LeanClassPool
Lean.Pool.LeanClassPool
This will either return a pooled class instance, or null. If an instance it found, onSpawn will be called with it. NOTE: onSpawn is expected to not be null.
This will either return a pooled class instance, or null.
All pooled classes will be checked with match to see if they qualify.
This will either return a pooled class instance, or null.
All pooled classes will be checked with match to see if they qualify.
If an instance it found, onSpawn will be called with it.
This will pool the passed class instance.
This will pool the passed class instance.
If you need to perform despawning code then you can do that via onDespawn.
This component allows you to pool GameObjects, giving you a very fast alternative to Instantiate and Destroy.
Pools also have settings to preload, recycle, and set the spawn capacity, giving you lots of control over your spawning.
All active and enabled pools in the scene.
The prefab this pool controls.
If you need to peform a special action when a prefab is spawned or despawned, then this allows you to control how that action is performed.
Should this pool preload some clones?
Should this pool have a maximum amount of spawnable clones?
If the pool reaches capacity, should new spawns force older ones to despawn?
Should this pool be marked as DontDestroyOnLoad?
Should the spawned clones have their clone index appended to their name?
Should detected issues be output to the console?
Find the pool responsible for handling the specified prefab.
Find the pool responsible for handling the specified prefab clone.
Returns the amount of spawned clones.
Returns the amount of despawned clones.
Returns the total amount of spawned and despawned clones.
This will either spawn a previously despanwed/preloaded clone, recycle one, create a new one, or return null.
This will either spawn a previously despanwed/preloaded clone, recycle one, create a new one, or return null.
This will despawn the oldest prefab clone that is still spawned.
This method will despawn all currently spawned prefabs managed by this pool.
This will either instantly despawn the specified gameObject, or delay despawn it after t seconds.
This method will create an additional prefab clone and add it to the despawned list.
This will preload the pool based on the Preload setting.
This class handles the association between a spawned prefab, and the LeanGameObjectPool component that manages it.
This stores all references between a spawned GameObject and its pool.
This allows you to spawn a prefab via Component.
This allows you to spawn a prefab via Component.
This allows you to spawn a prefab via Component.
This allows you to spawn a prefab via GameObject.
This allows you to spawn a prefab via GameObject.
This allows you to spawn a prefab via GameObject.
This will despawn all pool clones.
This allows you to despawn a clone via Component, with optional delay.
This allows you to despawn a clone via GameObject, with optional delay.
Thank you for using Lean Localization ❤️
How do I Get a Translation From C# Code?
How do I Add to the Language List?
How do I Localize Other Components?
How do I better organize my translations?
Why can you only translate Text, Object, and Sprite?
Planet Pack - Space Graphics Toolkit