• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

NiklasBorglund/Smart-Localization-2: A localization plugin for the Unity3D game ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

NiklasBorglund/Smart-Localization-2

开源软件地址(OpenSource Url):

https://github.com/NiklasBorglund/Smart-Localization-2

开源编程语言(OpenSource Language):

C# 99.2%

开源软件介绍(OpenSource Introduction):

Smart Localization 2 by Niklas Borglund & Jakob Hillerström

Localizing your game has never been this easy. Localize your game with only a few mouse clicks.

Just open the Smart Localization Window in Window->Smart Localization and start by pressing "Create new localization system". Edit the root language file by adding some keys and base values.

To add a new language to your project, choose a language in the "Add/Update Languages" panel and click "Create". To edit and translate a language, press the "Translate" button on the language you want to work with in the Created Languages panel.

There's an example scene in SmartLocalization->Examples called LoadAllLanguages, which draws all the available languages and values on the screen. The code for the example is also included and lies within the same folder.

Building the Smart Localization Unity Package

You can build the unitypackage with the built in tools in unity manually - or you can use the gulp jobs in the project. The gulp jobs will by default run all the unit tests and export the package into a folder called "dist"

First, make sure you have npm installed - https://nodejs.org/en/download/

Then, either with terminal or the windows command prompt, locate yourself to the location of your clone of this repository and run the following commands:

First, you need to install the node modules required.

npm install

Then you only have to write the following command everytime you want to export the package given that your Unity installation is at the default location.

npm run gulp

If it's not in the default location, you can set it yourself with the --unityPath parameter in the gulp job.

npm --unityPath=<YOUR_PATH> run gulp'

Code Examples

//Returns a text value in the current language for the key
string myKey = LanguageManager.Instance.GetTextValue("MYKEY");
//Gets the audio clip for the current language
AudioClip myClip = LanguageManager.Instance.GetAudioClip("MYKEY"); 
//Gets the prefab game object for the current language
GameObject myPrefab = LanguageManager.Instance.GetPrefab("MYKEY");
//Gets the texture for the current language
Texture myTexture = LanguageManager.Instance.GetTexture("MYKEY");
//(Pro feature)Gets a localized TextAsset
TextAsset myTextAsset = LanguageManager.Instance.GetTextAsset("MYKEY");
//To cache the LanguageManager in a variable
LanguageManager languageManager = LanguageManager.Instance;
//Get a list of all the available languages
List<SmartCultureInfo> availableLanguages = thisLanguageManager.GetSupportedLanguages();
Get the smart culture info of the system language if it is supported. otherwise it will return null
SmartCultureInfo systemLanguage = thisLanguageManager.GetSupportedSystemLanguage();
//Check if a language is supported with an ISO-639 language code (string = "en" "sv" "es" etc.)
LanguageManager.Instance.IsLanguageSupported("en");
//Check if a language is supported with an instance of SmartCultureInfo
SmartCultureInfo swedishCulture = new SmartCultureInfo("sv", "Swedish", "Svenska", false);
LanguageManager.Instance.IsLanguageSupported(swedishCulture);
//Change a language with an ISO-639 language code ("en" "sv" "es" etc., Make sure the language is supported)
LanguageManager.Instance.ChangeLanguage("en");
//Change the language with a SmartCultureInfo instance
SmartCultureInfo swedishCulture = new SmartCultureInfo("sv", "Swedish", "Svenska", false);
LanguageManager.Instance.ChangeLanguage(swedishCulture);
//How to register on the event that fires when a language changed
LanguageManager.Instance.OnChangeLanguage += OnLanguageChanged; //OnLanguageChanged = delegate method that you created
//Enable extensive debug logging
LanguageManager.Instance.VerboseLogging = true;
//Check if a localized key exists
LanguageManager.Instance.HasKey("myKey")



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap