Unity学习笔记-I2 localization

本文介绍了Unity3D的I2 Localization插件,用于实现游戏的多语言支持。内容包括插件的购买链接、语言管理器的使用、场景UI的配置、字体和样式的设定、脚本的添加以及API的简单应用,如设置和获取当前语言、在线翻译和CSV文件导入等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I2 localization简单介绍

I2 localization是一个Unity3D可用的本地化插件。
没有找到比较系统的介绍,一句话说,就是用来改语言的。

购买地址

https://assetstore.unity.com/packages/tools/localization/i2-localization-14884?aid=1101l4nxF
要$45,公司让学习一下,就简单学一下,我自己就不买了

简单使用介绍

语言管理器

添加组件之后会有这样的显示,language这里是设置对应的语言的,下面有一个小的搜索框,可以搜索其他语言,设置之后terms下面可以看到相应的变化。
在这里插入图片描述
Terms相当于词条,下面是预置好的一些词条,比如这个游戏登录的
在这里插入图片描述
可以直接在这里点加号进行添加,可以在一开始设置key的时候用/,比如上面的title就是hall/login/title,这样在后面找起来比较方便,就像拥有了一个目录的模式。
在这里插入图片描述

场景中的UI设置

内容

给场景中的UI添加一个Localize组件,这里的Target是对应UI的类型,Main选择对应的Term,就会看到之前设置好的词条。Open Source选择刚才设置了语言管理器的预置体拖进去。这里可以设置不同语言的内容。
在这里插入图片描述

字体

组件的secondary的term可以选择Font类型,定义了不同语言的字体,这个term也是可以添加在资源库里面的:
在这里插入图片描述

样式

I2 Localization doesn’t provide a way to adjust the size directly as that could make more confusing the inspector (that is already crowdy) by introducing another setting per-language.

I2 Localization不能直接修改不同语言对应的字体大小,但是可以通过下面的方式(富文本)来修改。
在这里插入图片描述

添加脚本

选择Tools下面的Script,点Build Script with。。。就可以在脚本里面看到生成了相应的代码。
在这里插入图片描述
在这里插入图片描述
【原谅我这个花花的马赛克,毕竟公司代码,不能随便泄露,还是要谨慎点好】
后面的估计还没写好,找不到了,算了,以后再说。。

相关API

http://www.inter-illusion.com/assets/I2LocalizationManual/CommonlyusedScriptAPIs.html

设置当前语言

// Change the Current Language
I2.Loc.LocalizationManager.CurrentLanguage = "English";
I2.Loc.LocalizationManager.CurrentLanguage = "English (Canada)";  //Language and Variant
I2.Loc.LocalizationManager.CurrentLanguage = "English Canada";    //another way of setting it

// or
I2.Loc.LocalizationManager.CurrentLanguageCode = "en";
I2.Loc.LocalizationManager.CurrentLanguageCode = "en-US";
I2.Loc.LocalizationManager.CurrentLanguageCode = "en-CA";

注意点

When setting a language without a variant (e.g. “English”), the plugin changes to the first “English” language in the language Source list (e.g. “English (Canad

这是目前Unity最完整的本地化系统。 支持 Unity UI,Unity 2D,TextMesh Pro,NGUI,2D ToolKit,SVG导入器,标准组件 本地化 图像,文本,声音,字体,精灵,地图集,预制件,TextMeshes,下拉列表等。 自动翻译 内置支持Google Translator,可自动将所有标签本地化为任何语言。 Google Spreadsheets和CSV文件 链接外部电子表格,即使在游戏发布后,也会自动下载任何更改。 检测并修复错误 解析场景以查找丢失或未使用的翻译以及重复或类似的术语。 子对象翻译 设置辅助术语不仅可以更改文本和图像,还可以更改每种语言使用的字体和地图集。 回调和参数 可以修改翻译以使用语法语法插入分数,名称和游戏变量。 复数 每种语言的内置规则涵盖那些只需要单数/复数形式的规则,直到那些使用6种变体的规则。 从右到左语言 正确呈现RTL语言,支持换行和对齐。 保存内存 仅使用您正在使用的字符创建字体。链接您的AssetBundles以添加更多本地化内容。 简单高效 在一个位置编辑和预览所有翻译,然后在运行时仅加载当前语言。使用快速查找来访问它。 重复使用翻译 设置文本自动显示为大写,小写,上限,标题大小等。 在游戏动态翻译 Easy API在运行时翻译聊天消息和其他动态文本 应用程序名称和商店本地化 翻译游戏名称所有语言,并在Android / IOS商店中显示您的游戏支持哪些语言 简单但功能强大的编辑器 直观的检查员允许您预览,编辑,分类,创建,解析和过滤甚至大型来源。 编译时间检查 将翻译转换为脚本常量,以避免在访问代码时使用Typos。 Playmaker 可以 快速,轻松,强大地访问本地元素和交换语言并与之交互的几种操作?没问题! 立即获取I2本地化,让您的游戏为世界做好准备!
This is currently the most complete localization system available for Unity. Supports Unity UI, Unity 2D, TextMesh Pro, NGUI, 2D ToolKit, SVG Importer, Standard Components Localizes Image, Text, Sounds, Fonts, Sprites, Atlases, Prefabs, TextMeshes, Dropdowns and more. Auto Translation Built-in support for Google Translator to automatically localize all your labels into any language. Google Spreadsheets and CSV files Link external Spreadsheets and any change will be automatically downloaded, even after the game is released. Detect and Fix Errors Parse scenes to find missing or unused translations as well as duplicated or similar terms. Sub-Object Translations Set Secondary terms to change not just text and images, but also which Fonts and Atlases are used per language. Callbacks and Parameters Translations can be modified to insert Scores, Names and Game Variables using the languages grammar. Plurals Built-in rules for each language covering those that just need singular/plural forms up to those that use 6 variants. Right to Left Languages Correct rendering of RTL languages with support for line wrapping and alignment. Save Memory Create Fonts with only the characters you are using. Link your AssetBundles to add more localized content. Easy and Efficient Edit and Preview all your translations in one location, then, at runtime only the current language is loaded. Using fast lookups to access it. Reuse Translations Set texts to be automatically shown as UPPER CASE, lower case, Upper first, Title Case, etc. In Game Dynamic Translations Easy API to translate chat messages and other dynamic texts at runtime App Name and Store Localization Translate the name of your game to all languages and show in the Android/IOS store which languages your game support Simple yet Powerful Editors Intuitive inspectors allow you Preview, Edit, Categorize, Create, Parse and Filter even large sources. Compile Time Checking Bake translations into script constants to avoid Typo
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值