Skip to content

suncube/LocalizationService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Localization Service GitHub release

Plugin for localization keys. Works with MeshText/UIText/TextMeshPro

Support suncubestudio@gmail.com - subject of mail [Localization Sevice]

How to start

  1. Import plugin from Asset Store or copy from GitHub
  2. Create and Load .CSV
  3. Add UILocalization component to MeshText/UIText/TextMeshPro

Create files of localization

Plugin use .CSV files for localization key/value. Create a table of localization and export it to a .CSV file. You can use for this google sheets, because all your team can edit this with sync.

Create for each language its own list.

Save and export each localization to file “Localization” .CSV file or use Download manager

Copy/put the file to the resources (Resources\Localization). Rename the file to language name. !!! Names of languages you can see here

Download Manager

It is possible to download the latest localization changes from your Google sheet. Plugin uses the Google Sheets API . If you want to use your project for working with tables create here .

This tool can be opened by path Window / Localization

Next - open your localization page and copy google sheet IDKey

Copy and paste this to SpreadSheetKey :

Check the path to localization files will be downloaded. (! it must be a folder ../Resources/Localization)

Press SET button

Get session key (this case will be repeated if the key is expired or invalid)

Copy and paste this to AccessCode field:

Press SET button

Now you need to get list of localization , press GET LIST

A list of localizations will shown like:

  1. List can be updated

  2. Localization can be removed from the list of updated localizations

  3. Download selected list

How to use

  1. Select your text component on the scene MeshText/UIText/TextMeshPro and add the component UILocalization.

  2. Set localization’s key or write to the Key field

If the entered key does not exist you will get an error. Check that the key in the localization!

New version include ability to localize multikey. This is very useful when you using tags.

You need enter the keys for each id {0...N}

Change the location in the code

LocalizationService is singleton, for call this use

  LocalizationService.Instance
  • When it is first started, it get and set system language by Application.systemLanguage. You can change logic of first initialize localization value in LocalizationService.GetLocalization().

for example, you can use this enum for languages values ​​in your project

enum SystemLanguage

LocalizationService.Instance.Localization = SystemLanguage.English.ToString();

Get the key in the code

 // for current set localization
LocalizationService.Instance.GetTextByKey("localization1");

or

"localization1".Translate();

You can encode the transition to a new line by adding the translation value "\n". UILocalization make this automaticly, but if you need made this from code use extension for string ParceNewLine().

// key="line" value = "first line \n secondline"
    UIText.text = "line".Translate().ParceNewLine();

Help Tools:

Analytic Keys (in development)

Path to open Window / Localization / Analytic keys This tool will allow you to analyze all keys that are used in the project (!Before starting you need save all changes in the current scene)

Press "Find Use"

  1. Update Analysis

  2. Search prefabs and scenes

  3. Places where there are errors when using

Errors Types: EmptyKey - key not set KeyNotFound - key not found *TextComponent_NotFound *- no supported component on GameObject - MeshText / UIText / TextMeshPro

  1. List of keys that are not used

! Does not check usage in the code of the project like LocalizationService.Instance.GetTextByKey("localization1")

Twitter Facebook YouTube AssetStore

Donate