- Unity 2018.1 and above.
-
Open the
manifest.json
in your project -
Specify the package URL
{
"dependencies": {
"com.arsenstudio.i18n": "https://github.com/intelligide/unity-i18n.git"
}
- Open your project or reload it in the Unity Editor
First, write your language manifest. It's really simple.
<?xml version="1.0" encoding="utf-8"?>
<resources lang="en">
<string key="my_string">My string</string>
</resources>
You must write one manifest per language and put them on a directory named Resources/I18n
.
You can load translations with LanguageManager
.
ArsenStudio.I18n.LanguageManager.Load("en")
Then, translate like this:
ArsenStudio.I18n.LanguageManager.Tr("my_string") // Returns "My string"
ArsenStudio.I18n.TranslatableString
Translatable strings have custom editors.
using ArsenStudio.I18n;
using UnityEngine;
[CreateAssetMenu(fileName = "Data", menuName = "ScriptableObjects/ExampleScriptable", order = 1)]
public class ExampleScriptable : ScriptableObject
{
public TranslatableString TranslatedString;
}
TranslatableText, TranslatableTextMesh, TranslatableTextMeshPro, TranslatableTextMeshProGUI components
These components are useful for translating Txt components. Put them on the same gameobject as text components.
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.