无编辑摘要 |
无编辑摘要 |
||
第61行: | 第61行: | ||
有许多特殊符号可以在文本中改变字符串在游戏里的外观。 | 有许多特殊符号可以在文本中改变字符串在游戏里的外观。 | ||
下列格式符号可以生效: | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
! Code !! Effect | !Code!!Effect | ||
|- | |- | ||
|§% || | |§%|| 把后面的值转换成百分数 | ||
|- | |- | ||
|§<nowiki>*</nowiki>|| | |§<nowiki>*</nowiki>|| 把后面的值转换成国际单位制 | ||
|- | |- | ||
|§= || | |§=|| 如果后面的值为正,则添加+ 号;如果为负,添加- 号 | ||
|- | |- | ||
|§0..9 || | |§0..9|| 控制小数点后显示的位数 | ||
|- | |- | ||
| | |§W|| 使文本变为白色 | ||
|- | |- | ||
| | |§G|| 使文本变为绿色 | ||
|- | |- | ||
| | |§R|| 使文本变为红色 | ||
|- | |- | ||
| | |§B|| 使文本变为白色 | ||
|- | |- | ||
| | |§Y|| 使文本变为黄色 | ||
|- | |- | ||
| | |§b|| 使文本变为黑色 | ||
|- | |- | ||
| | |§C|| 使文本变为浅蓝色(青色) | ||
|- | |- | ||
| | |§g|| 使文本变为灰色 | ||
|- | |- | ||
| | |§T|| 使文本变为蓝绿色 | ||
|- | |- | ||
| | |§l|| 使文本变为淡绿色 | ||
|- | |- | ||
| | |§H|| 使文本变为黄色(与 §Y 作用相同) | ||
|- | |- | ||
| | |§O|| 使文本变为橙色 | ||
|- | |- | ||
|§+ || | |§+|| 如果后面的值为正,则使数值变为绿色;若为0,变为黄色;若为负,变为红色 | ||
|- | |- | ||
|§- || | |§-|| 如果后面的值为正,则使数值变为红色;若为0,变为黄色;若为负,变为绿色 | ||
|- | |- | ||
| | |§!|| 结束目前的格式规则 | ||
|} | |} | ||
这是一个颜色格式的例子: | |||
<pre> | <pre> | ||
l_english: | l_english: | ||
第111行: | 第111行: | ||
</pre> | </pre> | ||
=== | === 格式化变量=== | ||
当对变量而不是普通的字符串进行格式化时,格式符号应加在| 符号后面,例如: | |||
<pre> | <pre> | ||
[?party_popularity@democracy|%G0] | [?party_popularity@democracy|%G0] | ||
</pre> | </pre> | ||
这样的本地化语句的效果是:它显示当前作用域的民主主义支持度,格式为百分数(% ),绿色(G),四舍五入到个位(0,即小数点后0位)。 | |||
== | == 文本图标== | ||
Icons can be displayed within strings using the '''£''' notation. | Icons can be displayed within strings using the '''£''' notation. | ||
第129行: | 第129行: | ||
Text icons are defined in the ''texticons.gfx'' file by default, although new ones can be added in any ''.gfx'' file. | Text icons are defined in the ''texticons.gfx'' file by default, although new ones can be added in any ''.gfx'' file. | ||
== Overwriting Strings == | ==Overwriting Strings== | ||
Sometimes you don't want to create new localisations, but rather overwrite the original ones in the base game. Creating a file in the localisation folder may not result in every string being overwritten, so instead you must create a subfolder in the localisation folder named "replace" (It MUST to be named replace, no other subfolders will be recognized). Inside this subfolder you can put the file with the strings you wish to rewrite. (E.G, if you want to rename the parties of a country, you would create a file named new_parties.yml and place it inside of the replace folder which is inside of the localisation folder) | Sometimes you don't want to create new localisations, but rather overwrite the original ones in the base game. Creating a file in the localisation folder may not result in every string being overwritten, so instead you must create a subfolder in the localisation folder named "replace" (It MUST to be named replace, no other subfolders will be recognized). Inside this subfolder you can put the file with the strings you wish to rewrite. (E.G, if you want to rename the parties of a country, you would create a file named new_parties.yml and place it inside of the replace folder which is inside of the localisation folder) | ||
== Namespaces == | ==Namespaces== | ||
In specific contexts, such as events, it is possible to use namespace localization. This operates using the scopes with special functions in an object-oriented manner. | In specific contexts, such as events, it is possible to use namespace localization. This operates using the scopes with special functions in an object-oriented manner. | ||
第167行: | 第167行: | ||
Possible Scopes are: | Possible Scopes are: | ||
*Owner | *Owner | ||
*Capital | *Capital | ||
第173行: | 第174行: | ||
*Prev | *Prev | ||
=== Functions === | ===Functions=== | ||
* GetName | |||
* GetNameDef | *GetName | ||
* GetAdjective | *GetNameDef | ||
* GetAdjectiveCap | *GetAdjective | ||
* GetLeader | *GetAdjectiveCap | ||
* GetRulingParty | *GetLeader | ||
* GetRulingIdeology | *GetRulingParty | ||
* GetRulingIdeologyNoun | *GetRulingIdeology | ||
* GetPartySupport | *GetRulingIdeologyNoun | ||
* GetLastElection | *GetPartySupport | ||
* GetManpower | *GetLastElection | ||
* GetFactionName | *GetManpower | ||
* GetFlag | *GetFactionName | ||
* GetNameWithFlag | *GetFlag | ||
* GetCommunistParty | *GetNameWithFlag | ||
* GetDemocraticParty | *GetCommunistParty | ||
* GetFascistParty | *GetDemocraticParty | ||
* GetNeutralParty | *GetFascistParty | ||
* GetDateText | *GetNeutralParty | ||
* GetDateString | *GetDateText | ||
* GetDateStringShortMonth | *GetDateString | ||
* GetDateStringNoHour | *GetDateStringShortMonth | ||
* GetDateStringNoHourLong | *GetDateStringNoHour | ||
* GetYear | *GetDateStringNoHourLong | ||
* GetHerselfHimself | *GetYear | ||
* GetHerHis | *GetHerselfHimself | ||
* GetSheHe | *GetHerHis | ||
* GetSheHeCap | *GetSheHe | ||
* GetRank | *GetSheHeCap | ||
* GetManchuriaPuppet | *GetRank | ||
* GetID | *GetManchuriaPuppet | ||
* GetTag | *GetID | ||
*GetTag | |||
{{Modding navbox}} | {{Modding navbox}} | ||
[[Category:Modding]] | [[Category:Modding]] |
2020年8月17日 (一) 23:56的版本
钢铁雄心4使用修改过的其他许多P社游戏使用的YAML本地化(localization)系统。
基础
基本的格式如下:
l_<language>: <key>: "Text here"
空格可以省略。
一般来说你都会想使用l_english。key指的是你要本地化的事物的脚本名称。
进阶的格式如下所示:
l_<language>: <key>:<number> "Text here"
这里是一个装备的本地化文件的实例:
l_english: infantry_equipment: "Infantry Equipment" infantry_equipment_short: "Inf. Eq." infantry_equipment_desc: "This is infantry equipment"
增加本地化语句时语法要准确,否则解析器会break而你得到的会是残缺的本地化。
.yml格式的文件是一种简单的文本文件,想要保存这种文件只需要选择保存为任意格式,然后输入.yml 后缀
确保.yml文件使用UTF-8-BOM编码。使用Notepad++或是其他类似的项目可以很简单地查看和修改这一项。
特殊字符
引号
如果使用方式不正确,文本中的引号可能会导致文件的错误中断。
l_english: example_key: "This is "my quote" within a string."
这个例子不能正确读取,因为解析器会把第二个引号认为是字符串的结尾。
为了避免这种事情发生,引号需要与\符号配合使用。
l_english: example_key: "This is \"my quote\" within a string."
在游戏中,\符号并不会显示。
新的行
你可能想要在显示的时候强制换行。想要做到这一点,在想要换行的地方使用\n即可。
l_english: example_key: "This is line 1\nThis is line 2\nThis line 3."
格式符号
有许多特殊符号可以在文本中改变字符串在游戏里的外观。
下列格式符号可以生效:
Code | Effect |
---|---|
§% | 把后面的值转换成百分数 |
§* | 把后面的值转换成国际单位制 |
§= | 如果后面的值为正,则添加+号;如果为负,添加-号 |
§0..9 | 控制小数点后显示的位数 |
§W | 使文本变为白色 |
§G | 使文本变为绿色 |
§R | 使文本变为红色 |
§B | 使文本变为白色 |
§Y | 使文本变为黄色 |
§b | 使文本变为黑色 |
§C | 使文本变为浅蓝色(青色) |
§g | 使文本变为灰色 |
§T | 使文本变为蓝绿色 |
§l | 使文本变为淡绿色 |
§H | 使文本变为黄色(与§Y作用相同) |
§O | 使文本变为橙色 |
§+ | 如果后面的值为正,则使数值变为绿色;若为0,变为黄色;若为负,变为红色 |
§- | 如果后面的值为正,则使数值变为红色;若为0,变为黄色;若为负,变为绿色 |
§! | 结束目前的格式规则 |
这是一个颜色格式的例子:
l_english: example_key: "This is my text, §Bthis text is blue§!, and §Rthis text is red§!"
格式化变量
当对变量而不是普通的字符串进行格式化时,格式符号应加在|符号后面,例如:
[?party_popularity@democracy|%G0]
这样的本地化语句的效果是:它显示当前作用域的民主主义支持度,格式为百分数(%),绿色(G),四舍五入到个位(0,即小数点后0位)。
文本图标
Icons can be displayed within strings using the £ notation.
l_english: example_key: "£army_experience"
Text icons are defined in the texticons.gfx file by default, although new ones can be added in any .gfx file.
Overwriting Strings
Sometimes you don't want to create new localisations, but rather overwrite the original ones in the base game. Creating a file in the localisation folder may not result in every string being overwritten, so instead you must create a subfolder in the localisation folder named "replace" (It MUST to be named replace, no other subfolders will be recognized). Inside this subfolder you can put the file with the strings you wish to rewrite. (E.G, if you want to rename the parties of a country, you would create a file named new_parties.yml and place it inside of the replace folder which is inside of the localisation folder)
Namespaces
In specific contexts, such as events, it is possible to use namespace localization. This operates using the scopes with special functions in an object-oriented manner.
l_english: example_key: "[Root.GetName]"
This would grab the name of the ROOT scope and display it as the string.
It is possible to string scopes together:
l_english: example_key: "[From.Owner.GetName]"
This would grab the name of the OWNER (country) scope of the FROM (province) scope for the current ROOT (country) scope, and display it as the string.
Another example would be getting the capital:
l_english: example_key: "[Root.Capital.GetName]"
You can use country tags:
l_english: example_key: "[HUN.GetRulingParty]"
You can use event targets:
l_english: example_key: "[was_attacked.GetName]"
Possible Scopes are:
- Owner
- Capital
- Root
- From
- Prev
Functions
- GetName
- GetNameDef
- GetAdjective
- GetAdjectiveCap
- GetLeader
- GetRulingParty
- GetRulingIdeology
- GetRulingIdeologyNoun
- GetPartySupport
- GetLastElection
- GetManpower
- GetFactionName
- GetFlag
- GetNameWithFlag
- GetCommunistParty
- GetDemocraticParty
- GetFascistParty
- GetNeutralParty
- GetDateText
- GetDateString
- GetDateStringShortMonth
- GetDateStringNoHour
- GetDateStringNoHourLong
- GetYear
- GetHerselfHimself
- GetHerHis
- GetSheHe
- GetSheHeCap
- GetRank
- GetManchuriaPuppet
- GetID
- GetTag
文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
地图 | 地图 • 省份 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |