1. 程式人生 > 其它 >潛淵症漢化教程(一般適用)

潛淵症漢化教程(一般適用)

簡介

潛淵症的mod社群還不是很完善,目前也只能用xml進行mod製作,同時由於讀取方式的特殊性,對xml的mod進行漢化也有著一定的方法。

下面我就以我自己的例子來說明如何漢化或廣泛一點,為mod提供多語言支援。

檔案引入

這裡我以Meaningful Upgrades Mod和我自己寫的Meaningful Upgrades CN Mod為例。

filelist.xml

開啟filelist.xml,你會看到以下內容:

<?xml version="1.0" encoding="utf-8"?> <contentpackage name="Meaningful Upgrades" path="Mods/Meaningful Upgrades/filelist.xml" corepackage="false" gameversion="0.15.13.0" steamworkshopid="2183524355" installtime="1636475772"> <UpgradeModules file="Mods/Meaningful Upgrades/UpgradeModules.xml" /> <UpgradeModules file="Mods/Meaningful Upgrades/CustomUpgradeModules.xml" /> <Text file="Mods/Meaningful Upgrades/EnglishMeaningfulUpgrades.xml" /> </contentpackage>

這段xml裡的<Text file="Mods/Meaningful Upgrades/EnglishMeaningfulUpgrades.xml" />就是引用語言檔案。

EnglishMeaningfulUpgrades.xml

開啟EnglishMeaningfulUpgrades.xml,你會看到以下內容:

<?xml version="1.0" encoding="utf-8"?>
<infotexts language="English" nowhitespace="false" translatedname="English">

<upgradecategory.dischargecoils>Discharge Coils</upgradecategory.dischargecoils>

<upgradecategory.searchlights>Searchlights</upgradecategory.searchlights>

<upgradecategory.cameras>Cameras</upgradecategory.cameras>

<upgradename.sonarmonitorincreaserange>High-gain Sonar Array</upgradename.sonarmonitorincreaserange>
<upgradedescription.sonarmonitorincreaserange>Increase the view range of sonar systems.</upgradedescription.sonarmonitorincreaserange>

<upgradename.sonarmonitormineralscanner>Mineral Scanner Installation</upgradename.sonarmonitormineralscanner>
<upgradedescription.sonarmonitormineralscanner>Retrofitted detection array to provide mining scanner functionality. (Does not affect navigation terminal)</upgradedescription.sonarmonitormineralscanner>

<upgradename.turretdecreasereloadtime>Improved Autoloader</upgradename.turretdecreasereloadtime>
<upgradedescription.turretdecreasereloadtime>Increase the firing speed of turrets.</upgradedescription.turretdecreasereloadtime>

<upgradename.dischargecoilincreaserange>Discharge-Coil Amplifier</upgradename.dischargecoilincreaserange>
<upgradedescription.dischargecoilincreaserange>Increase the range of discharge coils.</upgradedescription.dischargecoilincreaserange>

<upgradename.dischargecoildecreasepowerconsumption>Energy Efficiency</upgradename.dischargecoildecreasepowerconsumption>
<upgradedescription.dischargecoildecreasepowerconsumption>Reduce power consumption.</upgradedescription.dischargecoildecreasepowerconsumption>

<upgradename.decreasenoiseproduction>Noise Reduction Systems</upgradename.decreasenoiseproduction>
<upgradedescription.decreasenoiseproduction>Reduce detectable noise produced by this device.</upgradedescription.decreasenoiseproduction>

<upgradename.searchlightincreaseoffsetonselected>Enhanced Periscopes</upgradename.searchlightincreaseoffsetonselected>
<upgradedescription.searchlightincreaseoffsetonselected>Increase the view range of all searchlights.</upgradedescription.searchlightincreaseoffsetonselected>

<upgradename.searchlightincreaserotationlowskill>Quicker Searchlights</upgradename.searchlightincreaserotationlowskill>
<upgradedescription.searchlightincreaserotationlowskill>Increase the rotation rate of all Searchlights when operated by insufficiently skilled crew.</upgradedescription.searchlightincreaserotationlowskill>

<upgradename.cameraincreaseoffsetonselected>Enhanced Periscopes</upgradename.cameraincreaseoffsetonselected>
<upgradedescription.cameraincreaseoffsetonselected>Increase the view range of all cameras</upgradedescription.cameraincreaseoffsetonselected>

<upgradename.increasecomponenthealth>Equipment Hardening</upgradename.increasecomponenthealth>
<upgradedescription.increasecomponenthealth>Increase ship systems durability against combat damage.</upgradedescription.increasecomponenthealth>

</infotexts>

其中<infotexts language="English" nowhitespace="false" translatedname="English">部分定義了這是英文的翻譯檔案,而<upgradename.increasecomponenthealth></upgradename.increasecomponenthealth>標籤對中即是對increasecomponenthealth的對應英文翻譯。

漢化操作

現在我們執行新建操作,新建一個叫Meaningful Upgrades CN的資料夾,再在裡面新建filelist.xml和SimplifiedChinese.xml。

filelist.xml

複製Meaningful Upgrades的filelist.xml,對比原mod的<contentpackage></contentpackage>標籤,我刪除了steamworkshopid="2183524355" installtime="1636475772"部分,這是為了能夠在工坊釋出新mod。

