Moved item names into a separate translation file, in order to make translations easier

This commit is contained in:
Wofsauge committed 2026-01-13 18:31:20 +01:00
1 parent d3f24e321b
commit d33a9b829c
23 files changed
+21994 -1

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+11 -1
View File
@@ -135,6 +135,7 @@ function EID:addCollectible(id, description, itemName, language)
if id > 4294960000 then modName = nil end
EID:CreateDescriptionTableIfMissing("custom", language)
EID.descriptions[language].custom["5.100." .. id] = {id, itemName, description, modName}
EID.ItemNames[language]["5.100." .. id] = itemName
end
---Adds a description for a trinket.
@@ -151,6 +152,7 @@ function EID:addTrinket(id, description, itemName, language)
end
EID:CreateDescriptionTableIfMissing("custom", language)
EID.descriptions[language].custom["5.350." .. id] = {id, itemName, description, EID._currentMod}
EID.ItemNames[language]["5.350." .. id] = itemName
end
---Adds character specific information, which can be viewed in the Item Reminder
@@ -245,6 +247,7 @@ function EID:addCard(id, description, itemName, language)
end
EID:CreateDescriptionTableIfMissing("custom", language)
EID.descriptions[language].custom["5.300." .. id] = {id, itemName, description, EID._currentMod}
EID.ItemNames[language]["5.300." .. id] = itemName
end
-- DEPRECATED! Does nothing! Don't use!
@@ -272,6 +275,7 @@ function EID:addPill(id, description, itemName, language)
if EID.isRepentance and EID.descriptions[language].horsepills[id+1] == nil then
EID.descriptions[language].horsepills[id+1] = {id, itemName, description, EID._currentMod}
end
EID.ItemNames[language]["5.70." .. id] = itemName
end
---Adds a horsepill-specific description for a PillEffect
@@ -289,6 +293,7 @@ function EID:addHorsePill(id, description, itemName, language)
end
EID:CreateDescriptionTableIfMissing("horsepills", language)
EID.descriptions[language].horsepills[id+1] = {id, itemName, description, EID._currentMod}
EID.ItemNames[language]["5.70." .. id] = itemName
end
---Adds a metadata for a pilleffect. Used for Placebo/False PHD
@@ -895,6 +900,12 @@ end
---@param SubType integer
---@return string
function EID:getObjectName(Type, Variant, SubType)
local fallbackName = Type.."."..Variant.."."..SubType
-- try to get name from EID.ItemNames table
local translatedName = EID.ItemNames[EID:getLanguage()][fallbackName]
local itemNameTableEntry = translatedName ~= "" and translatedName or EID.ItemNames[EID.DefaultLanguageCode][fallbackName]
if itemNameTableEntry then return itemNameTableEntry end
local tableName = EID:getTableName(Type, Variant, SubType)
local tableEntry = EID:getDescriptionData(Type, Variant, SubType)
local name = nil
@@ -903,7 +914,6 @@ function EID:getObjectName(Type, Variant, SubType)
name = tableEntry[2]
end
end
local fallbackName = Type.."."..Variant.."."..SubType
if tableName == "collectibles" then
if EID.itemConfig:GetCollectible(SubType) == nil then return fallbackName end
local vanillaName = EID.itemConfig:GetCollectible(SubType).Name
+6
View File
@@ -102,6 +102,12 @@ function EID:LoadLanguagePacks(gameVersion)
EID:WriteErrorMsg("Loading Languagepack '" .. languageCode .. "' (" .. gameVersion .. ") failed: " ..
tostring(err))
end
-- load item name lists
wasSuccessful, err = pcall(require, "descriptions.names." .. languageCode)
if not wasSuccessful and not string.find(err, "not found") then
EID:WriteErrorMsg("Loading Languagepack '" .. languageCode .. "' (Names) failed: " ..
tostring(err))
end
end
end
+1
View File
@@ -3,6 +3,7 @@ EID = RegisterMod("External Item Descriptions", 1)
-- important variables
EID.GameVersion = "ab+"
EID.descriptions = {} -- Table that holds all translation strings
EID.ItemNames = {} -- Table that holds all item names for each language
EID.enableDebug = false
local game = Game()
EID.isRepentancePlus = REPENTANCE_PLUS or FontRenderSettings ~= nil -- Repentance+ adds FontRenderSettings() class. We use this to check if the DLC is enabled. V1.9.7.7 added REPENTANCE_PLUS variable