Feat/reworked language codes (#865)
* Reworked language codes to use Steam localization standards * Reworked language codes tweaks (#864) * Language code rework tweaks * Update bg.lua * Reevaluate whether a language is WIP * Update bg.lua * Even better mark for languages as WIP (> 80% translated) * Update zh_cn.lua * Update cs.lua * Fix for game language codes --------- Co-authored-by: kittenchilly <mario.pikmin.zelda@gmail.com>
This commit is contained in:
1 parent
92eefb8fbb
commit
a0c50a9b42
54 files changed
+1272
-1197
No files matched your search
+35
-78
@@ -47,22 +47,6 @@ local dynamicSpriteCache = {} -- used to store sprite objects of collectible ico
|
||||
|
||||
--#region Luadoc definitions
|
||||
|
||||
---@alias EID_LanguageCode
|
||||
---| "cs_cz" @Czech
|
||||
---| "de" @German
|
||||
---| "en_us" @English
|
||||
---| "fr" @French
|
||||
---| "it" @Italian
|
||||
---| "ja_jp" @Japanese
|
||||
---| "ko_kr" @Korean
|
||||
---| "pl" @Polish
|
||||
---| "pt_br" @Portuguese
|
||||
---| "ru" @Russian
|
||||
---| "spa" @Spanish
|
||||
---| "tr_tr" @Turkish
|
||||
---| "uk_ua" @Ukrainian
|
||||
---| "zh_cn" @Simplified Chinese
|
||||
|
||||
---@alias EID_PillClass "3-"|"2-"|"1-"|"0"|"1+"|"2+"|"3+"
|
||||
|
||||
---@alias EID_TypeVariantAlias
|
||||
@@ -139,10 +123,10 @@ local dynamicSpriteCache = {} -- used to store sprite objects of collectible ico
|
||||
---@param id CollectibleType
|
||||
---@param description string
|
||||
---@param itemName string?
|
||||
---@param language EID_LanguageCode? @Default: "en_us"
|
||||
---@param language EID_LanguageCode? @Default: "en"
|
||||
function EID:addCollectible(id, description, itemName, language)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if id == -1 then
|
||||
EID:WriteErrorMsg("Trying to add collectible description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
@@ -158,10 +142,10 @@ end
|
||||
---@param id TrinketType
|
||||
---@param description string
|
||||
---@param itemName? string
|
||||
---@param language? EID_LanguageCode @Default: "en_us"
|
||||
---@param language? EID_LanguageCode @Default: "en"
|
||||
function EID:addTrinket(id, description, itemName, language)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if id == -1 then
|
||||
EID:WriteErrorMsg("Trying to add trinket description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
@@ -174,10 +158,10 @@ end
|
||||
---@param characterId PlayerType
|
||||
---@param description string
|
||||
---@param playerName? string @Default: "Modded Character"
|
||||
---@param language? EID_LanguageCode @Default: "en_us"
|
||||
---@param language? EID_LanguageCode @Default: "en"
|
||||
function EID:addCharacterInfo(characterId, description, playerName, language)
|
||||
playerName = playerName or "Modded Character"
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if characterId == -1 then
|
||||
EID:WriteErrorMsg("Trying to add character description to id = -1, which is not allowed! (Name: "..tostring(playerName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
@@ -196,7 +180,7 @@ end
|
||||
--- ```
|
||||
function EID:addGoldenTrinketMetadata(id, appendText, numbersToMultiply, maxMultiplier, language)
|
||||
maxMultiplier = maxMultiplier or 3
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
|
||||
if appendText == "" then appendText = nil
|
||||
elseif type(appendText) == "string" then appendText = {appendText} end
|
||||
@@ -220,7 +204,7 @@ end
|
||||
--- ```
|
||||
|
||||
function EID:addGoldenTrinketMetadataAdditive(id, appendText, numbersToChange, additiveValues, language)
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
|
||||
if appendText == "" then appendText = nil
|
||||
elseif type(appendText) == "string" then appendText = {appendText} end
|
||||
@@ -251,10 +235,10 @@ end
|
||||
---@param id Card
|
||||
---@param description string
|
||||
---@param itemName? string
|
||||
---@param language? EID_LanguageCode @Default: "en_us"
|
||||
---@param language? EID_LanguageCode @Default: "en"
|
||||
function EID:addCard(id, description, itemName, language)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if id == -1 then
|
||||
EID:WriteErrorMsg("Trying to add card description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
@@ -271,10 +255,10 @@ end
|
||||
---@param id PillEffect
|
||||
---@param description string
|
||||
---@param itemName? string
|
||||
---@param language? EID_LanguageCode @Default: "en_us"
|
||||
---@param language? EID_LanguageCode @Default: "en"
|
||||
function EID:addPill(id, description, itemName, language)
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if id == -1 then
|
||||
EID:WriteErrorMsg("Trying to add pill description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
@@ -292,11 +276,11 @@ end
|
||||
---@param id PillEffect
|
||||
---@param description string
|
||||
---@param itemName? string
|
||||
---@param language? EID_LanguageCode @Default: "en_us"
|
||||
---@param language? EID_LanguageCode @Default: "en"
|
||||
function EID:addHorsePill(id, description, itemName, language)
|
||||
if not EID.isRepentance then return end
|
||||
itemName = itemName or nil
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if id == -1 then
|
||||
EID:WriteErrorMsg("Trying to add horsepill description to id = -1, which is not allowed! (Name: "..tostring(itemName).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
@@ -319,10 +303,10 @@ end
|
||||
---@param characterId PlayerType
|
||||
---@param description string
|
||||
---@param playerName? string
|
||||
---@param language? EID_LanguageCode @Default: "en_us"
|
||||
---@param language? EID_LanguageCode @Default: "en"
|
||||
function EID:addBirthright(characterId, description, playerName, language)
|
||||
playerName = playerName or nil
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if characterId == -1 then
|
||||
EID:WriteErrorMsg("Trying to add Birthright description to id = -1, which is not allowed! (Name: "..tostring(characterId).."; Description: "..tostring(description)..")")
|
||||
return
|
||||
@@ -334,9 +318,9 @@ end
|
||||
---Creates a new transformation with a given unique name and a display name
|
||||
---@param uniqueName string
|
||||
---@param displayName string
|
||||
---@param language? EID_LanguageCode @Default: "en_us"
|
||||
---@param language? EID_LanguageCode @Default: "en"
|
||||
function EID:createTransformation(uniqueName, displayName, language)
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if EID.CustomTransformations[uniqueName] == nil then
|
||||
EID.CustomTransformations[uniqueName] = {}
|
||||
end
|
||||
@@ -451,10 +435,10 @@ end
|
||||
---@param subtype? integer @If `nil` or `-1`, it will affect all subtypes of that entity
|
||||
---@param entityName string
|
||||
---@param description string
|
||||
---@param language? EID_LanguageCode @Default: "en_us"
|
||||
---@param language? EID_LanguageCode @Default: "en"
|
||||
function EID:addEntity(id, variant, subtype, entityName, description, language)
|
||||
subtype = subtype or -1
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if id == EntityType.ENTITY_EFFECT then
|
||||
EID.effectList[variant] = true
|
||||
end
|
||||
@@ -485,13 +469,13 @@ end
|
||||
---This spell should be added with the "Custom Poop API" library to actually appear in-game.
|
||||
---Example:
|
||||
---```lua
|
||||
---EID:addCustomPoopSpell("MYPOOP", "I Made This Poop", "{{PoopSpell1}}", "Can be throwed to deal damage", "en_us")
|
||||
---EID:addCustomPoopSpell("MYPOOP", "I Made This Poop", "{{PoopSpell1}}", "Can be throwed to deal damage", "en")
|
||||
---```
|
||||
---@param token string @The name of the spell in the Custom Poop API code
|
||||
---@param name string @The name of the spell as it should appear in the description
|
||||
---@param icon string @Markup icon of the poop
|
||||
---@param description string
|
||||
---@param language? EID_LanguageCode @Default: "en_us"
|
||||
---@param language? EID_LanguageCode @Default: "en"
|
||||
function EID:addCustomPoopSpell(token, name, icon, description, language)
|
||||
EID.descriptions[language]["poopSpells"][token] = {icon, name, description, EID._currentMod}
|
||||
end
|
||||
@@ -782,12 +766,12 @@ end
|
||||
function EID:getDescriptionEntry(objTable, objIdentifier, noFallback)
|
||||
if not objIdentifier then
|
||||
if noFallback then return EID.descriptions[EID:getLanguage()][objTable]
|
||||
else return EID.descriptions[EID:getLanguage()][objTable] or EID.descriptions["en_us"][objTable] end
|
||||
else return EID.descriptions[EID:getLanguage()][objTable] or EID.descriptions["en"][objTable] end
|
||||
else
|
||||
local translatedTable = EID.descriptions[EID:getLanguage()][objTable]
|
||||
local description
|
||||
if noFallback then description = translatedTable and translatedTable[objIdentifier]
|
||||
else description = (translatedTable and translatedTable[objIdentifier]) or (EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objIdentifier]) end
|
||||
else description = (translatedTable and translatedTable[objIdentifier]) or (EID.descriptions["en"][objTable] and EID.descriptions["en"][objTable][objIdentifier]) end
|
||||
--Try looking for a -1 that would encompass all subtypes of the variant
|
||||
-- Safety check for if the identifier contains "."(dot) 1-2 times and only contains numbers
|
||||
local strNoDots, numDots = string.gsub(objIdentifier, "%.","")
|
||||
@@ -814,9 +798,9 @@ end
|
||||
---@return string
|
||||
function EID:getDescriptionEntryEnglish(objTable, objID)
|
||||
if not objID then
|
||||
return EID.descriptions["en_us"][objTable]
|
||||
return EID.descriptions["en"][objTable]
|
||||
else
|
||||
return EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objID]
|
||||
return EID.descriptions["en"][objTable] and EID.descriptions["en"][objTable][objID]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -849,7 +833,7 @@ function EID:getAdjustedSubtype(Type, Variant, SubType)
|
||||
return (SubType & TrinketType.TRINKET_ID_MASK)
|
||||
end
|
||||
elseif tableName == "sacrifice" then
|
||||
return math.min(#EID.descriptions["en_us"].sacrifice, SubType)
|
||||
return math.min(#EID.descriptions["en"].sacrifice, SubType)
|
||||
elseif tableName == "pills" or tableName == "horsepills" then
|
||||
-- The effect of a pill varies depending on what player is looking at it in co-op
|
||||
-- EID.pillPlayer is a way to recheck a pill for what different players will turn it into
|
||||
@@ -912,7 +896,7 @@ function EID:getTransformationName(id)
|
||||
-- get translated custom name
|
||||
local customTransform = EID.CustomTransformations[id]
|
||||
if customTransform ~= nil then
|
||||
return customTransform[EID:getLanguage()] or customTransform["en_us"] or id
|
||||
return customTransform[EID:getLanguage()] or customTransform["en"] or id
|
||||
end
|
||||
return id
|
||||
end
|
||||
@@ -929,7 +913,7 @@ function EID:getObjectName(Type, Variant, SubType)
|
||||
local tableEntry = EID:getDescriptionData(Type, Variant, SubType)
|
||||
local name = nil
|
||||
if tableEntry ~= nil then
|
||||
if tableEntry[2] ~= nil and tableEntry[2] ~= "" and tableEntry[2] ~= EID.descriptions["en_us"][tableName][SubType] then
|
||||
if tableEntry[2] ~= nil and tableEntry[2] ~= "" and tableEntry[2] ~= EID.descriptions["en"][tableName][SubType] then
|
||||
name = tableEntry[2]
|
||||
end
|
||||
end
|
||||
@@ -937,24 +921,24 @@ function EID:getObjectName(Type, Variant, SubType)
|
||||
if tableName == "collectibles" then
|
||||
if EID.itemConfig:GetCollectible(SubType) == nil then return fallbackName end
|
||||
local vanillaName = EID.itemConfig:GetCollectible(SubType).Name
|
||||
local englishName = EID.descriptions["en_us"][tableName][SubType] and EID.descriptions["en_us"][tableName][SubType][2]
|
||||
local englishName = EID.descriptions["en"][tableName][SubType] and EID.descriptions["en"][tableName][SubType][2]
|
||||
return name or (not string.find(vanillaName, "^#") and vanillaName) or englishName or vanillaName
|
||||
elseif tableName == "trinkets" then
|
||||
local adjustedSubtype = EID:getAdjustedSubtype(Type, Variant, SubType)
|
||||
if EID.itemConfig:GetTrinket(adjustedSubtype) == nil then return fallbackName end
|
||||
local vanillaName = EID.itemConfig:GetTrinket(adjustedSubtype).Name
|
||||
local englishName = EID.descriptions["en_us"][tableName][adjustedSubtype] and EID.descriptions["en_us"][tableName][adjustedSubtype][2]
|
||||
local englishName = EID.descriptions["en"][tableName][adjustedSubtype] and EID.descriptions["en"][tableName][adjustedSubtype][2]
|
||||
return name or (not string.find(vanillaName, "^#") and vanillaName) or englishName or vanillaName
|
||||
elseif tableName == "cards" then
|
||||
if EID.itemConfig:GetCard(SubType) == nil then return fallbackName end
|
||||
local vanillaName = EID.itemConfig:GetCard(SubType).Name
|
||||
local englishName = EID.descriptions["en_us"][tableName][SubType] and EID.descriptions["en_us"][tableName][SubType][2]
|
||||
local englishName = EID.descriptions["en"][tableName][SubType] and EID.descriptions["en"][tableName][SubType][2]
|
||||
return name or (not string.find(vanillaName, "^#") and vanillaName) or englishName or vanillaName
|
||||
elseif tableName == "pills" or tableName == "horsepills" then
|
||||
local adjustedSubtype = EID:getAdjustedSubtype(Type, Variant, SubType)
|
||||
return EID:getPillName(adjustedSubtype, tableName == "horsepills")
|
||||
elseif tableName == "sacrifice" then
|
||||
return EID:getDescriptionEntry("sacrificeHeader").." ("..SubType.."/"..#EID.descriptions["en_us"].sacrifice..")"
|
||||
return EID:getDescriptionEntry("sacrificeHeader").." ("..SubType.."/"..#EID.descriptions["en"].sacrifice..")"
|
||||
elseif tableName == "dice" then
|
||||
return EID:getDescriptionEntry("diceHeader").." ("..SubType..")"
|
||||
elseif tableName == "players" then
|
||||
@@ -1003,7 +987,7 @@ function EID:getPillName(pillID, isHorsepill)
|
||||
else
|
||||
vanillaName = EID.itemConfig:GetPillEffect(pillID - 1).Name
|
||||
end
|
||||
name = name and name[2] or (not string.find(vanillaName, "^#") and vanillaName) or EID.descriptions["en_us"][tableName][pillID][2] or vanillaName
|
||||
name = name and name[2] or (not string.find(vanillaName, "^#") and vanillaName) or EID.descriptions["en"][tableName][pillID][2] or vanillaName
|
||||
name = string.gsub(name,"I'm Excited!!!","I'm Excited!!") -- prevent markup trigger
|
||||
return name
|
||||
end
|
||||
@@ -1267,7 +1251,7 @@ function EID:getTransformationIcon(str)
|
||||
return EID.InlineIcons["ERROR"]
|
||||
end
|
||||
if tonumber(str) ~= nil then
|
||||
str = EID.descriptions["en_us"].transformations[tonumber(str + 1)]
|
||||
str = EID.descriptions["en"].transformations[tonumber(str + 1)]
|
||||
end
|
||||
local transformSprite = EID:getIcon(str:gsub(" ", ""))
|
||||
if transformSprite[1] == "ERROR" then
|
||||
@@ -2340,33 +2324,6 @@ function EID:getPlayerID(entityPlayer, lazarusAdjust)
|
||||
return 0
|
||||
end
|
||||
|
||||
---Get the current Language. Defaults to english if none is set.
|
||||
---@return EID_LanguageCode
|
||||
function EID:getLanguage()
|
||||
local lang = EID.Config["Language"]
|
||||
-- Reset invalid languages (like en_us_detailed)
|
||||
if EID.descriptions[lang] == nil then
|
||||
EID.Config["Language"] = "auto"
|
||||
lang = "auto"
|
||||
end
|
||||
if lang == "auto" then
|
||||
local langToReturn = Options and EID.LanguageMap[Options.Language] or "en_us"
|
||||
-- don't do any updating if on a Repentance version before v1.7.9b
|
||||
if Isaac.RunCallback ~= nil then
|
||||
local newLang
|
||||
for _, callbackData in pairs(Isaac.GetCallbacks("EID_EVALUATE_AUTO_LANG")) do
|
||||
local newString = callbackData.Function(callbackData.Mod, langToReturn)
|
||||
if newString and type(newString) == "string" and EID.descriptions[newString] ~= nil then
|
||||
langToReturn = newString
|
||||
end
|
||||
end
|
||||
end
|
||||
return langToReturn
|
||||
end
|
||||
---@cast lang EID_LanguageCode
|
||||
return lang
|
||||
end
|
||||
|
||||
---@param itemID CollectibleType
|
||||
function EID:AddToCollectiblesToCheckList(itemID)
|
||||
EID.collectiblesToCheck[itemID] = true
|
||||
|
||||
@@ -1150,7 +1150,7 @@ function EID:handleBagOfCraftingRendering(ignoreRefreshRate)
|
||||
-- Nothing in our recipe list passed the test; try checking English names as a backup
|
||||
if #IDsToCheck == 0 then
|
||||
local curLang = EID:getLanguage()
|
||||
EID.Config["Language"] = "en_us"
|
||||
EID.Config["Language"] = "en"
|
||||
for _,id in ipairs(sortedIDs) do
|
||||
local searchValid = EID:BoCSCheckItemName(EID:getObjectName(5, 100, id))
|
||||
if (searchValid) then table.insert(IDsToCheck, id) end
|
||||
|
||||
@@ -57,7 +57,7 @@ end
|
||||
|
||||
EID:AddCallback("EIDCallbacks.SEARCH_NAME_CONVERSION", function(_, searchString)
|
||||
-- TODO : make english search inside ko_kr language setting (priotity low though)
|
||||
if EID:getLanguage() == "ko_kr" then
|
||||
if EID:getLanguage() == "ko" then
|
||||
return EID.engKeystrokeToKor(searchString)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -20,7 +20,7 @@ end
|
||||
-- Optional parameters: replaceText, language, extraTable
|
||||
-- Example usage: EID:addCondition(myDevilishItemID, EID.IsGreedMode, "{{GreedMode}} Reduces shop prices by 1 for each optional Nightmare wave completed")
|
||||
function EID:addCondition(ID, ownedID, text, replaceText, language, extraTable)
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if replaceText then text = {text, replaceText} end
|
||||
local modifierText = newModdedCondition(text, language)
|
||||
if type(ownedID) ~= "function" then
|
||||
@@ -37,7 +37,7 @@ end
|
||||
-- Optional parameters: text2, language, extraTable
|
||||
-- Example usage: EID:addSynergyCondition(myHappyLittleItemID, {CollectibleType.COLLECTIBLE_BRIMSTONE, CollectibleType.COLLECTIBLE_SULFUR}, "Turns your laser into a smiley face that charms enemies")
|
||||
function EID:addSynergyCondition(ID1, ID2, text1, text2, language, extraTable)
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
local modifierText1 = newModdedCondition(text1, language)
|
||||
local modifierText2 = newModdedCondition(text2, language)
|
||||
EID:AddSynergyConditional(ID1, ID2, modifierText1, modifierText2, extraTable)
|
||||
@@ -49,7 +49,7 @@ end
|
||||
-- Optional parameters: replaceText, language, extraTable, includeTainted
|
||||
-- Example usage: EID:addPlayerCondition(myAngstyItemID, PlayerType.PLAYER_EVE, "Gives Eve extra mascara (2x Damage multiplier)")
|
||||
function EID:addPlayerCondition(ID, playerID, text, replaceText, language, extraTable, includeTainted)
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if replaceText then text = {text, replaceText} end
|
||||
local modifierText = newModdedCondition(text, language)
|
||||
EID:AddPlayerConditional(ID, playerID, modifierText, extraTable, includeTainted)
|
||||
@@ -61,7 +61,7 @@ end
|
||||
-- or, if you provide newNumber, it changes numberToDouble to that (technically, it's just a find/replace pair, any strings work)
|
||||
-- Example usage: EID:addToGeneralCondition(myVeryHealthyItemID, "bingeEaterBuffs", "↑ {{Speed}} +0.15 Speed#↓ {{Tears}} -0.5 Tears#↓ {{Damage}} -0.5 Damage")
|
||||
function EID:addToGeneralCondition(ID, locTable, text, numberToDouble, newNumber, language)
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if numberToDouble then
|
||||
newNumber = newNumber or numberToDouble * 2
|
||||
text = { numberToDouble, newNumber, text }
|
||||
@@ -103,7 +103,7 @@ end
|
||||
-- Shortcut function for adding BFFS conditions; this is slightly more complex since it supports trinkets
|
||||
-- Example usage: EID:addBFFSCondition(myBasicFamiliarID, nil, 3.5)
|
||||
function EID:addBFFSCondition(ID, text, numberToDouble, newNumber, language)
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if numberToDouble then
|
||||
newNumber = newNumber or numberToDouble * 2
|
||||
text = { numberToDouble, newNumber, text }
|
||||
@@ -119,7 +119,7 @@ end
|
||||
|
||||
-- Shortcut function for adding Hive Mind conditions; by default, it will show with BFFS too, unless you pass in allowBFFS as false
|
||||
function EID:addHiveMindCondition(ID, text, numberToDouble, newNumber, language, allowBFFS)
|
||||
language = language or "en_us"
|
||||
language = language or "en"
|
||||
if allowBFFS == nil then allowBFFS = true end
|
||||
EID.HiveMindFamiliars[ID] = true
|
||||
if not allowBFFS then EID.BFFSIgnore[ID] = true end
|
||||
|
||||
@@ -874,21 +874,6 @@ EID.GoldenTrinketData = {
|
||||
[13] = {goldenOnly = true, fullReplace = true, mult=1}, [15] = {append = true}, [16] = {t={20}, mults={0.5, 0.333}}, [25] = {goldenOnly = true, findReplace = true, mult = 2},
|
||||
}
|
||||
|
||||
EID.BreakUtf8CharsLanguage = {
|
||||
['zh_cn'] = true
|
||||
}
|
||||
|
||||
-- Map the game's built-in language option strings to EID's
|
||||
EID.LanguageMap = {
|
||||
["jp"] = "ja_jp",
|
||||
["es"] = "spa",
|
||||
["de"] = "de",
|
||||
["fr"] = "fr",
|
||||
["ru"] = "ru",
|
||||
["kr"] = "ko_kr",
|
||||
["zh"] = "zh_cn",
|
||||
}
|
||||
|
||||
EID.MarkupSizeMap = {
|
||||
["{{Damage}}"] = "{{DamageSmall}}",
|
||||
["{{Speed}}"] = "{{SpeedSmall}}",
|
||||
|
||||
@@ -3,9 +3,9 @@ local showDebugChars = false
|
||||
|
||||
-- check integrity of language files
|
||||
|
||||
local languageFilesToCheck = {"fr"} -- EID.Languages -- single file check {"ko_kr"}
|
||||
local languageFilesToCheck = {"fr"} -- EID.Languages -- single file check example {"ko"}
|
||||
|
||||
-- count en_us entries for stats
|
||||
-- count English entries for stats
|
||||
local count = 0
|
||||
function EID:countEntries(t)
|
||||
for k, _ in pairs(t) do
|
||||
@@ -15,9 +15,9 @@ function EID:countEntries(t)
|
||||
end
|
||||
end
|
||||
end
|
||||
EID:countEntries(EID.descriptions["en_us"])
|
||||
EID:countEntries(EID.descriptions["en"])
|
||||
local enUSEntries = count
|
||||
EID:WriteDebugMsg("en_us entries: "..enUSEntries)
|
||||
EID:WriteDebugMsg("English entries: "..enUSEntries)
|
||||
|
||||
|
||||
local maxChecklimit = {["tarotClothBuffs"] = 2}
|
||||
@@ -83,7 +83,7 @@ for _, lang in ipairs(languageFilesToCheck) do
|
||||
end
|
||||
|
||||
local progress = { 0, 0 }
|
||||
EID:compareTables(EID.descriptions["en_us"], EID.descriptions[lang], lang, progress)
|
||||
EID:compareTables(EID.descriptions["en"], EID.descriptions[lang], lang, progress)
|
||||
|
||||
local errors = (enUSEntries - progress[1])-progress[2]
|
||||
EID:WriteDebugMsg("Errors found: "..errors .." / "..enUSEntries)
|
||||
|
||||
@@ -615,7 +615,7 @@ function EID:ItemReminderHandlePoopSpells(player)
|
||||
|
||||
local ignoreExisting = false
|
||||
if customPoop == nil then --If the poop still doesn't exist, use the unkown one instead
|
||||
customPoop = EID:getDescriptionEntry("poopSpells")["Unknown"] or EID.descriptions["en_us"]["poopSpells"]["Unknown"]
|
||||
customPoop = EID:getDescriptionEntry("poopSpells")["Unknown"] or EID.descriptions["en"]["poopSpells"]["Unknown"]
|
||||
ignoreExisting = true
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
-- List of all valid languages
|
||||
EID.Languages = {
|
||||
"en", -- English
|
||||
"fr", -- French
|
||||
"pt", -- Portuguese
|
||||
"pt_br", -- Brazilian Portuguese
|
||||
"ru", -- Russian
|
||||
"es", -- Spanish
|
||||
"it", -- Italian
|
||||
"bg", -- Bulgarian
|
||||
"pl", -- Polish
|
||||
"de", -- German
|
||||
"tr", -- Turkish
|
||||
"ko", -- Korean
|
||||
"zh_cn", -- Simplified Chinese
|
||||
"ja", -- Japanese
|
||||
"cs", -- Czech
|
||||
"nl", -- Dutch
|
||||
"uk", -- Ukrainian
|
||||
"el", -- Greek
|
||||
"ro", -- Romanian
|
||||
"vi" -- Vietnamese
|
||||
}
|
||||
|
||||
-- List of languages where it is allowed to do line-breaks between UTF-8 characters in a description
|
||||
EID.BreakUtf8CharsLanguage = {
|
||||
['zh_cn'] = true
|
||||
}
|
||||
|
||||
--#region Luadoc definitions
|
||||
---@alias EID_LanguageCode
|
||||
---| "bg" @Bulgarian
|
||||
---| "cs" @Czech
|
||||
---| "de" @German
|
||||
---| "el" @Greek
|
||||
---| "en" @English
|
||||
---| "es" @Spanish
|
||||
---| "fr" @French
|
||||
---| "it" @Italian
|
||||
---| "ja" @Japanese
|
||||
---| "ko" @Korean
|
||||
---| "nl" @Dutch
|
||||
---| "pl" @Polish
|
||||
---| "pt_br" @Brasilian Portuguese
|
||||
---| "pt" @Portuguese
|
||||
---| "ro" @Romanian
|
||||
---| "ru" @Russian
|
||||
---| "tr" @Turkish
|
||||
---| "uk" @Ukrainian
|
||||
---| "vi" @Vietnamese
|
||||
---| "zh_cn" @Simplified Chinese
|
||||
--#endregion
|
||||
|
||||
---Get the current Language. Defaults to english if none is set.
|
||||
---@return EID_LanguageCode
|
||||
function EID:getLanguage()
|
||||
local lang = EID.Config["Language"]
|
||||
-- Reset invalid languages (like en_us_detailed)
|
||||
if EID.descriptions[lang] == nil then
|
||||
EID.Config["Language"] = "auto"
|
||||
lang = "auto"
|
||||
end
|
||||
if lang == "auto" then
|
||||
local langToReturn = Options and Options.Language or "en" -- Use game language, if available.
|
||||
-- don't do any updating if on a Repentance version before v1.7.9b
|
||||
if Isaac.RunCallback ~= nil then
|
||||
for _, callbackData in pairs(Isaac.GetCallbacks("EID_EVALUATE_AUTO_LANG")) do
|
||||
local newString = callbackData.Function(callbackData.Mod, langToReturn)
|
||||
if newString and type(newString) == "string" and EID.descriptions[newString] ~= nil then
|
||||
langToReturn = newString
|
||||
end
|
||||
end
|
||||
end
|
||||
return langToReturn
|
||||
end
|
||||
---@cast lang EID_LanguageCode
|
||||
return lang
|
||||
end
|
||||
|
||||
--- Attempts to load all language packs from a given game version
|
||||
function EID:LoadLanguagePacks(gameVersion)
|
||||
--transformation infos
|
||||
local _, _ = pcall(require, "descriptions." .. gameVersion .. ".transformations")
|
||||
--languages
|
||||
for _, languageCode in ipairs(EID.Languages) do
|
||||
local wasSuccessful, err = pcall(require, "descriptions." .. gameVersion .. "." .. languageCode)
|
||||
if not wasSuccessful and not string.find(err, "not found") then
|
||||
EID:WriteErrorMsg("Loading Languagepack '" .. languageCode .. "' (" .. gameVersion .. ") failed: " ..
|
||||
tostring(err))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Initializes handling of alternative language codes for all languages
|
||||
function EID:InitAltLanguageCodes()
|
||||
for _, languageCode in ipairs(EID.Languages) do
|
||||
if EID.descriptions[languageCode] and EID.descriptions[languageCode].alternativeLanguageCodes then
|
||||
for _, altlanguageCode in ipairs(EID.descriptions[languageCode].alternativeLanguageCodes) do
|
||||
EID:AddAlternativeLanguageCode(languageCode, altlanguageCode)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--- Initializes handling of alternative language codes for a specific language using meta-table that redirect table accesses to the original table
|
||||
function EID:AddAlternativeLanguageCode(originalLanguageCode, newLanguageCode)
|
||||
EID.descriptions[newLanguageCode] = setmetatable({}, {
|
||||
__index = EID.descriptions[originalLanguageCode],
|
||||
__newindex = function(_, key, value)
|
||||
EID.descriptions[originalLanguageCode][key] = value
|
||||
end,
|
||||
__pairs = function(_) return pairs(EID.descriptions[originalLanguageCode]) end,
|
||||
})
|
||||
end
|
||||
|
||||
--- Initializes and loads all language packs for the current game version,
|
||||
--- including handling for Repentance and Repentance+ expansions,
|
||||
--- and sorts the language list after loading.
|
||||
function EID:InitializeLanguagePacks()
|
||||
-- load AB+ descriptions
|
||||
EID:LoadLanguagePacks(EID.GameVersion)
|
||||
EID:InitAltLanguageCodes()
|
||||
|
||||
-- load Repentance descriptions
|
||||
if EID.isRepentance then
|
||||
EID.GameVersion = "rep"
|
||||
EID:LoadLanguagePacks(EID.GameVersion)
|
||||
|
||||
-- Load Repentance+ descriptions
|
||||
if EID.isRepentancePlus then
|
||||
EID.GameVersion = "rep+"
|
||||
EID:LoadLanguagePacks(EID.GameVersion)
|
||||
end
|
||||
end
|
||||
|
||||
-- sort table after loading the languages in their specified order
|
||||
table.sort(EID.Languages)
|
||||
end
|
||||
@@ -336,7 +336,7 @@ if MCMLoaded then
|
||||
end
|
||||
renderDummyDesc(true)
|
||||
end,
|
||||
Info = {"Changes the language.","Languages marked as WIP are incomplete."}
|
||||
Info = {"Changes the language.","Languages marked as WIP are incomplete. Contributions welcome!"}
|
||||
}
|
||||
)
|
||||
-- Item Name Language
|
||||
|
||||
@@ -47,7 +47,7 @@ end
|
||||
|
||||
-- attributes we need to check on the glitched item's ItemConfig
|
||||
local itemConfigItemAttributes = { "AddMaxHearts", "AddHearts", "AddSoulHearts", "AddBlackHearts", "AddBombs", "AddCoins", "AddKeys", "CacheFlags" }
|
||||
-- REPENTOGON's ProceduralItem functions, in the same order as en_us's VoidNames text we'll be using
|
||||
-- REPENTOGON's ProceduralItem functions, in the same order as English's VoidNames text we'll be using
|
||||
local getFunctions = { "GetSpeed", "GetFireDelay", "GetDamage", "GetRange", "GetShotSpeed", "GetLuck" }
|
||||
-- The items have a value between 0 and 1, and multiplied by these before being added to the player's stats
|
||||
local statMult = { 0.2, 1, 1, 1.5, 0.2, 1 }
|
||||
@@ -198,5 +198,5 @@ end
|
||||
-- this made more sense when this file was only executed when --luadebug was present
|
||||
-- https://www.youtube.com/watch?v=msDuNZyYAIQ
|
||||
if (debug and os.date("%m/%d") == "04/01") then
|
||||
EID.descriptions["en_us"].sacrifice[1][3] = "{{Coin}} 50% chance of winning 1 coin at Sacrifice#75% chance if you're a genetic freak#!!! If you add Kurt Angle to the mix, your chances of winning drastically go down"
|
||||
EID.descriptions["en"].sacrifice[1][3] = "{{Coin}} 50% chance of winning 1 coin at Sacrifice#75% chance if you're a genetic freak#!!! If you add Kurt Angle to the mix, your chances of winning drastically go down"
|
||||
end
|
||||
Reference in new issue
Block a user