群星
ParaWikis
最新百科
都市天际线2百科
英雄无敌3百科
维多利亚3百科
奇妙探险队2百科
罪恶帝国百科
英白拉多:罗马百科
热门百科
群星百科
欧陆风云4百科
十字军之王2百科
十字军之王3百科
钢铁雄心4百科
维多利亚2百科
ParaWikis
申请建站
ParaWikis
ParaCommons
最近更改
随机页面
加入QQ群
工具
链入页面
相关更改
特殊页面
页面信息
页面值
阅读
编辑
编辑源代码
查看历史
讨论
编辑“
模组本地化
”
Drpepper023
(
讨论
|
贡献
)
2022年6月5日 (日) 23:11的版本
(翻译)
(
差异
)
←上一版本
|
最后版本
(
差异
) |
下一版本→
(
差异
)
警告:您正在编辑的是本页面的旧版本。
如果您发布该更改,该版本后的所有更改都会丢失。
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
{{Version|3.1}} 本地化是指在游戏内窗口实际呈现给玩家的文本,如事件、菜单、武器、故事等。本地化文件以.yml的格式保存在localisation/folder路径底下,且以[[wikipedia:UTF-8-BOM|UTF-8-BOM]]的格式编码。[[wikipedia:.yml|.yml]]文件的命名惯例是<文件名>_l_<语言名>.yml,其中<文件名>为这组本地化的名字,而<语言名>为本地化的目标语言。目前支持的语言有葡萄牙语(braz_por),英语(english),法语(french),德语(german),波兰语(polish),俄语(russian),西班牙语(spanish),以及简体中文(simp_chinese)。 实用指令: reload text – 重新加载本地化目录。 switchlanguage l_english – 切换语言并重新加载本地化目录。 === 创建本地化文件 === * 在模组的根文件夹(注意不在common里)创建一个名为“localisation”的文件夹。注意,在某些别的paradox游戏里用的可能是美式拼写、带有z的“localization”。 * (可选)在“localisation”文件夹中创建对应语言的子文件夹。这有助于管理,但不是必需的。 * 群星的本地化文件是用UTF-8-BOM编码的。UTF-8-BOM是'''唯一可用'''的编码方式,就算用UTF-8编码也会导致群星无法解析从而不能使用。 * 正确编码的最简单做法是复制一个现成的群星.yml文件,再直接对其进行编辑。 * 作为替代,你也可以创建一个标准的空白文本文档,再以UTF-8-BOM编码保存它。类似[[wikipedia:Notepad++|Notepad++]]和[[wikipedia:Visual Studio Code|Visual Studio Code]]这样的文本编辑器能让你手动将文件保存为UTF-8-BOM编码格式。 * 文件名必须以''“_l_<语言名>”''结尾,否则无法被读取。 * 任何本地化文件的第一行都必须是<code>l_<language>:</code>,否则无法被读取。 * 范例文件名:<code>mod_buildings_l_english.yml</code> 将YML文件命名为与一个原版YML文件相同会导致原版被覆盖。这么做并不推荐, 除非你打算改写文件内(几乎)所有的条目。本地化条目可以通过保存到“Replace”文件夹以单独被覆盖,详见[[#Overwriting Vanilla Text|overwrite section]]. 遗憾的是,游戏并没有适配模组的语言回滚功能。这意味着当本地化键值缺失时,键值会直接以文本形式呈现。因此,对应的做法是先直接把英语文件复制到其他所有语言里(改成合适的标题)。 === 文件编码 === * 使用一个文本编辑器打开YML文件。推荐使用类似[https://www.notepad-plus-plus.org/ Notepad++]和[https://code.visualstudio.com/ Visual Studio Code] 这样的编辑器,如果上述软件不可用的话,普通的记事本也行。 * 将文件转码成UTF-8-BOM的格式。 * 使用Notepad++时,前往菜单栏,打开''编码'' 界面。 * 使用Visual Studio Code时,前往右下角并点击编码(默认为<code>UTF-8</code>),再点击保存编码。作为替代,也可以通过改变设置来让VSC默认以''UTF-8-BOM'' 格式生成YML文件。 * 使用记事本时,前往''另存为...'',改变编码并保存文件。 ** 如果列出来的选项中同时有UTF-8 和UTF-8 with BOM(或相似的名称),选用UTF-8-BOM。 ** 如果列出来的选项中同时有UTF-8 和UTF-8 without BOM(或相似的名称),选用UTF-8。【译注:即一定要带BOM】 === 本地化键值 === l_<语言名>: localisation_key_1: "文本1" localisation_key_2: "文本2" 每个单独的本地化条目被称为“键值”,位于冒号的左侧,是指向本地化文本的实际代码。而游戏内显示的文本则位于冒号的右侧,包夹在双引号("")里。冒号是分隔符。 * 原版文件中紧接在冒号后面的数字可以被忽略,那是Paradox内部用于跟踪翻译用的。<ref>https://twitter.com/Martin_Anward/status/1039175213773144066</ref> * 在出现任何本地化键值之前,文件必须先包含<code>l_english:</code> (或其他语言的相等形式)。 *<code>l_english:</code>(或相等)之后的所有条目必须以空格开始(空格或tab都行)。 * 所有要在游戏内显示的文本都被双引号所包裹。想在游戏内显示双引号的话,请在双引号前面加上反斜杠(例如:<code>text \"name\"</code>)。 * 注意后面这些unicode字符在本地化文件中是不可用的,会生成一个“?”:<code>„ “ ‚ ‘ – ” ’ … —</code> == 覆盖原版文本 == 想要覆盖原版本地化键值(或其他模组的键值)时,在你的“localisation”文件夹底下创建一个名为“replace”的文件夹。该文件夹中的本地化文件的读取比其他所有本地化文件都晚,能覆盖掉任何重复的键值。这样做可以避免覆盖所有本地化文件,每个键值条目会单独被最后加载的文件所覆盖。不通过“replace”文件夹来覆盖本地化是可行的,但并不可靠。 == Bracket Commands == Bracket commands (scoped localization statements) are enclosed in square brackets (<code>[ ]</code>), start with a primary scope, end with a text retrieval, and can have one or more secondary scopes in between. The fields are separated by periods (.). Text retrievals can be predefined (as per examples below), can mention [[Variables]] defined in the scope, or can be a scripted_loc (see common/scripted_loc/ files for examples). When writing "''scripted_loc''" entries, it’s important to note that these entries cannot themselves use bracket commands (i.e., a scripted_loc that includes <code>[Root.GetName]</code> will literally print <code>[Root.GetName]</code>). Note: if you want to use loc commands e.g. <code>log = [This.GetName]</code> in a [[scripted effect]] or [[scripted trigger|trigger]], you have to write it <code>\\[This.GetName]</code> or it will bug out (at the latest the second time you use one in the effect). In most cases, it is also possible to get the value of variables with <code>'[Scope.my_variable]'</code> and saved dates with <code>'[Scope.my_date_flag]'</code>.<sup>([[patch 3.1|''since 3.1'']])</sup> Two consecutive opening square brackets <code>'[['</code> will escape it, making a single square bracket show up in text instead, i.e. <code>'[[example]'</code> in loc will display as '[example]' in-game. There are also several unscoped commands: <code>GetDate, GetMidGameDate, GetLateGameDate, GetYear, LastKilledCountryName</code>. Following list is only a part of hardcoded scoped localization commands (it also does not include any scripted locs). A more complete list of commands can be found at <code>Stellaris\logs\script_documentation\localizations.log</code>. ==== Primary Scopes ==== {| class="wikitable" |- ! Command !! Example usage !! Comments |- | Root || [Root.GetName] || The event’s root scope |- | This || [This.GetName] || The current scope |- | From || [From.From.GetName] || The calling event’s root scope. For events further back in the call stack, From can also be used as a secondary scope |- | Prev || [Prev.From.GetName] || The previous scope. It is not obvious to me what Prev.From points to, but some project descriptions use it |- | <event target tag> || [mytarget.GetName] || [[Event target]] tags are used without preceding them with <code>event_target:</code> in localisation |- ! colspan=3 style="font-size:small"| Diplomatic Promotions |- | Actor || [Actor.GetAllianceName] || Used in diplomatic response messages. The faction initiating an action |- | Recipient || [Recipient.GetName] || Used in diplomatic response messages. The faction targeted by the action |- | Third_party || [Third_party.GetName] || Used in diplomatic response messages. A third party involved in the action |} ==== Secondary Scopes ==== {| class="wikitable" |- ! Command !! Example usage !! Comments |- ! colspan=3 style="font-size:small"| Country Promotions: Capital Ruler Heir Species Federation |- | Capital || [Root.Capital.GetName] || The capital of the current country or sector |- | Leader|| [Root.Leader.GetName] || The leader of the current scope (<small>fleet, country, federation, pop faction, first contact, espionage operation, spy network, sector</small>) |- ! colspan=3 style="font-size:small"| War Promotions |- | MainAttacker || [This.MainAttacker.GetAllianceName] || The main attacker of the current scope (must be used in a war scope), used in war name formats |- | MainDefender || [This.MainDefender.GetSpeciesName] || The main defender of the current scope (must be a war scope), used in war name formats |- ! colspan=3 style="font-size:small"| Planet Promotions: Owner System MoonOf Sector |- | Owner || [Root.Owner.GetName] || The current scope’s owner |- | System || [Root.System.GetName] || The system where the primary scope is located |- | Planet || [Root.Planet.GetName] || The planet where the current scope is located (<small>pop, army, archaeological site, deposit, megastructure</small>) |} === Text Retrieval === {| class="wikitable" |- ! Command !! Example usage !! Comments |- | GetAdj || [Root.GetAdj] || The adjective associated with the current scope |- | GetAdjective || [Root.GetAdjective] || The adjective associated with the current scope |- | GetAllianceName || [This.MainAttacker.GetAllianceName] || The name of the alliance the current scope belongs to |- | GetControllerName|| [Root.GetControllerName] || Name of the current controller (known to work on planets) |- | GetClassName || [Root.GetClassName] || Name of the current planet class |- | GetFleetName || [Root.GetFleetName] || The name of the fleet associated with the current scope |- | GetHeirName || [Root.GetHeirName] || The name of the current heir |- | GetHeirTitle || [Root.GetHeirTitle] || The title of the current heir |- | GetHomeWorldName || [Root.GetHomeWorldName] || The name of the home world of the current scope |- | GetLeaderName || [Root.GetLeaderName] || The name of the leader associated with the current scope |- | GetName || [Root.GetName] || The name associated with the current scope |- | GetFirstName || [Root.GetFirstName] || The name first associated with the current scoped leader |- | GetSecondName || [Root.GetSecondName] || The second name associated with the current scoped leader |- | GetAge || [Root.GetAge] || The age of the scoped leader |- | GetNamePlural || [Root.GetNamePlural] || The plural name associated with the current scope (must be a species) |- | GetNebula || [Root.GetNebula] || (unknown) |- | GetOwnerName || [Root.GetOwnerName] || Name of the current owner |- | GetPersonalityName || [Root.GetPersonalityName] || Get the name of the current AI personality |- | GetPlanetMoon || [Root.GetPlanetMoon] || "planet" or "moon" depending on whether the current scope is a planet or moon |- | GetPlanetMoonCap || [Root.GetPlanetMoonCap] || "Planet" or "Moon" depending on whether the current scope is a planet or moon |- | GetPopFactionName || [Root.GetPopFactionName] || The name of the currently scoped pop’s faction |- | GetRandomSpeciesSound || [Root.GetRandomSpeciesSound] || A sound chosen randomly from a list of sounds associated with current scope’s species |- | GetRegnalName || [Root.GetRegnalName] || The regnal name of the current scope |- | GetRulerName || [Root.GetRulerName] || The name of the ruler associated with the current scope |- | GetRulerTitle || [Root.GetRulerTitle] || The title of the ruler associated with the current scope |- | GetSpeciesAdj || [Root.GetSpeciesAdj] || The adjective for the species of the current scope |- | GetSpeciesClass || [Root.GetSpeciesClass] || The class to which the species of the current scope belongs |- | GetSpeciesClassPlural || [Root.GetSpeciesClassPlural] || The plural of the current scope’s species’ clas |- | GetSpeciesMouthName || [Root.GetSpeciesMouthName] || The word for the current scope’s species’ mouth |- | GetSpeciesName || [Root.GetSpeciesName] || The name of the current scope’s species |- | GetSpeciesNameCompliment || [From.GetSpeciesNameCompliment] || A compliment using the current scope’s species |- | GetSpeciesNameInsult || [From.From.GetSpeciesNameInsult] || An insult using the current scope’s species |- | GetSpeciesNamePlural || [This.GetSpeciesNamePlural] || The plural of current scope’s species’ name |- | GetSpeciesNamePluralCompliment || [Root.SpeciesNamePluralCompliment] || A compliment using the plural of the current scope’s species’ name |- | GetSpeciesNamePluralInsult || [From.SpeciesNamePluralInsult] || An insult using the plural of the current scope’s species’ name |- | GetSpeciesHandName || [From.GetSpeciesHandName] || The word for the current scope’s species’ hand |- | GetSpeciesMouthName || [From.GetSpeciesMouthName] || The word for the current scope’s species’ mouth |- | GetSpeciesOrganName || [From.GetSpeciesOrganName] || The word for the current scope’s species’ internal organ |- | GetSpeciesSpawnName || [Root.GetSpeciesSpawnName || The word for the children of the current scope’s species |- | GetSpeciesSpawnNamePlural || [Root.GetSpeciesSpawnNamePlural || The plural word for the children of the current scope’s species |- | GetStarName || [Root.Capital.GetStarName] || The name of the star where the current scope is located |- | GetHerHim || [admiral.GetHerHim] || Prints 'her' or 'him' based on the character’s gender. |- | GetSheHe || [abducted_leader.GetSheHe] || Prints 'she' or 'he' based on the character’s gender. |- | GetSheHeCap || [abducted_leader.GetSheHeCap] || Prints 'She' or 'He' based on the character’s gender. |- | GetHomeWorldName || [Root.GetHomeWorldName] || The home world name of the selected country |- | GetHerHis || [admiral.GetHerHis] || Prints 'her' or 'his’ based on the character’s gender. |- | GetHerHisCap || [admiral.GetHerHisCap] || Prints 'Her' or 'His’ based on the character’s gender. |- | LastKilledCountryName || [LastKilledCountryName] || Prints the name of the last killed country. |} ; Added localization commands with [[Patch 3.1]]. GetSpeciesFossilName GetSpeciesFossilNamePlural GetSpeciesRemnantName GetSpeciesRemnantNamePlural Species GetFossilName GetFossilNamePlural GetRemnantName GetRemnantNamePlural == Color Codes == [[File:Color codes in-game.png|thumb|Color codes in-game]] Color codes start with <code>§</code> (Windows users Keypad shortcut: ALT+0167), which is followed by a single character specifying the color to be used until another color code is detected, or the end of the string: <code>§!</code>. Within a '''<code>$</code>''' command, the color for a displayed variable (not string definition, s. below ''[[#$ Codes|$ Codes]]'') may also be specified by preceding the closing '''<code>$</code>''' with '''<code>{{!}}</code>''' and the color code character: <code>$AGE|Y$</code> It is also possible to change the text color in game by adding a DC1 UTF-8 character to a color code letter. Please note that doing so may unintentionally color subsequent text if the color is not changed to default at the end. <code>§RR§Sa§Hi§Yn§Gb§Bo§Mw§!</code> <!-- Editor's note: You cannot get dc1 that easily, can't use   just to preview it --> will be displayed as:<span style="color:#D2483B">R</span><span style="color:#B07921">a</span><span style="color:#D69123">i</span><span style="color:#D2D62C">n</span><span style="color:#23BF20">b</span><span style="color:#2B8ED9">o</span><span style="color:#8B2DCB">w</span> {| class="wikitable sortable" ! Code !! Color !! Vanilla Use |- | W || <b style="color:#DCDCDC">White</b> || Diplomatic Attitudes |- | T || <b style="color:#D9D9D9">Light grey</b> || Standard color of all text |- | L || <b style="color:#9E8F75">Brown</b> || Lore, back story, role playing elements |- | P || <b style="color:#BF5E5E">Light red</b> || Highlighting of Aggressive text in descriptions and event text |- | R || <b style="color:#D2483B">Red</b> || Negative modifiers |- | S || <b style="color:#B07921">Dark orange</b> || Subtle highlighted text |- | H || <b style="color:#D69123">Orange</b> || Highlighted text |- | Y || <b style="color:#D2D62C">Yellow</b> || Sub-optimal or Neutral modifiers |- | G || <b style="color:#23BF20">Green</b> || Positive modifiers |- | E || <b style="color:#73D9B0">Teal</b> || Large chunks of text |- | B || <b style="color:#2B8ED9">Blue</b> || Event effects that affect pops |- | M || <b style="color:#8B2DCB">Purple</b> || Rare technologies |- | ! || Default || Return to color before last color change |} == $ Codes == '''$''' is used to delimit strings (or variables) defined elsewhere to be expanded in the current string, or system statistics in GUI elements. == Number Formatting == The | character can also be used to format numbers. <code>$VALUE|*x$</code> will format <code>VALUE</code> to <code>x</code> decimal places. <pre> # EXAMPLE = 100 "$EXAMPLE|*0$" # 100 "$EXAMPLE|*1$" # 100.0 </pre> == £ Codes == £ codes are used for the names of various system stats, including energy, minerals, influence, and the three research categories (engineering, physics and society.) More exist than those listed here, such as <code>£ship_stats_hitpoints\armor\shield£</code>, <code>£fleet_template_size£</code>, and <code>£trigger_yes\no£</code> among others. Search the '£' character using something like Notepad++'s Find in Files feature to find something specific. Remember that £ codes must surround the tag you're inserting, i.e. <code>'''£'''energy'''£'''</code>. (Windows users without the pound symbol on their keyboards can use <code>Alt + 0163</code>.) It also supports the multiple frames (if the source sprite has them), i.e.: <code>£leader_skill|3£</code> will render an icon of chosen skill level. {| class="wikitable sortable" |- ! Code !! Picture |- | £energy£ || [[File:Energy Credits.png|40px]] |- | £minerals£ || [[File:Minerals.png|40px]] |- | £food£ || [[File:Food.png|40px]] |- | £influence£ || [[File:Influence.png|40px]] |- | £stability£ || [[File:Stability.png|40px]] |- | £unity£ || [[File:Unity.png|40px]] |- | £alloys£ || [[File:Alloys.png|40px]] |- | £trade_value£ || [[File:Trade value.png|40px]] |- | £physics£ || [[File:Physics Research.png|40px]] |- | £society£ || [[File:Society Research.png|40px]] |- | £engineering£ || [[File:Engineering Research.png|40px]] |- | £pops£ || [[File:Pop.png|40px]] |- | £happiness£ || [[File:Happiness.png|40px]] |- | £opinion£ || [[File:Opinion.png|40px]] |- | £empire£ || [[File:Empire Modifier.png|40px]] |- | £military_ship£ || [[File:Military Ship (icon).png|40px]] |- | £military_power£ || [[File:offensive_value.png|40px]] |- | £blocker£ || [[File:Tile Blocker.png|40px]] |- | £time£ || [[File:Time.png|40px]] |- | £planetsize£ || [[File:Planet Size.png|40px]] |} == £ Custom Icons == You can create custom text icons to appear in game exactly like those above, by saving an icon in ''<root>/gfx/interface/icons/text_icons''. Standard text icons are 16x16 pixel .dds files. In order to reference your icon in text, you will need to define it in the same way you define [[event pictures]]. Save a text file as .gfx in ''<root>/interface/'' Define any custom modifiers as shown below: <pre> spriteTypes = { spriteType = { name = "GFX_text_worker_produces_mult" texturefile = "gfx/interface/icons/text_icons/mod_planet_jobs_worker_produces_mult.dds" }</pre> You can link multiple icons by making separate <code>spriteType =</code> blocks. All of these should be within one larger <code>spriteTypes =</code> (with an s) block. The name must be prefixed <code>GFX_text_</code>. However, to reference this custom icon in localisation, use <code>£worker_produces_mult£</code> (without the prefix) and it will appear alongside in game text. == Slash-Based Codes == The two slash-based codes available are <code>\n</code> and <code>\t</code>.<br> <code>\n</code> is the equivalent of pressing the Enter key and starting a new line, unless it is inside one of the above codes.<br> <code>\t</code> places a tab.<br><br> Backslashes can also be used to treat special characters as text characters, for example <code>\"</code> will make the string contain a quotation mark, instead of closing it off. == Style Guide == Vanilla events, modifiers and all other type of localization follows punctuation and capitalization guidelines. The following table highlights some of the rules employed in the vanilla English localization, allowing custom content to blend in more seamlessly. The table is by no means comprehensive, but instead should serve as a quick cheat-sheet for the most common type of strings. The number given for Character Limit is not a hard limit. Depending on the location, exceeding the limit might cause the text to be cut off, completely break the UI, or just look ugly and out of place. {| class="wikitable" |- ! Location !! Capitalization !! Punctuation !! Character Limit !! Example |- | Event Names || Title Case || None || 50 || "Exotic Woodwind" |- | Event Descriptions || Sentence case || Standard || 2000 || "Music has taken many forms among the beings we have encountered since leaving [Root.GetHomeWorldName], and the methods and preferences continue to baffle us. Sometimes alien […] Whatever this instrument is, it’s unlike any of our own." |- | Event Options || Sentence case || Terminal punctuation || 70 || "An excellent time to learn more about their culture.", "Let us be careful and study this instrument.", "The colony is part of our future. It stays." |- | Names for Traits/Modifiers/Buildings/Ethics/etc. || Title Case || None || 30 || "Building Cost", "Massive Crater", "Very Strong" |- | Description for Traits/Modifiers/Buildings/Ethics/etc. || Sentence case || Standard || 200 || "The impact site of the meteorite which brought Lithoids to this planet.", "Members of this species possess a strength that almost defies the laws of physics." |- | UI Buttons || Sentence case / Title Case || None || Depends on UI || "Withdraw" |- | UI Alerts || Title Case || None || Depends on UI || "Relic Activation Available" |} == References == <references /> {{ModdingNavbox}} [[Category:模组制作]]
摘要:
请注意您对群星百科的所有贡献都被认为是在知识共享署名-非商业性使用-相同方式共享下发布,请查看在
群星百科:版权
的细节。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源。
未经许可,请勿提交受版权保护的作品!
为防止机器编辑,请完成下方验证
取消
编辑帮助
(在新窗口中打开)
本页使用的模板:
Template:Clear
(
编辑
)
Template:ModdingNavbox
(
编辑
)
Template:Navbox
(
编辑
)
Template:Navboxgroup
(
编辑
)
Template:Version
(
编辑
)
×
登录
密码
记住登录
加入群星百科
忘记密码?
其他方式登录