Skip to content

yutokun/Localizer

Repository files navigation

Create GitHub Releases

This library intends to use at small Unity project that needs to be localized to multiple languages.

Download From Here or if you would like, buy it at Asset Store! (currently in review)

Features

  • Automatically inject strings to text-type component.
  • Automatically inject images to image-type component.
  • Simple API
  • Load multi-language definition file. (TSV)
  • Editor preview and useful warnings.

How to Use

Preparation

  1. Make UTF-8 TSV.

    String Injector

  2. Place it to StreamingAssets folder with the name "LocalizedStrings.tsv".

Automatic String Injection

Add String Localizer next to the supported component and enter String ID. It suggest candidate IDs as you type.

Localized strings will be injected when the component starts.

String Injector

Supported component:

  • TextMesh
  • Text (UI)
  • TextMeshPro
  • TextMeshProUGUI

Automatic Image Injection

Add Image Localizer next to the supported component and set images.

Localized images will be injected when the component starts.

Image Injector

Supported component:

  • Renderer
  • Image
  • RawImage

Automatic Audio Injection

Add Audio Localizer next to the supported component and set AudioClips.

Localized audio will be injected when the components starts.

Audio Localizer

Supported component:

  • AudioSource

Get String from Code

var text = Localizer.GetStringFromId("helloworld"); // ex. Hello, World!
var jpText = Localizer.GetStringFromId("helloworld", "Japanese"); // ex. ハローワールド

Change Language

Localizer.ActivateNextLanguage(); // easiest way
Localizer.ActivatePreviousLanguage();
Localizer.ChangeLanguage("Japanese");

Get Available Language List

Localizer.LanguageList; // returns List<string>

Get Current Language Name

Localizer.CurrentLanguageName; // returns string

Reload Strings from Disk

Localizer.Load();

Force Inject to All IInjectors

Localizer.InjectAll();

Use TextMesh Pro

if you want to use this asset with TextMesh Pro, you need to enable TMP Integration. It's easy, just check a box.

Enable TMP

Licenses

create-unitypackage

Copyright (c) 2020 pCYSl5EDgo

MIT license

action-gh-release

Copyright (c) 2019 Doug Tangren

MIT license

This Repo

MIT License