|
1 | | -#Localization Service <br> |
2 | | -https://www.assetstore.unity3d.com/en/#!/content/50442<br> |
3 | 1 |
|
4 | | -<a href = "https://docs.google.com/document/d/1V2SNGZ09C2vN8lBXGJSKonXQCUmlcAyev5UoodWeohU/edit?usp=sharing"> [Tutorial] </a><br><br> |
5 | 2 |
|
6 | | -This package is designed to show the localization of text in your applications. <br> |
7 | | -- simple integration interface<br> |
8 | | -- convenient editor<br> |
9 | | -- localization located in the .CSV file<br> |
10 | | -- works with several possible types of text output in Unity (MeshText and UIText), there is also has the opportunity to get text value of the code.<br> |
| 3 | +# Localization Service |
| 4 | + |
| 5 | +Plugin for localization keys. Works with **MeshText/UIText/TextMeshPro** |
| 6 | + |
| 7 | +Support [suncubestudio@gmail.com](mailto:suncubestudio@gmail.com) - subject of mail [Localization Sevice] |
| 8 | + |
| 9 | +# How to start |
| 10 | + 1) Import plugin from [Asset Store](http://u3d.as/miF) or copy from [GitHub](https://github.com/suncube/LocalizeService) |
| 11 | + 2) Create and Load .CSV |
| 12 | + 3) Add **UILocalization** component to **MeshText/UIText/TextMeshPro** |
| 13 | + #### [HOW TO USE ](#how-to-use) |
| 14 | + |
| 15 | + - Help tools: [Analytic of Keys ](#help-tools) |
| 16 | + |
| 17 | + |
| 18 | +# Create files of localization |
| 19 | +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. |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +Create for each language its own list. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +**Save and export** each localization to file **“Localization” .CSV** file or use [Download manager](#download-manager) |
| 34 | + |
| 35 | +> Copy/put the file to the resources (Resources\Localization). Rename |
| 36 | +> the file to language name. [!!! Names of languages you can see |
| 37 | +> here](https://docs.unity3d.com/ScriptReference/SystemLanguage.html*) |
| 38 | +
|
| 39 | + |
| 40 | + |
| 41 | +## Download Manager |
| 42 | + |
| 43 | +It is possible to download the latest localization changes from your Google sheet. Plugin uses the [Google Sheets API](https://developers.google.com/sheets/) . If you want to use your project for working with tables [create here](https://console.developers.google.com/project) . |
| 44 | + |
| 45 | +This tool can be opened by path **Window / Localization** |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +Next - open your localization page and copy google sheet **IDKey** |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | +Copy and paste this to **SpreadSheetKey** : |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +> Check the path to localization files will be downloaded. (! it must be |
| 69 | +> a folder **../Resources/Localization**) |
| 70 | +
|
| 71 | +Press **SET** button |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | +Get session key (this case will be repeated if the key is expired or invalid) |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +Copy and paste this to **AccessCode** field: |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +Press **SET** button |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | +Now you need to get list of localization , press GET LIST |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | +A list of localizations will shown like: |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +1. List can be updated |
| 109 | + |
| 110 | +2. Localization can be removed from the list of updated localizations |
| 111 | + |
| 112 | +3. Download selected list |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | +## How to use |
| 118 | + |
| 119 | +1) Select your text component on the scene **MeshText/UIText/TextMeshPro** and add the component UILocalization. |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | +2) Set localization’s key or write to the Key field |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | +If the entered key does not exist you will get an **error**. Check that the key in the localization! |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | +New version include ability to **localize multikey**. This is very useful when you using tags. |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | +You need enter the keys for each **id** {0...N} |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | +#### Change the location in the code |
| 155 | + |
| 156 | + LocalizationService is singleton, for call this use |
| 157 | + |
| 158 | +> LocalizationService.Instance |
| 159 | +
|
| 160 | + |
| 161 | +- When it is first started, it get and set system language by [Application.systemLanguage](https://docs.unity3d.com/ScriptReference/Application-systemLanguage.html). You can change logic of first initialize localization value in **LocalizationService.GetLocalization().** |
| 162 | + |
| 163 | + |
| 164 | + |
| 165 | +for example, you can use this enum for languages values in your project |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | + enum SystemLanguage |
| 170 | + |
| 171 | + LocalizationService.Instance.Localization = SystemLanguage.English.ToString(); |
| 172 | + |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | +Get the key in the code |
| 177 | + |
| 178 | + |
| 179 | + |
| 180 | + // for current set localization |
| 181 | + LocalizationService.Instance.GetTextByKey("localization1"); |
| 182 | + |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | +or |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | + "localization1".Translate(); |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | + |
| 195 | + 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()**. |
| 196 | + |
| 197 | + // key="line" value = "first line \n secondline" |
| 198 | + UIText.text = "line".Translate().ParceNewLine(); |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | +## Help Tools: |
| 203 | + |
| 204 | +### Analytic Keys (in development) |
| 205 | + |
| 206 | +Path to open **Window / Localization / Analytic keys** |
| 207 | +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) |
| 208 | + |
| 209 | +Press **"Find Use"** |
| 210 | + |
| 211 | + |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | +1. Update Analysis |
| 217 | + |
| 218 | +2. Search prefabs and scenes |
| 219 | + |
| 220 | +3. Places where there are errors when using |
| 221 | + |
| 222 | +  |
| 223 | + |
| 224 | + |
| 225 | +>**Errors Types:** |
| 226 | +>*EmptyKey* - key not set |
| 227 | +>*KeyNotFound* - key not found |
| 228 | +*TextComponent_NotFound *- no supported component on GameObject - **MeshText / UIText / TextMeshPro** |
| 229 | +> |
| 230 | + |
| 231 | + |
| 232 | + |
| 233 | +4. List of keys that are not used |
| 234 | + |
| 235 | +>! Does not check usage in the code of the project like LocalizationService.Instance.GetTextByKey("localization1") |
| 236 | +
|
| 237 | + |
0 commit comments