<Text file="Mods/Meaningful Upgrades CN/SimplifiedChinese.xml" />這部分的引入則修改為了我們當前的漢化xml。

例子如下:

<?xml version="1.0" encoding="utf-8"?>

<contentpackage name="Meaningful Upgrades CN" path="Mods/Meaningful Upgrades CN/filelist.xml" corepackage="false" gameversion="0.15.13.0"">

<Text file="Mods/Meaningful Upgrades CN/SimplifiedChinese.xml" />

</contentpackage>

SimplifiedChinese.xml

複製EnglishMeaningfulUpgrades.xml的內容,並修改<infotexts language="English" nowhitespace="false" translatedname="English"><infotexts language="Simplified Chinese" nowhitespace="true" translatedname="中文(簡體)">,標註其為簡體中文漢化檔案。剩下的英文標籤對內則填寫對應的中文漢化名稱。
例子如下:

<?xml version="1.0" encoding="utf-8"?>

<infotexts language="Simplified Chinese" nowhitespace="true" translatedname="中文(簡體)">

<upgradecategory.dischargecoils>放電線圈</upgradecategory.dischargecoils>

<upgradecategory.searchlights>潛望鏡</upgradecategory.searchlights>

<upgradecategory.cameras>攝像機</upgradecategory.cameras>

<upgradename.sonarmonitorincreaserange>高增益聲納陣列</upgradename.sonarmonitorincreaserange>

<upgradedescription.sonarmonitorincreaserange>增加聲納系統的視野範圍。</upgradedescription.sonarmonitorincreaserange>

<upgradename.sonarmonitormineralscanner>礦物掃描器安裝</upgradename.sonarmonitormineralscanner>

<upgradedescription.sonarmonitormineralscanner>改裝檢測陣列以提供挖掘掃描器功能。(不影響導航終端)</upgradedescription.sonarmonitormineralscanner>

<upgradename.turretdecreasereloadtime>改進自動裝彈機</upgradename.turretdecreasereloadtime>

<upgradedescription.turretdecreasereloadtime>增加炮塔的射擊速度。</upgradedescription.turretdecreasereloadtime>

<upgradename.dischargecoilincraserange>放電線圈放大器</upgradename.dischargecoilincreaserange>

<upgradedescription.dischargecoilincreaserange>增加放電線圈的作用範圍。</upgradedescription.dischargecoilincreaserange>

<upgradename.dischargecoildecreasepowerconsumption>能源效率</upgradename.dischargecoildecreasepowerconsumption>

<upgradedescription.dischargecoildecreasepowerconsumption>降低電力功耗。</upgradedescription.dischargecoildecreasepowerconsumption>

<upgradename.dcreasenoiseproduction>降噪系統</upgradename.decreasenoiseproduction>

<upgradedescription.decreasenoiseproduction>減少由該裝置產生的可檢測噪聲。</upgradedescription.decreasenoiseproduction>

<upgradename.searchlightincreaseoffsetonselected>增強探照燈</upgradename.searchlightincreaseoffsetonselected>

<upgradedescription.searchlightincreaseoffsetonselected>增加所有探照燈的視野範圍。</upgradedescription.searchlightincreaseoffsetonselected>

<upgradename.searchlightincreaserotationlowskill>靈活探照燈</upgradename.searchlightincreaserotationlowskill>

<upgradedescription.searchlightincreaserotationlowskill>當被技能不足的船員操作時,增加所有探照燈的旋轉速度。</upgradedescription.searchlightincreaserotationlowskill>

<upgradename.cameraincreaseoffsetonselected>增強潛望鏡</upgradename.cameraincreaseoffsetonselected>

<upgradedescription.cameraincreaseoffsetonselected>增加所有攝像機的視野範圍。</upgradedescription.cameraincreaseoffsetonselected>

<upgradename.increasecomponenthealth>裝置硬化</upgradename.increasecomponenthealth>

<upgradedescription.increasecomponenthealth>提高潛艇系統的耐久性,防止戰鬥損傷。</upgradedescription.increasecomponenthealth>

</infotexts>

安裝漢化

到這一步,你擁有了CN的mod資料夾以及filelist.xml和SimplifiedChinese.xml兩個xml檔案,這時你的檔案結構應該是這樣的:

將CN的mod資料夾放置到Steam\steamapps\common\Barotrauma\Mods,即潛淵症mod資料夾。

啟動遊戲。在mod列表裡同時勾選原mod與漢化mod,進入遊戲就能看到已經漢化的內容,那麼漢化就成功了。

如果你想上傳工坊,那麼就點遊戲主介面的自定義-創意工坊-釋出,找到你的mod,檢查完畢後點擊右下角的釋出專案即可。預設的描述文字是在英文使用者介面顯示的,稍後可以在創意工坊內對mod進行描述方面的更改。

可能存在的問題

原mod沒有提供英文翻譯檔案

那說明他的物品名稱在物品定義xml裡就被定義了,這個稍微有點麻煩,後面我會專門開一篇說明。

為什麼我的漢化失敗了/部分物品沒有漢化

如果修改原來的英文翻譯,但遊戲內的英文名稱也沒有任何變化,那就說明這個物品的名稱在物品定義xml裡被寫死了,目前的操作無法在外部對其進行翻譯,這種情況的翻譯後面我會專門開一篇說明。