配置問題
xMikux opened this issue · 48 comments
你好 我正嘗試用此模組來對某些硬編碼的模組進行翻譯
但我在配置的時候,對於該模組的任何物品都翻譯不到(但倒是 GUI 內的可以翻譯到一些)
我不確定是否因為顏色所導致無法翻譯到
配置檔案
GUI 的部分是成功的 但除此之外,物品的部分都是失敗
展開設定
[ { "key": "120 uses left", "value": "剩餘 120 使用次數" }, { "key": "Collects general items.", "value": "收集一般物品。" }, { "key": "Requires a Strainer Base.", "value": "需要裝在濾水基座上。" }, { "target_class": { "name": "mods.waterstrainer.item.ItemWorm", "mapping": "SRG", "stack_depth": -1 }, "key": "Bait Pot Slot.", "value": "modstranslation.waterstrainer.item.worm.lore.01 (x)" }, { "target_class": { "name": "mods.waterstrainer.item.ItemWorm", "mapping": "SRG", "stack_depth": -1 }, "key": "Source: Garden Trowel, Worm Bin", "value": "modstranslation.waterstrainer.item.worm.lore.02 (x)" }, { "target_class": { "name": "mods.waterstrainer.gui.GuiStrainer", "mapping": "SRG", "stack_depth": -1 }, "key": "Strainer Slot", "value": "modstranslation.waterstrainer.gui.slot.01" }, { "target_class": { "name": "mods.waterstrainer.gui.GuiStrainer", "mapping": "SRG", "stack_depth": -1 }, "key": "Bait Slot", "value": "modstranslation.waterstrainer.gui.slot.02" }, { "target_class": { "name": "mods.waterstrainer.gui.GuiStrainer", "mapping": "SRG", "stack_depth": -1 }, "key": "Bait Pot Slot", "value": "modstranslation.waterstrainer.gui.slot.03" }, { "target_class": { "name": "mods.waterstrainer.gui.ItemSuperWorm", "mapping": "SRG", "stack_depth": -1 }, "key": "&5Creative only", "value": "§5僅限創造" }, { "target_class": { "name": "mods.waterstrainer.gui.ItemSuperWorm", "mapping": "SRG", "stack_depth": -1 }, "key": "§7Infinite Bait.", "value": "§7無限魚餌" } ]
在翻譯 Shrink 的訊息也有差不多的問題,但我也不確定它是否可以在 Actionbar 與 Chat 中應用
配置檔案
message 的部分都是失敗的 但物品的 lore 是正常套用
展開設定
[ { "target_class": { "name": "net.gigabit101.shrink.items.ItemModBottle", "mapping": "SRG", "stack_depth": -1 }, "key": "Right-click on a shrunken entity with a glass bottle to capture", "value": "modstranslation.shrink.glass_bottle.tooltip" }, { "target_class": { "name": "net.gigabit101.shrink.items.ItemShrinkingDevice", "mapping": "SRG", "stack_depth": -1 }, "key": "Can't open while shrunk", "value": "modstranslation.shrink.device.message.01" }, { "target_class": { "name": "net.gigabit101.shrink.items.ItemShrinkingDevice", "mapping": "SRG", "stack_depth": -1 }, "key": "Not enough power in device", "value": "modstranslation.shrink.device.message.02" } ]
這次我會將顏色代碼放上去看看會不會有效果 還有把 target class 拿掉 (不過對於這個 我是比較希望能更準確的匹配 因為我怕有模組也用相同的就被覆蓋掉)
我這裡有一個沒有錯誤的配置文件,1.16.5的,你可以看看:https://gist.github.com/KlparetlR/7fa50f2cdd939835dc6bfb37e68836f2
我這裡先一次一個配置文件
Shrink
顏色代碼的正常了
[
{
"target_class":{
"name":"net.gigabit101.shrink.items.ItemModBottle",
"mapping":"SRG",
"stack_depth":-1
},
"key":"Right-click on a shrunken entity with a glass bottle to capture",
"value":"modstranslation.shrink.glass_bottle.tooltip"
},
{
"key":"Can't open while shrunk",
"value":"modstranslation.shrink.device.message.01"
},
{
"key":"§cNot enough power in device",
"value":"modstranslation.shrink.device.message.02"
}
]
他這個模組現在要實現替換功能要遊戲中顯示的內容跟你的key完全匹配,才能實現,但是顏色代碼要裝換,比如:你遇到了“TextFormatting.GRAY”,那麼你就要在key中替換為“§7”,然後去掉多餘的
有些不行:
tooltip.add((new TranslationTextComponent("[WARNING: laggy on large networks]")).func_240699_a_(TextFormatting.DARK_GRAY));
這裡的“func_240699_a_(TextFormatting.DARK_GRAY)”的““func_240699_a_”按模組作者的說法是“withSytle”,所以不能添加“§8”
他這個模組現在要實現替換功能要遊戲中顯示的內容跟你的key完全匹配,才能實現,但是顏色代碼要裝換,比如:你遇到了“TextFormatting.GRAY”,那麼你就要在key中替換為“§7”,然後去掉多餘的
這邊的去掉多餘的是指?
這個加上顏色代碼似乎也沒有任何效果
uses 大概是因為它是動態的數值 所以翻不了
[
{
"target_class":{
"name":"mods.waterstrainer.gui.GuiStrainer",
"mapping":"SRG",
"stack_depth":-1
},
"key":"Strainer Slot",
"value":"modstranslation.waterstrainer.gui.slot.01"
},
{
"target_class":{
"name":"mods.waterstrainer.gui.GuiStrainer",
"mapping":"SRG",
"stack_depth":-1
},
"key":"Bait Slot",
"value":"modstranslation.waterstrainer.gui.slot.02"
},
{
"target_class":{
"name":"mods.waterstrainer.gui.GuiStrainer",
"mapping":"SRG",
"stack_depth":-1
},
"key":"Bait Pot Slot",
"value":"modstranslation.waterstrainer.gui.slot.03"
},
{
"key":"§7Can be used as Bait.",
"value":"§7測試 bait."
},
{
"key":"§7Source: Garden Trowel, Worm Bin",
"value":"§7來源:園藝鏟,Worm Bin"
},
{
"key":"§5Creative only",
"value":"§5僅限創造"
},
{
"key":"§7Infinite Bait.",
"value":"§7無限魚餌"
},
{
"key":"§2128 uses left",
"value":"§2剩餘 128 使用次數"
},
{
"key":"§7Decreases Bait consumption.",
"value":"§7減少魚餌消耗速度"
},
{
"key":"§7Collects general items.",
"value":"§7收集一般物品。"
},
{
"key":"§7Requires a Strainer Base.",
"value":"§7需要裝在濾水基座上。"
},
{
"key":"Bait Pot Slot.",
"value":"modstranslation.waterstrainer.item.worm.lore.01 (x)"
}
]
話說對於 像是這種的 向下
的 Down
還有其他常見的方位
有什麼方式可以避免它可能性覆蓋到其他模組有這些字的方式
(target_class 我不太會用 因為我改了 name 也仍然套用 )
(com.buuz135.functionalstorage.client.gui.DrawerInfoGuiAddon 這個我只是推測它在這裡 但我不確定方位的字串是否在這裡 因為沒看到)
[
{
"target_class":{
"name":"com.buuz135.functionalstorage.client.gui.DrawerInfoGuiAddon",
"mapping":"SRG",
"stack_depth":-1
},
"key":"Empty",
"value":"空Der"
},
{
"target_class":{
"name":"com.buuz135.functionalstorage.client.gui.FluidDrawerInfoGuiAddon",
"mapping":"SRG",
"stack_depth":-1
},
"key":"Empty",
"value":"空Der"
},
{
"target_class":{
"name":"com.buuz135.functionalstorage.item.UpgradeItem",
"mapping":"SRG",
"stack_depth":-1
},
"key":"Up",
"value":"向上"
},
{
"target_class":{
"name":"com.buuz135.functionalstorage.item.UpgradeIteme",
"mapping":"SRG",
"stack_depth":-1
},
"key":"Down",
"value":"向下"
},
{
"target_class":{
"name":"com.buuz135.functionalstorage.item.UpgradeItem",
"mapping":"SRG",
"stack_depth":-1
},
"key":"North",
"value":"向北"
},
{
"target_class":{
"name":"com.buuz135.functionalstorage.item.UpgradeItem",
"mapping":"SRG",
"stack_depth":-1
},
"key":"South",
"value":"向南"
},
{
"target_class":{
"name":"com.buuz135.functionalstorage.item.UpgradeItem",
"mapping":"SRG",
"stack_depth":-1
},
"key":"West",
"value":"向西"
},
{
"target_class":{
"name":"com.buuz135.functionalstorage.item.UpgradeItem",
"mapping":"SRG",
"stack_depth":-1
},
"key":"East",
"value":"向東"
}
]
好的 感謝你們的幫助
說了以遊戲顯示的為主,目前做不到部分替換,應該是類似窮舉法,所以key應該這樣寫來解決上面的兩張圖片,1.{顏色代碼}Swapped mode to single ,2.{顏色代碼}Swapped mode to multiple。我不確定顏色代碼要不要加,所以你兩種的試試(沒有顏色代碼和有的)
这里的Swapped Action to不需要加颜色代码,因为本身字符串中不含有
有了 看起來還是要讀一定的原始碼
另外很多情况下,target_class.name只用写“#+类名”,比较方便
這我會嘗試看看 不過我在測試的時候隨意將 class name 換成另一個不存在的 name 也仍然配對到 這也導致我不確定它是有正常使用精準的還是仍然是全域 (還是說需要使用 stack_depth ?)
說了以遊戲顯示的為主,目前做不到部分替換,應該是類似窮舉法,所以key應該這樣寫來解決上面的兩張圖片,1.{顏色代碼}Swapped mode to single ,2.{顏色代碼}Swapped mode to multiple。我不確定顏色代碼要不要加,所以你兩種的試試(沒有顏色代碼和有的)
好問題 我嘗試了直接指定它的位置 com.buuz135.functionalstorage.client.gui.DrawerInfoGuiAddon
com.buuz135.functionalstorage.client.gui.FluidDrawerInfoGuiAddon
com.buuz135.functionalstorage.item.UpgradeItem
也嘗試直接 #DrawerInfoGuiAddon 不過都沒有判斷到
[
{
"key":"Swapped action to add",
"value":"切換指令為新增"
},
{
"key":"Swapped action to remove",
"value":"切換指令為移除"
},
{
"key":"Swapped mode to single",
"value":"切換模式為單個目標"
},
{
"key":"Swapped mode to multiple",
"value":"切換模式為複數目標"
},
{
"target_class":{
"name":"#DrawerInfoGuiAddon",
"mapping":"SRG",
"stack_depth": 1
},
"key":"Empty",
"value":"modstranslation.functionalstorage.gui.empty"
},
{
"target_class":{
"name":"#FluidDrawerInfoGuiAddon",
"mapping":"SRG",
"stack_depth": 1
},
"key":"Empty",
"value":"modstranslation.functionalstorage.gui.empty"
},
{
"target_class":{
"name":"#UpgradeItem",
"mapping":"SRG",
"stack_depth": 1
},
"key":"Up",
"value":"modstranslation.functionalstorage.item.pusher_upgrade.up"
},
{
"target_class":{
"name":"#UpgradeItem",
"mapping":"SRG",
"stack_depth": 1
},
"key":"Down",
"value":"modstranslation.functionalstorage.item.pusher_upgrade.down"
},
{
"target_class":{
"name":"#UpgradeItem",
"mapping":"SRG",
"stack_depth": 1
},
"key":"North",
"value":"modstranslation.functionalstorage.item.pusher_upgrade.north"
},
{
"target_class":{
"name":"#UpgradeItem",
"mapping":"SRG",
"stack_depth": 1
},
"key":"South",
"value":"modstranslation.functionalstorage.item.pusher_upgrade.south"
},
{
"target_class":{
"name":"#UpgradeItem",
"mapping":"SRG",
"stack_depth": 1
},
"key":"West",
"value":"modstranslation.functionalstorage.item.pusher_upgrade.west"
},
{
"target_class":{
"name":"#UpgradeItem",
"mapping":"SRG",
"stack_depth": 1
},
"key":"East",
"value":"modstranslation.functionalstorage.item.pusher_upgrade.east"
}
]
對於精準配對 target_class.name 我暫時不做了
等真的出現衝突到我再來弄會比較好一點
我也用這個模組翻譯了一些不能翻的手冊指南物品名與手冊內的主頁面介紹 👍
我嘗試 1.2.5 但仍然沒有效果
對於半配對的翻譯運作得還不錯 雖然不知道為啥有部分的翻譯自己消失了
還有 @class
的配對 用了沒有反應 感覺還是沒有配對上
Water Strainer 的設定檔案我等等會上傳上來 並且先以一個物品為基準來做 debug
最上面的兩行
target_class 的部分似乎因為仍然配對不到 所以他沒效果的樣子
如果拿掉的話倒是正常 第一行就不知道為何完全沒反應
[
{
"key":"Can be used as Bait.",
"value":"可以用作魚餌"
},
{
"target_class":{
"name":"@mods.waterstrainer",
"mapping":"SRG",
"stack_depth": 1
},
"key":"Source: Garden Trowel, Worm Bin",
"value":"來源:園藝鏟,a"
},
{
"key":"Creative only",
"value":"創造 only"
},
{
"key":"Infinite Bait.",
"value":"無限魚餌"
},
{
"key":"128 uses left",
"value":"剩餘使用次數 128 次"
},
{
"key":"Decreases Bait consumption.",
"value":"減少魚餌的消耗。"
},
{
"key":"Chance to find Bait.",
"value":"有機率可以挖到餌。"
},
{
"key":"Press shift for more info.",
"value":"按住 Shift 來查看更多資訊。"
}
]