Skip to content

intelligide/unity-i18n

Repository files navigation

Text translations For Unity

Contributors Forks Stargazers Issues MIT License

Table of Contents

Getting Started

Prerequisites

  • Unity 2018.1 and above.

Installation

  1. Open the manifest.json in your project

  2. Specify the package URL

{
  "dependencies": {
    "com.arsenstudio.i18n": "https://github.com/intelligide/unity-i18n.git"
}
  1. Open your project or reload it in the Unity Editor

Usage

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"

TranslatableString

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;
}

TranslatableString editor

TranslatableText, TranslatableTextMesh, TranslatableTextMeshPro, TranslatableTextMeshProGUI components

These components are useful for translating Txt components. Put them on the same gameobject as text components.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

About

Text translations For Unity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages