From 6e5610cce16dd85fbac54f402a1bd04c28a7bffd Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Fri, 11 Apr 2025 00:31:24 +0200 Subject: [PATCH] Improved pluralization by enabling each language to provide their own pluralization algorithm --- descriptions/ab+/cs_cz.lua | 38 +++++++++++++++++++++---------------- descriptions/ab+/de.lua | 9 +++++++-- descriptions/ab+/en_us.lua | 38 +++++++++++++++++++++---------------- descriptions/ab+/fr.lua | 39 +++++++++++++++++++++----------------- descriptions/ab+/it.lua | 11 ++++++++--- descriptions/ab+/ja_jp.lua | 29 ++++++++++++++++------------ descriptions/ab+/ko_kr.lua | 11 ++++++++--- descriptions/ab+/pt_br.lua | 8 ++++++-- descriptions/ab+/ro_ro.lua | 37 ++++++++++++++++++++---------------- descriptions/ab+/ru.lua | 8 ++++++-- descriptions/ab+/spa.lua | 9 +++++++-- descriptions/ab+/uk_ua.lua | 9 ++++++--- descriptions/ab+/zh_cn.lua | 10 +++++++--- descriptions/rep/cs_cz.lua | 5 +++-- descriptions/rep/de.lua | 14 +++++++------- descriptions/rep/en_us.lua | 17 +++++++++-------- descriptions/rep/fr.lua | 17 +++++++++-------- descriptions/rep/it.lua | 3 ++- descriptions/rep/ja_jp.lua | 1 + descriptions/rep/ko_kr.lua | 3 ++- descriptions/rep/pt_br.lua | 1 + descriptions/rep/ro_ro.lua | 1 + descriptions/rep/ru.lua | 1 + descriptions/rep/spa.lua | 1 + descriptions/rep/uk_ua.lua | 1 + descriptions/rep/zh_cn.lua | 1 + features/eid_api.lua | 15 ++++++++++++++- features/eid_modifiers.lua | 11 ++++++----- features/eid_tmtrainer.lua | 17 +++++++++++------ 29 files changed, 229 insertions(+), 136 deletions(-) diff --git a/descriptions/ab+/cs_cz.lua b/descriptions/ab+/cs_cz.lua index ffb0e106..d89873fb 100644 --- a/descriptions/ab+/cs_cz.lua +++ b/descriptions/ab+/cs_cz.lua @@ -1064,8 +1064,13 @@ EID.descriptions[languageCode].transformations = { ---------- MISC ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "s" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them, make it nil to not pluralize +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- replace {plural_X} placeholders inside the text with fitting textparts + text = EID:ReplaceVariableStr(text, "plural_e", amount > 1 and "e" or "") + text = EID:ReplaceVariableStr(text, "plural_ay", amount > 1 and "y" or "a") + return text +end EID.descriptions[languageCode].VoidText = "Pokud absorbuješ, získáš:" EID.descriptions[languageCode].VoidNames = {"Rychlost", "Slzy", "Poškození", "Dostřel", "Rychlost Střel", "Štěstí"} @@ -1090,27 +1095,28 @@ EID.descriptions[languageCode].MCM = { } -- Find/replace pairs for changing "+1 Health" to "+1 Soul Heart" for soul health characters, or nothing at all for The Lost --- {1} = number of hearts, {2} = plural character +-- {1} = number of hearts, {pluralize} = plural character +-- These texts are affected by the PluralizeFunction (ab+ file) -- If having a simple plural character doesn't work for your language, you could just include an extra string pair to catch plural lines EID.descriptions[languageCode].RedToX = { -- These change "+1 Health" to just "+1 Soul Heart" and etc. - ["Red to Soul"] = {"↑ {{Heart}} +{1} Zdraví", "{{SoulHeart}} +{1} Duševní Srdce{2}", - "↑ {{EmptyHeart}} +{1} Místo na srdce{2}", "{{SoulHeart}} +{1} Duševní Srdce{2}", - "↓ {{EmptyHeart}} {1} Zdraví", "↓ {{SoulHeart}} {1} Duševní Srdce{2}"}, + ["Red to Soul"] = {"↑ {{Heart}} +{1} Zdraví", "{{SoulHeart}} +{1} Duševní Srdce", + "↑ {{EmptyHeart}} +{1} Místo na srdce", "{{SoulHeart}} +{1} Duševní Srdce", + "↓ {{EmptyHeart}} {1} Zdraví", "↓ {{SoulHeart}} {1} Duševní Srdce"}, - ["Red to Black"] = {"↑ {{Heart}} +{1} Zdraví", "{{BlackHeart}} +{1} Černé Srdce{2}", - "↑ {{EmptyHeart}} +{1} Místo na srdce{2}", "{{BlackHeart}} +{1} Černé Srdce{2}", - "↓ {{EmptyHeart}} {1} Zdraví", "↓ {{SoulHeart}} {1} Černé Srdce{2}"}, + ["Red to Black"] = {"↑ {{Heart}} +{1} Zdraví", "{{BlackHeart}} +{1} Černé Srdce", + "↑ {{EmptyHeart}} +{1} Místo na srdce", "{{BlackHeart}} +{1} Černé Srdce", + "↓ {{EmptyHeart}} {1} Zdraví", "↓ {{SoulHeart}} {1} Černé Srdce"}, - ["Red to Bone"] = {"↑ {{Heart}} +{1} Zdraví", "{{BoneHeart}} +{1} Kostěné Srdce{2}", - "↑ {{EmptyHeart}} +{1} Místo na srdce{2}", "{{EmptyBoneHeart}} +{1} Prázdné kostěné srdce{2}", "{{HealingRed}}", "{{HealingBone}}", - "↓ {{EmptyHeart}} {1} Zdraví", "↓ {{EmptyBoneHeart}} {1} Kostěné Srdce{2}"}, -- Red HP to Bone Hearts + ["Red to Bone"] = {"↑ {{Heart}} +{1} Zdraví", "{{BoneHeart}} +{1} Kostěné Srdce", + "↑ {{EmptyHeart}} +{1} Místo na srdce", "{{EmptyBoneHeart}} +{1} Prázdné kostěné srdce", "{{HealingRed}}", "{{HealingBone}}", + "↓ {{EmptyHeart}} {1} Zdraví", "↓ {{EmptyBoneHeart}} {1} Kostěné Srdce"}, -- Red HP to Bone Hearts - ["Red to Coin"] = {"↑ {{Heart}} +{1} Zdraví", "{{CoinHeart}} +{1} Mincové Srdce{2}", - "↑ {{EmptyHeart}} +{1} Místo na srdce{2}", "{{EmptyCoinHeart}} +{1} Prázdné Mincové Srdce{2}", - "{{HealingRed}} Vyléčí {1} srdce{2}", "{{HealingCoin}} Vyléčí {1} minci{2}", "{{HealingRed}} Vyléčí půlku srdce", "{{HealingCoin}} Vyléčí 1 minci", "{{HealingRed}}", "{{HealingCoin}}", "↓ {{EmptyHeart}} {1} Zdraví", "↓ {{EmptyCoinHeart}} {1} Mincové Srdce{2}"}, -- Red HP to Coin Hearts + ["Red to Coin"] = {"↑ {{Heart}} +{1} Zdraví", "{{CoinHeart}} +{1} Mincové Srdce", + "↑ {{EmptyHeart}} +{1} Místo na srdce", "{{EmptyCoinHeart}} +{1} Prázdné Mincové Srdce", + "{{HealingRed}} Vyléčí {1} srdce", "{{HealingCoin}} Vyléčí {1} minci", "{{HealingRed}} Vyléčí půlku srdce", "{{HealingCoin}} Vyléčí 1 minci", "{{HealingRed}}", "{{HealingCoin}}", "↓ {{EmptyHeart}} {1} Zdraví", "↓ {{EmptyCoinHeart}} {1} Mincové Srdce"}, -- Red HP to Coin Hearts - ["Red to None"] = {"↑ {{Heart}} +{1} Zdraví", "", "↑ {{EmptyHeart}} +{1} Místo na srdce{2}", "", "↓ {{EmptyHeart}} {1} Zdraví", ""}, -- Red HP to None (The Lost) + ["Red to None"] = {"↑ {{Heart}} +{1} Zdraví", "", "↑ {{EmptyHeart}} +{1} Místo na srdce", "", "↓ {{EmptyHeart}} {1} Zdraví", ""}, -- Red HP to None (The Lost) } diff --git a/descriptions/ab+/de.lua b/descriptions/ab+/de.lua index 27864308..e7af6b14 100644 --- a/descriptions/ab+/de.lua +++ b/descriptions/ab+/de.lua @@ -720,8 +720,13 @@ EID.descriptions[languageCode].transformations={ } ---------- MISC ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + text = EID:ReplaceVariableStr(text, "plural_n", amount > 1 and "e" or "") -- add "n" to word + text = EID:ReplaceVariableStr(text, "plural_en", amount > 1 and "en" or "") -- add "en" to word + return text +end EID.descriptions[languageCode].VoidText = "Wenn absorbiert, erhalte:" -- {1} will become the number text (like "{1} Tränen" -> "+0.5 Tränen") diff --git a/descriptions/ab+/en_us.lua b/descriptions/ab+/en_us.lua index b4f85a39..eaff3242 100644 --- a/descriptions/ab+/en_us.lua +++ b/descriptions/ab+/en_us.lua @@ -1093,8 +1093,13 @@ EID.descriptions[languageCode].transformations={ ---------- MISC ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "s" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them, make it nil to not pluralize +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- English plural is very easy. Simply put an "s" at the end of specific words, if amount > 1 + -- replace {pluralize} placeholders inside the text with an "s" + return EID:ReplaceVariableStr(text, "pluralize", amount > 1 and "s" or "") +end EID.descriptions[languageCode].VoidText = "If absorbed, gain:" -- {1} will become the number text (like "{1} Tears" -> "+0.5 Tears") @@ -1114,27 +1119,28 @@ EID.descriptions[languageCode].BlackFeatherInformation = "{{ColorLime}}{1}{{CR}} EID.descriptions[languageCode].SingleUseInfo = "{{Warning}} SINGLE USE {{Warning}}" -- Find/replace pairs for changing "+1 Health" to "+1 Soul Heart" for soul health characters, or nothing at all for The Lost --- {1} = number of hearts, {2} = plural character +-- {1} = number of hearts, {pluralize} = plural character +-- These texts are affected by the PluralizeFunction (ab+ file) -- If having a simple plural character doesn't work for your language, you could just include an extra string pair to catch plural lines EID.descriptions[languageCode].RedToX = { -- These change "+1 Health" to just "+1 Soul Heart" and etc. - ["Red to Soul"] = {"↑ {{Heart}} +{1} Health", "{{SoulHeart}} +{1} Soul Heart{2}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{SoulHeart}} +{1} Soul Heart{2}", - "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Soul Heart{2}"}, + ["Red to Soul"] = {"↑ {{Heart}} +{1} Health", "{{SoulHeart}} +{1} Soul Heart{pluralize}", + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{SoulHeart}} +{1} Soul Heart{pluralize}", + "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Soul Heart{pluralize}"}, - ["Red to Black"] = {"↑ {{Heart}} +{1} Health", "{{BlackHeart}} +{1} Black Heart{2}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{BlackHeart}} +{1} Black Heart{2}", - "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Black Heart{2}"}, + ["Red to Black"] = {"↑ {{Heart}} +{1} Health", "{{BlackHeart}} +{1} Black Heart{pluralize}", + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{BlackHeart}} +{1} Black Heart{pluralize}", + "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Black Heart{pluralize}"}, - ["Red to Bone"] = {"↑ {{Heart}} +{1} Health", "{{BoneHeart}} +{1} Bone Heart{2}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{EmptyBoneHeart}} +{1} Empty Bone Heart{2}", "{{HealingRed}}", "{{HealingBone}}", - "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyBoneHeart}} {1} Bone Heart{2}"}, -- Red HP to Bone Hearts + ["Red to Bone"] = {"↑ {{Heart}} +{1} Health", "{{BoneHeart}} +{1} Bone Heart{pluralize}", + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{EmptyBoneHeart}} +{1} Empty Bone Heart{pluralize}", "{{HealingRed}}", "{{HealingBone}}", + "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyBoneHeart}} {1} Bone Heart{pluralize}"}, -- Red HP to Bone Hearts - ["Red to Coin"] = {"↑ {{Heart}} +{1} Health", "{{CoinHeart}} +{1} Coin Heart{2}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{EmptyCoinHeart}} +{1} Empty Coin Heart{2}", - "{{HealingRed}} Heals {1} heart{2}", "{{HealingCoin}} Heals {1} coin{2}", "{{HealingRed}} Heals half a heart", "{{HealingCoin}} Heals 1 coin", "{{HealingRed}}", "{{HealingCoin}}", "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyCoinHeart}} {1} Coin Heart{2}"}, -- Red HP to Coin Hearts + ["Red to Coin"] = {"↑ {{Heart}} +{1} Health", "{{CoinHeart}} +{1} Coin Heart{pluralize}", + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{EmptyCoinHeart}} +{1} Empty Coin Heart{pluralize}", + "{{HealingRed}} Heals {1} heart{pluralize}", "{{HealingCoin}} Heals {1} coin{pluralize}", "{{HealingRed}} Heals half a heart", "{{HealingCoin}} Heals 1 coin", "{{HealingRed}}", "{{HealingCoin}}", "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyCoinHeart}} {1} Coin Heart{pluralize}"}, -- Red HP to Coin Hearts - ["Red to None"] = {"↑ {{Heart}} +{1} Health", "", "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "", "↓ {{EmptyHeart}} {1} Health", ""}, -- Red HP to None (The Lost) + ["Red to None"] = {"↑ {{Heart}} +{1} Health", "", "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "", "↓ {{EmptyHeart}} {1} Health", ""}, -- Red HP to None (The Lost) } EID.descriptions[languageCode].MCM = { diff --git a/descriptions/ab+/fr.lua b/descriptions/ab+/fr.lua index 3b84fa9a..fdf67b88 100644 --- a/descriptions/ab+/fr.lua +++ b/descriptions/ab+/fr.lua @@ -970,8 +970,12 @@ EID.descriptions[languageCode].transformations={ ---------- MISC ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "s" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them, make it nil to not pluralize +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- French plural + -- replace {pluralize} placeholders inside the text with an "s" + return EID:ReplaceVariableStr(text, "pluralize", amount > 1 and "s" or "") +end EID.descriptions[languageCode].VoidText = "Si absorbé :" EID.descriptions[languageCode].VoidNames = {"Vitesse {{ColorLime}}{1}", "Débit {{ColorLime}}{1}", "Dégâts {{ColorLime}}{1}", "Portée {{ColorLime}}{1}", "Vitesse des tirs {{ColorLime}}{1}", "Chance {{ColorLime}}{1}"} @@ -990,29 +994,30 @@ EID.descriptions[languageCode].BlackFeatherInformation = "{{ColorSilver}}({1} ob EID.descriptions[languageCode].SingleUseInfo = "{{Warning}} USAGE UNIQUE {{Warning}}" -- Find/replace pairs for changing "+1 Health" to "+1 Soul Heart" for soul health characters, or nothing at all for The Lost --- {1} = number of hearts, {2} = plural character +-- {1} = number of hearts, {pluralize} = plural character +-- These texts are affected by the PluralizeFunction (ab+ file) -- If having a simple plural character doesn't work for your language, you could just include an extra string pair to catch plural lines EID.descriptions[languageCode].RedToX = { -- These change "+1 Health" to just "+1 Soul Heart" and etc. - ["Red to Soul"] = {"{{Heart}} +{1} réceptacle{2} de cœur", "{{SoulHeart}} +{1} cœur{2} d'âme", - "{{EmptyHeart}} +{1} réceptacle{2} de cœur", "{{SoulHeart}} +{1} cœur{2} d'âme", - "↓ {1} réceptacle{2} de cœur", "↓ {1} cœur{2}"}, + ["Red to Soul"] = {"{{Heart}} +{1} réceptacle{pluralize} de cœur", "{{SoulHeart}} +{1} cœur{pluralize} d'âme", + "{{EmptyHeart}} +{1} réceptacle{pluralize} de cœur", "{{SoulHeart}} +{1} cœur{pluralize} d'âme", + "↓ {1} réceptacle{pluralize} de cœur", "↓ {1} cœur{pluralize}"}, - ["Red to Black"] = {"{{Heart}} +{1} réceptacle{2} de cœur", "{{BlackHeart}} +{1} cœur{2} noir{2}", - "{{EmptyHeart}} +{1} réceptacle{2} de cœur", "{{BlackHeart}} +{1} cœur{2} noir{2}", - "↓ {1} réceptacle{2} de cœur", "↓ {1} cœur{2}"}, + ["Red to Black"] = {"{{Heart}} +{1} réceptacle{pluralize} de cœur", "{{BlackHeart}} +{1} cœur{pluralize} noir{pluralize}", + "{{EmptyHeart}} +{1} réceptacle{pluralize} de cœur", "{{BlackHeart}} +{1} cœur{pluralize} noir{pluralize}", + "↓ {1} réceptacle{pluralize} de cœur", "↓ {1} cœur{pluralize}"}, - ["Red to Bone"] = {"{{Heart}} +{1} réceptacle{2} de cœur", "{{BoneHeart}} +{1} cœur{2} d'os", - "{{EmptyHeart}} +{1} réceptacle{2} de cœur", "{{EmptyBoneHeart}} +{1} cœur{2} d'os", "↓ -{1} réceptacle{2} de cœur", "↓ -{1} cœur{2}", - "↓ {1} réceptacle{2} de cœur", "↓ {1} cœur{2} d'os", + ["Red to Bone"] = {"{{Heart}} +{1} réceptacle{pluralize} de cœur", "{{BoneHeart}} +{1} cœur{pluralize} d'os", + "{{EmptyHeart}} +{1} réceptacle{pluralize} de cœur", "{{EmptyBoneHeart}} +{1} cœur{pluralize} d'os", "↓ -{1} réceptacle{pluralize} de cœur", "↓ -{1} cœur{pluralize}", + "↓ {1} réceptacle{pluralize} de cœur", "↓ {1} cœur{pluralize} d'os", "{{HealingRed}}", "{{HealingBone}}"}, -- Red HP to Bone Hearts - ["Red to Coin"] = {"{{Heart}} +{1} réceptacle{2} de cœur", "{{CoinHeart}} +{1} réceptacle{2} de pièce", - "{{EmptyHeart}} +{1} réceptacle{2} de cœur", "{{EmptyCoinHeart}} +{1} réceptacle{2} de pièce", "↓ -{1} réceptacle{2} de cœur", "↓ -{1} réceptacle{2} de pièce", - "↓ {1} réceptacle{2} de cœur", "↓ {1} réceptacle{2} de pièce", - "{{HealingRed}} Soigne {1} cœur{2} rouge{2}", "{{HealingCoin}} Soigne {1} pièce{2}", "{{HealingRed}} Soigne un demi-cœur rouge", "{{HealingCoin}} Soigne 1 pièce", "{{HealingRed}}", "{{HealingCoin}}"}, + ["Red to Coin"] = {"{{Heart}} +{1} réceptacle{pluralize} de cœur", "{{CoinHeart}} +{1} réceptacle{pluralize} de pièce", + "{{EmptyHeart}} +{1} réceptacle{pluralize} de cœur", "{{EmptyCoinHeart}} +{1} réceptacle{pluralize} de pièce", "↓ -{1} réceptacle{pluralize} de cœur", "↓ -{1} réceptacle{pluralize} de pièce", + "↓ {1} réceptacle{pluralize} de cœur", "↓ {1} réceptacle{pluralize} de pièce", + "{{HealingRed}} Soigne {1} cœur{pluralize} rouge{pluralize}", "{{HealingCoin}} Soigne {1} pièce{pluralize}", "{{HealingRed}} Soigne un demi-cœur rouge", "{{HealingCoin}} Soigne 1 pièce", "{{HealingRed}}", "{{HealingCoin}}"}, - ["Red to None"] = {"{{Heart}} +{1} réceptacle{2} de cœur", "", "{{EmptyHeart}} +{1} réceptacle{2} de cœur", "", "↓ {1} réceptacle{2} de cœur", ""}, -- Red HP to None (The Lost) + ["Red to None"] = {"{{Heart}} +{1} réceptacle{pluralize} de cœur", "", "{{EmptyHeart}} +{1} réceptacle{pluralize} de cœur", "", "↓ {1} réceptacle{pluralize} de cœur", ""}, -- Red HP to None (The Lost) } EID.descriptions[languageCode].MCM = { diff --git a/descriptions/ab+/it.lua b/descriptions/ab+/it.lua index 39ab24a6..6ec249e8 100644 --- a/descriptions/ab+/it.lua +++ b/descriptions/ab+/it.lua @@ -1093,8 +1093,12 @@ EID.descriptions[languageCode].transformations={ ---------- MISC ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- TODO: Not Implemented right now... + return text +end EID.descriptions[languageCode].VoidText = "Se assorbito, si ottiene:" -- {1} will become the number text (like "{1} Tears" -> "+0.5 Tears") @@ -1114,7 +1118,8 @@ EID.descriptions[languageCode].BlackFeatherInformation = "Oggetti tenuti al mome EID.descriptions[languageCode].SingleUseInfo = "{{Warning}} USO SINGOLO {{Warning}}" -- Find/replace pairs for changing "+1 Health" to "+1 Soul Heart" for soul health characters, or nothing at all for The Lost --- {1} = number of hearts, {2} = plural character +-- {1} = number of hearts, {pluralize} = plural character +-- These texts are affected by the PluralizeFunction (ab+ file) -- If having a simple plural character doesn't work for your language, you could just include an extra string pair to catch plural lines EID.descriptions[languageCode].RedToX = { -- These change "+1 Health" to just "+1 Soul Heart" and etc. diff --git a/descriptions/ab+/ja_jp.lua b/descriptions/ab+/ja_jp.lua index 3fad9b93..008e9a9c 100644 --- a/descriptions/ab+/ja_jp.lua +++ b/descriptions/ab+/ja_jp.lua @@ -1093,8 +1093,12 @@ EID.descriptions[languageCode].transformations={ ---------- MISC ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- TODO: Not Implemented right now... + return text +end EID.descriptions[languageCode].VoidText = "吸収した時:" -- {1} will become the number text (like "{1} Tears up" -> "+0.5 Tears up") @@ -1114,27 +1118,28 @@ EID.descriptions[languageCode].SingleUseInfo = "{{Warning}} 使い切りアイ EID.descriptions[languageCode].BlackFeatherInformation = "現在{{ColorLime}}{1}{{CR}}個の対象アイテムを 所持(攻撃力 +{2})" -- Find/replace pairs for changing "+1 Health" to "+1 Soul Heart" for soul health characters, or nothing at all for The Lost --- {1} = number of hearts, {2} = plural character +-- {1} = number of hearts, {pluralize} = plural character +-- These texts are affected by the PluralizeFunction (ab+ file) -- If having a simple plural character doesn't work for your language, you could just include an extra string pair to catch plural lines EID.descriptions[languageCode].RedToX = { -- These change "+1 Health" to just "+1 Soul Heart" and etc. ["Red to Soul"] = {"↑ 最大体力 +{1}", "青ハート +{1}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{SoulHeart}} +{1} Soul Heart{2}", - "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Soul Heart{2}"}, + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{SoulHeart}} +{1} Soul Heart{pluralize}", + "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Soul Heart{pluralize}"}, ["Red to Black"] = {"↑ 最大体力 +{1}", "黒ハート +{1}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{BlackHeart}} +{1} Black Heart{2}", - "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Black Heart{2}"}, + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{BlackHeart}} +{1} Black Heart{pluralize}", + "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Black Heart{pluralize}"}, ["Red to Bone"] = {"↑ 最大体力 +{1}", "骨ハート +{1}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{EmptyBoneHeart}} +{1} Empty Bone Heart{2}", "{{HealingRed}}", "{{HealingBone}}", - "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyBoneHeart}} {1} Bone Heart{2}"}, -- Red HP to Bone Hearts + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{EmptyBoneHeart}} +{1} Empty Bone Heart{pluralize}", "{{HealingRed}}", "{{HealingBone}}", + "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyBoneHeart}} {1} Bone Heart{pluralize}"}, -- Red HP to Bone Hearts ["Red to Coin"] = {"↑ 最大体力 +{1}", "↑ 最大体力 +{1}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{EmptyCoinHeart}} +{1} Empty Coin Heart{2}", - "{{HealingRed}} Heals {1} heart{2}", "{{HealingCoin}} Heals {1} coin{2}", "{{HealingRed}} Heals half a heart", "{{HealingCoin}} Heals 1 coin", "{{HealingRed}}", "{{HealingCoin}}", "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyCoinHeart}} {1} Coin Heart{2}"}, -- Red HP to Coin Hearts + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{EmptyCoinHeart}} +{1} Empty Coin Heart{pluralize}", + "{{HealingRed}} Heals {1} heart{pluralize}", "{{HealingCoin}} Heals {1} coin{pluralize}", "{{HealingRed}} Heals half a heart", "{{HealingCoin}} Heals 1 coin", "{{HealingRed}}", "{{HealingCoin}}", "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyCoinHeart}} {1} Coin Heart{pluralize}"}, -- Red HP to Coin Hearts - ["Red to None"] = {"↑ 最大体力 +{1}", "", "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "", "↓ {{EmptyHeart}} {1} Health", ""}, -- Red HP to None (The Lost) + ["Red to None"] = {"↑ 最大体力 +{1}", "", "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "", "↓ {{EmptyHeart}} {1} Health", ""}, -- Red HP to None (The Lost) } EID.descriptions[languageCode].MCM = { diff --git a/descriptions/ab+/ko_kr.lua b/descriptions/ab+/ko_kr.lua index d60367ea..56329994 100644 --- a/descriptions/ab+/ko_kr.lua +++ b/descriptions/ab+/ko_kr.lua @@ -968,8 +968,12 @@ EID.descriptions[languageCode].transformations={ } ---------- Misc ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- TODO: Not Implemented right now... + return text +end EID.descriptions[languageCode].VoidText = "흡수 시 이하 능력치 증가:" EID.descriptions[languageCode].VoidNames = {"이동속도 {1}", "연사 {1}", "공격력 {1}", "사거리 {1}", "탄속 {1}", "행운 {1}"} @@ -992,7 +996,8 @@ EID.descriptions[languageCode].MCM={ DemoObjectText = "이 설명은 한국어로 작성되었습니다.#!!! 간단 설정 방법:#{{Collectible182}} 폰트: Visuals→Font Type#{{Freezing}} 텍스트박스 너비: General→Textbox Width#\1 {{Damage}}테스트 공격력 +1#{{AngelDevilChance}} 악마와 천사, 당신의 선택은?#{{DeliriumSmall}} 모두가 싫어하는 델리리움", } -- Find/replace pairs for changing "+1 Health" to "+1 Soul Heart" for soul health characters, or nothing at all for The Lost --- {1} = number of hearts, {2} = plural character +-- {1} = number of hearts, {pluralize} = plural character +-- These texts are affected by the PluralizeFunction (ab+ file) -- If having a simple plural character doesn't work for your language, you could just include an extra string pair to catch plural lines EID.descriptions[languageCode].RedToX = { -- These change "+1 Health" to just "+1 Soul Heart" and etc. diff --git a/descriptions/ab+/pt_br.lua b/descriptions/ab+/pt_br.lua index 847f073b..1273d7cb 100644 --- a/descriptions/ab+/pt_br.lua +++ b/descriptions/ab+/pt_br.lua @@ -872,8 +872,12 @@ EID.descriptions[languageCode].transformations={ } ---------- MISC ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- TODO: Not Implemented right now... + return text +end EID.descriptions[languageCode].VoidText = "Se absorvido, ganha:" EID.descriptions[languageCode].VoidNames = {"Velocidade", "Lágrimas", "Dano", "Alcance", "Velocidade de Disparo", "Sorte"} diff --git a/descriptions/ab+/ro_ro.lua b/descriptions/ab+/ro_ro.lua index 2d82cca6..b44a5be6 100644 --- a/descriptions/ab+/ro_ro.lua +++ b/descriptions/ab+/ro_ro.lua @@ -1092,8 +1092,12 @@ EID.descriptions[languageCode].transformations={ ---------- MISC ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "s" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- TODO: Not Implemented right now... + return text +end EID.descriptions[languageCode].VoidText = "If absorbed, gain:" -- {1} will become the number text (like "{1} Tears" -> "+0.5 Tears") @@ -1111,27 +1115,28 @@ EID.descriptions[languageCode].CollectionPageInfo = "This item needs to be picke EID.descriptions[languageCode].BlackFeatherInformation = "{{ColorLime}}{1}{{CR}} items currently held (+{2} Damage)" -- Find/replace pairs for changing "+1 Health" to "+1 Soul Heart" for soul health characters, or nothing at all for The Lost --- {1} = number of hearts, {2} = plural character +-- {1} = number of hearts, {pluralize} = plural character +-- These texts are affected by the PluralizeFunction (ab+ file) -- If having a simple plural character doesn't work for your language, you could just include an extra string pair to catch plural lines EID.descriptions[languageCode].RedToX = { -- These change "+1 Health" to just "+1 Soul Heart" and etc. - ["Red to Soul"] = {"↑ {{Heart}} +{1} Health", "{{SoulHeart}} +{1} Soul Heart{2}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{SoulHeart}} +{1} Soul Heart{2}", - "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Soul Heart{2}"}, + ["Red to Soul"] = {"↑ {{Heart}} +{1} Health", "{{SoulHeart}} +{1} Soul Heart{pluralize}", + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{SoulHeart}} +{1} Soul Heart{pluralize}", + "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Soul Heart{pluralize}"}, - ["Red to Black"] = {"↑ {{Heart}} +{1} Health", "{{BlackHeart}} +{1} Black Heart{2}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{BlackHeart}} +{1} Black Heart{2}", - "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Black Heart{2}"}, + ["Red to Black"] = {"↑ {{Heart}} +{1} Health", "{{BlackHeart}} +{1} Black Heart{pluralize}", + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{BlackHeart}} +{1} Black Heart{pluralize}", + "↓ {{EmptyHeart}} {1} Health", "↓ {{SoulHeart}} {1} Black Heart{pluralize}"}, - ["Red to Bone"] = {"↑ {{Heart}} +{1} Health", "{{BoneHeart}} +{1} Bone Heart{2}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{EmptyBoneHeart}} +{1} Empty Bone Heart{2}", "{{HealingRed}}", "{{HealingBone}}", - "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyBoneHeart}} {1} Bone Heart{2}"}, -- Red HP to Bone Hearts + ["Red to Bone"] = {"↑ {{Heart}} +{1} Health", "{{BoneHeart}} +{1} Bone Heart{pluralize}", + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{EmptyBoneHeart}} +{1} Empty Bone Heart{pluralize}", "{{HealingRed}}", "{{HealingBone}}", + "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyBoneHeart}} {1} Bone Heart{pluralize}"}, -- Red HP to Bone Hearts - ["Red to Coin"] = {"↑ {{Heart}} +{1} Health", "{{CoinHeart}} +{1} Coin Heart{2}", - "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "{{EmptyCoinHeart}} +{1} Empty Coin Heart{2}", - "{{HealingRed}} Heals {1} heart{2}", "{{HealingCoin}} Heals {1} coin{2}", "{{HealingRed}} Heals half a heart", "{{HealingCoin}} Heals 1 coin", "{{HealingRed}}", "{{HealingCoin}}", "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyCoinHeart}} {1} Coin Heart{2}"}, -- Red HP to Coin Hearts + ["Red to Coin"] = {"↑ {{Heart}} +{1} Health", "{{CoinHeart}} +{1} Coin Heart{pluralize}", + "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "{{EmptyCoinHeart}} +{1} Empty Coin Heart{pluralize}", + "{{HealingRed}} Heals {1} heart{pluralize}", "{{HealingCoin}} Heals {1} coin{pluralize}", "{{HealingRed}} Heals half a heart", "{{HealingCoin}} Heals 1 coin", "{{HealingRed}}", "{{HealingCoin}}", "↓ {{EmptyHeart}} {1} Health", "↓ {{EmptyCoinHeart}} {1} Coin Heart{pluralize}"}, -- Red HP to Coin Hearts - ["Red to None"] = {"↑ {{Heart}} +{1} Health", "", "↑ {{EmptyHeart}} +{1} Empty heart container{2}", "", "↓ {{EmptyHeart}} {1} Health", ""}, -- Red HP to None (The Lost) + ["Red to None"] = {"↑ {{Heart}} +{1} Health", "", "↑ {{EmptyHeart}} +{1} Empty heart container{pluralize}", "", "↓ {{EmptyHeart}} {1} Health", ""}, -- Red HP to None (The Lost) } EID.descriptions[languageCode].MCM = { diff --git a/descriptions/ab+/ru.lua b/descriptions/ab+/ru.lua index 26cd1109..17c742d3 100644 --- a/descriptions/ab+/ru.lua +++ b/descriptions/ab+/ru.lua @@ -871,8 +871,12 @@ EID.descriptions[languageCode].transformations={ ---------- MISC ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- TODO: Not Implemented right now... + return text +end EID.descriptions[languageCode].VoidText = "Если поглощён, даёт:" EID.descriptions[languageCode].VoidNames = {"Скорость", "Скорострельность", "Урон", "Дальность", "Скорость снаряда", "Удача"} diff --git a/descriptions/ab+/spa.lua b/descriptions/ab+/spa.lua index ade5ae60..90edeabf 100644 --- a/descriptions/ab+/spa.lua +++ b/descriptions/ab+/spa.lua @@ -868,8 +868,12 @@ EID.descriptions[languageCode].transformations={ } ---------- Misc. text ---------- --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- TODO: Not Implemented right now... + return text +end EID.descriptions[languageCode].VoidText = "Si lo absorbes, ganarás:" EID.descriptions[languageCode].VoidNames = {"de Velocidad {{Speed}}", "de Lágrimas {{Tears}}", "de Daño {{Damage}}", "de Alcance {{Range}}", "de Vel. de tiro {{Shotspeed}}", "de Suerte {{Luck}}"} @@ -922,6 +926,7 @@ EID.descriptions[languageCode].PickupNames = { EID.descriptions[languageCode].RedToX = { -- These change "+1 Health" to just "+1 Soul Heart" and etc. + -- These texts are affected by the PluralizeFunction (ab+ file) --haveing a line with "+1" and then another with "+{1}" is a workaround to spanish itself lol ["Red to Soul"] = { diff --git a/descriptions/ab+/uk_ua.lua b/descriptions/ab+/uk_ua.lua index 58ecdc92..383a7542 100644 --- a/descriptions/ab+/uk_ua.lua +++ b/descriptions/ab+/uk_ua.lua @@ -901,9 +901,12 @@ EID.descriptions[languageCode].transformations={ ---------- MISC ---------- - --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- TODO: Not Implemented right now... + return text +end EID.descriptions[languageCode].VoidText = "При поглинанні дає:" -- {1} will become the number text (like "{1} Tears up" -> "+0.5 Tears up") diff --git a/descriptions/ab+/zh_cn.lua b/descriptions/ab+/zh_cn.lua index 47ada525..88b4133d 100644 --- a/descriptions/ab+/zh_cn.lua +++ b/descriptions/ab+/zh_cn.lua @@ -1087,9 +1087,12 @@ EID.descriptions[languageCode].transformations={ ---------- MISC ---------- - --- This string will be appended to certain words (like pickup names in glitched item descriptions) to pluralize them, make it "" to not pluralize -EID.descriptions[languageCode].Pluralize = "" +-- a function that will get applied onto specific descriptions (glitched items, Abyss locusts,...) to pluralize them +-- Each language can do their own algorithm to modify the given text to their needs +EID.descriptions[languageCode].PluralizeFunction = function(text, amount) + -- TODO: Not Implemented right now... + return text +end EID.descriptions[languageCode].VoidText = "若吸收, 则获得:" -- {1} will become the number text (like "{1} Tears up" -> "+0.5 Tears up") @@ -1110,6 +1113,7 @@ EID.descriptions[languageCode].SingleUseInfo = "{{Warning}} 一次性 {{Warning} -- Find/replace pairs for changing "+1 Health" to "+1 Soul Heart" for soul health characters, or nothing at all for The Lost -- {1} = number of hearts, {2} = plural character +-- These texts are affected by the PluralizeFunction (ab+ file) -- If having a simple plural character doesn't work for your language, you could just include an extra string pair to catch plural lines EID.descriptions[languageCode].RedToX = { -- These change "+1 Health" to just "+1 Soul Heart" and etc. diff --git a/descriptions/rep/cs_cz.lua b/descriptions/rep/cs_cz.lua index 56d622f8..74032653 100644 --- a/descriptions/rep/cs_cz.lua +++ b/descriptions/rep/cs_cz.lua @@ -1115,11 +1115,12 @@ EID.descriptions[languageCode].horsepills={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info + -- These texts are affected by the PluralizeFunction (ab+ file) AddBlackHearts = "{{BlackHeart}} {1} Černé Srdce", - AddBombs = "{{Bomb}} {1} Bomba", + AddBombs = "{{Bomb}} {1} Bomb{plural_ay}", AddCoins = "{{Coin}} {1} Mince", AddHearts = "Vyéčí {{Heart}} {1} Červené Srdce", - AddKeys = "{{Key}} {1} Klíč", + AddKeys = "{{Key}} {1} Klíč{plural_e}", AddMaxHearts = "{{EmptyHeart}} {1} Místo pro srdce", AddSoulHearts = "{{SoulHeart}} {1} Duševní Srdce", diff --git a/descriptions/rep/de.lua b/descriptions/rep/de.lua index 3e697767..750370a0 100644 --- a/descriptions/rep/de.lua +++ b/descriptions/rep/de.lua @@ -692,8 +692,7 @@ EID.descriptions[languageCode].bookOfVirtuesWisps = { ---------- Abyss Locust description parts ---------- EID.descriptions[languageCode].AbyssTexts = { -- values inside {} brackets will be replaced with text parts below - -- As the last step, {pluralize} will be replaced with the "Pluralize" value. - -- The placeholder therefore can be used in all parts that make up the abyss locust descriptions + -- Abyss texts are affected by the PluralizeFunction (ab+ file) InfoText = "Eine {size}{speed}Heuschrecke ({dmg})", InfoTextPlural = "{amount} {size}{speed}Heuschrecken ({dmg})", -- Can be used by translators to provide a pluralized version of the InfoText Chance = " ({1}% Chance)", -- {1} will be replaced with the chance @@ -1209,13 +1208,14 @@ EID.descriptions[languageCode].horsepills={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info - AddBlackHearts = "{{BlackHeart}} {1} Schwarzes Herz", - AddBombs = "{{Bomb}} {1} Bombe", - AddCoins = "{{Coin}} {1} Münze", - AddHearts = "Heilt {{Heart}} {1} Herz", + -- These texts are affected by the PluralizeFunction (ab+ file) + AddBlackHearts = "{{BlackHeart}} {1} Schwarzes Herz{plural_en}", + AddBombs = "{{Bomb}} {1} Bombe{plural_n}", + AddCoins = "{{Coin}} {1} Münze{plural_n}", + AddHearts = "Heilt {{Heart}} {1} Herz{plural_en}", AddKeys = "{{Key}} {1} Schlüssel", AddMaxHearts = "{{EmptyHeart}} {1} Herz-Container", - AddSoulHearts = "{{SoulHeart}} {1} Seelenherz", + AddSoulHearts = "{{SoulHeart}} {1} Seelenherz{plural_en}", -- Cache Flag names cacheFlagStart = "Kann beeinflussen ", diff --git a/descriptions/rep/en_us.lua b/descriptions/rep/en_us.lua index 7a178c03..ad8617ec 100644 --- a/descriptions/rep/en_us.lua +++ b/descriptions/rep/en_us.lua @@ -651,7 +651,7 @@ EID.descriptions[languageCode].bookOfVirtuesWisps = { ---------- Abyss Locust description parts ---------- EID.descriptions[languageCode].AbyssTexts = { -- values inside {} brackets will be replaced with text parts below - -- As the last step, {pluralize} will be replaced with the "Pluralize" value. + -- Abyss texts are affected by the PluralizeFunction (ab+ file) -- The placeholder therefore can be used in all parts that make up the abyss locust descriptions InfoText = "{amount} {size}{speed}locust{pluralize} ({dmg})", InfoTextPlural = nil, -- Can be used by translators to provide a pluralized version of the InfoText @@ -1313,13 +1313,14 @@ EID.descriptions[languageCode].birthright ={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info - AddBlackHearts = "{{BlackHeart}} {1} Black Heart", - AddBombs = "{{Bomb}} {1} Bomb", - AddCoins = "{{Coin}} {1} Coin", - AddHearts = "{{HealingRed}} Heals {1} heart", - AddKeys = "{{Key}} {1} Key", - AddMaxHearts = "{{EmptyHeart}} {1} Heart container", - AddSoulHearts = "{{SoulHeart}} {1} Soul Heart", + -- These texts are affected by the PluralizeFunction (ab+ file) + AddBlackHearts = "{{BlackHeart}} {1} Black Heart{pluralize}", + AddBombs = "{{Bomb}} {1} Bomb{pluralize}", + AddCoins = "{{Coin}} {1} Coin{pluralize}", + AddHearts = "{{HealingRed}} Heals {1} heart{pluralize}", + AddKeys = "{{Key}} {1} Key{pluralize}", + AddMaxHearts = "{{EmptyHeart}} {1} Heart container{pluralize}", + AddSoulHearts = "{{SoulHeart}} {1} Soul Heart{pluralize}", -- Cache Flag names cacheFlagStart = "May affect ", diff --git a/descriptions/rep/fr.lua b/descriptions/rep/fr.lua index ab9d4a62..6cdba239 100644 --- a/descriptions/rep/fr.lua +++ b/descriptions/rep/fr.lua @@ -750,7 +750,7 @@ EID.descriptions[languageCode].bookOfVirtuesWisps = { ---------- Abyss Locust description parts ---------- EID.descriptions[languageCode].AbyssTexts = { -- values inside {} brackets will be replaced with text parts below - -- As the last step, {pluralize} will be replaced with the "Pluralize" value. + -- Abyss texts are affected by the PluralizeFunction (ab+ file) -- The placeholder therefore can be used in all parts that make up the abyss locust descriptions InfoText = "{amount} {size} locuste{pluralize} {speed} ({dmg})", -- values inside {} brackets will be replaced with text parts below InfoTextPlural = "{amount} {size} locustes {speed} ({dmg})", -- Will be shown when more than 1 locust will spawn @@ -1376,13 +1376,14 @@ EID.descriptions[languageCode].horsepills={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info - AddBlackHearts = "{{BlackHeart}} {1} cœur(s) noir(s)", - AddBombs = "{{Bomb}} {1} bombe(s)", - AddCoins = "{{Coin}} {1} pièce(s)", - AddHearts = "Heals {{Heart}} {1} cœur(s) rouge(s)", - AddKeys = "{{Key}} {1} clé(s)", - AddMaxHearts = "{{EmptyHeart}} {1} réceptacle(s) de cœur", - AddSoulHearts = "{{SoulHeart}} {1} cœur(s) d'âme", + -- These texts are affected by the PluralizeFunction (ab+ file) + AddBlackHearts = "{{BlackHeart}} {1} cœur{pluralize} noir{pluralize}", + AddBombs = "{{Bomb}} {1} bombe{pluralize}", + AddCoins = "{{Coin}} {1} pièce{pluralize}", + AddHearts = "Heals {{Heart}} {1} cœur{pluralize} rouge{pluralize}", + AddKeys = "{{Key}} {1} clé{pluralize}", + AddMaxHearts = "{{EmptyHeart}} {1} réceptacle{pluralize} de cœur", + AddSoulHearts = "{{SoulHeart}} {1} cœur{pluralize} d'âme", -- Cache Flag names cacheFlagStart = "Peut influencer ", diff --git a/descriptions/rep/it.lua b/descriptions/rep/it.lua index 94a2b1be..c1d24500 100644 --- a/descriptions/rep/it.lua +++ b/descriptions/rep/it.lua @@ -653,7 +653,7 @@ EID.descriptions[languageCode].bookOfVirtuesWisps = { ---------- Abyss Locust description parts ---------- EID.descriptions[languageCode].AbyssTexts = { -- values inside {} brackets will be replaced with text parts below - -- As the last step, {pluralize} will be replaced with the "Pluralize" value. + -- Abyss texts are affected by the PluralizeFunction (ab+ file) -- The placeholder therefore can be used in all parts that make up the abyss locust descriptions InfoText = "{amount} {size} locusta/e {speed} ({dmg})", InfoTextPlural = "{amount} {size} locusta/e {speed} ({dmg})", -- Can be used by translators to provide a pluralized version of the InfoText @@ -1315,6 +1315,7 @@ EID.descriptions[languageCode].birthright ={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info + -- These texts are affected by the PluralizeFunction (ab+ file) AddBlackHearts = "{{BlackHeart}} {1} Cuore/i Nero/i", AddBombs = "{{Bomb}} {1} Bomba/e", AddCoins = "{{Coin}} {1} Moneta/e", diff --git a/descriptions/rep/ja_jp.lua b/descriptions/rep/ja_jp.lua index 0c96b021..f4ed1668 100644 --- a/descriptions/rep/ja_jp.lua +++ b/descriptions/rep/ja_jp.lua @@ -1202,6 +1202,7 @@ EID.descriptions[languageCode].birthright ={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info + -- These texts are affected by the PluralizeFunction (ab+ file) AddBlackHearts = "{1} 黒ハート", AddBombs = "{1} 爆弾", AddCoins = "{1} コイン", diff --git a/descriptions/rep/ko_kr.lua b/descriptions/rep/ko_kr.lua index cd79a975..fcd5e2e3 100644 --- a/descriptions/rep/ko_kr.lua +++ b/descriptions/rep/ko_kr.lua @@ -749,7 +749,7 @@ EID.descriptions[languageCode].bookOfVirtuesWisps = { -- Special Locust effects when Item was eaten by Abyss EID.descriptions[languageCode].AbyssTexts = { -- values inside {} brackets will be replaced with text parts below - -- As the last step, {pluralize} will be replaced with the "Pluralize" value. + -- Abyss texts are affected by the PluralizeFunction (ab+ file) -- The placeholder therefore can be used in all parts that make up the abyss locust descriptions InfoText = "{speed}{size}파리 x{amount} ({dmg})", InfoTextPlural = nil, -- Can be used by translators to provide a pluralized version of the InfoText @@ -1305,6 +1305,7 @@ EID.descriptions[languageCode].horsepills={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info + -- These texts are affected by the PluralizeFunction (ab+ file) AddBlackHearts = "{{BlackHeart}}블랙하트 {1}", AddBombs = "{{Bomb}}폭탄 {1}", AddCoins = "{{Coin}}동전 {1}", diff --git a/descriptions/rep/pt_br.lua b/descriptions/rep/pt_br.lua index 4c078039..b12025ed 100644 --- a/descriptions/rep/pt_br.lua +++ b/descriptions/rep/pt_br.lua @@ -995,6 +995,7 @@ EID.descriptions[languageCode].horsepills={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info + -- These texts are affected by the PluralizeFunction (ab+ file) AddBlackHearts = "{{BlackHeart}} {1} Coração Negro", AddBombs = "{{Bomb}} {1} Bomba", AddCoins = "{{Coin}} {1} Moeda", diff --git a/descriptions/rep/ro_ro.lua b/descriptions/rep/ro_ro.lua index d71f2e0b..40a62ad9 100644 --- a/descriptions/rep/ro_ro.lua +++ b/descriptions/rep/ro_ro.lua @@ -1194,6 +1194,7 @@ EID.descriptions[languageCode].birthright ={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info + -- These texts are affected by the PluralizeFunction (ab+ file) AddBlackHearts = "{{BlackHeart}} {1} Black Heart", AddBombs = "{{Bomb}} {1} Bomb", AddCoins = "{{Coin}} {1} Coin", diff --git a/descriptions/rep/ru.lua b/descriptions/rep/ru.lua index 237c2479..ad59adce 100644 --- a/descriptions/rep/ru.lua +++ b/descriptions/rep/ru.lua @@ -997,6 +997,7 @@ EID.descriptions[languageCode].horsepills={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info + -- These texts are affected by the PluralizeFunction (ab+ file) AddBlackHearts = "{{BlackHeart}} {1} чёрных сердец", AddBombs = "{{Bomb}} {1} бомб", AddCoins = "{{Coin}} {1} монет", diff --git a/descriptions/rep/spa.lua b/descriptions/rep/spa.lua index 0c0eb142..9e832190 100644 --- a/descriptions/rep/spa.lua +++ b/descriptions/rep/spa.lua @@ -1037,6 +1037,7 @@ EID.descriptions[languageCode].horsepills={ ---------- Glitched Items Descriptions ---------- EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info + -- These texts are affected by the PluralizeFunction (ab+ file) AddBlackHearts = "{{BlackHeart}} {1} Corazón/zones negro/s", AddBombs = "{{Bomb}} {1} Bomba/s", AddCoins = "{{Coin}} {1} Moneda/s", diff --git a/descriptions/rep/uk_ua.lua b/descriptions/rep/uk_ua.lua index c42b5fd5..04624894 100644 --- a/descriptions/rep/uk_ua.lua +++ b/descriptions/rep/uk_ua.lua @@ -1100,6 +1100,7 @@ EID.descriptions[languageCode].horsepills={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info + -- These texts are affected by the PluralizeFunction (ab+ file) AddBlackHearts = "{{BlackHeart}} {1} Чорних сердець", AddBombs = "{{Bomb}} {1} бомб", AddCoins = "{{Coin}} {1} монет", diff --git a/descriptions/rep/zh_cn.lua b/descriptions/rep/zh_cn.lua index 11ba5b22..c347f15f 100644 --- a/descriptions/rep/zh_cn.lua +++ b/descriptions/rep/zh_cn.lua @@ -1194,6 +1194,7 @@ EID.descriptions[languageCode].birthright ={ EID.descriptions[languageCode].GlitchedItemText = { -- Item Config info + -- These texts are affected by the PluralizeFunction (ab+ file) AddBlackHearts = "{{BlackHeart}} {1}黑心", AddBombs = "{{Bomb}} {1}炸弹", AddCoins = "{{Coin}} {1}硬币", diff --git a/features/eid_api.lua b/features/eid_api.lua index 84670e08..190fa993 100644 --- a/features/eid_api.lua +++ b/features/eid_api.lua @@ -3199,14 +3199,27 @@ function EID:HasPathToPosition(startPos, endPos) return pathfinderObj:GetPath() ~= nil end +---Applies language specific modifiers that aim to pluralize a text +---@param text string +---@param amount integer +function EID:TryPluralizeString(text, amount) + local func = EID:getDescriptionEntry("PluralizeFunction") + if type(func) == "function" then + return func(text,amount) + end + return text +end + ---Prints a message in both the console and the Log file, to make important messages from EID stand out everywhere ---@param str string function EID:WriteDebugMsg(str) print(str) Isaac.DebugString(str) end + ---Prints an error message in both the console and the Log file, to make important messages from EID stand out everywhere ---@param str string function EID:WriteErrorMsg(str) EID:WriteDebugMsg("EID ERROR: " .. str) -end \ No newline at end of file +end + diff --git a/features/eid_modifiers.lua b/features/eid_modifiers.lua index 612699cb..a4c2688b 100644 --- a/features/eid_modifiers.lua +++ b/features/eid_modifiers.lua @@ -326,18 +326,19 @@ local function HealthUpCallback(descObj) -- find/replace Health Up lines local numHearts = EID.HealthUpData[typeVarSub] or 1 local text = EID:getDescriptionEntry("RedToX", "Red to " .. heartType) - local plural = ""; if numHearts ~= 1 and numHearts ~= -1 then plural = EID:getDescriptionEntry("Pluralize") end local pos = 1 while pos <= #text do -- replace {1} with the number of hearts and {2} with the plural character - local toFind = EID:ReplaceVariableStr(text[pos], {numHearts, plural}) + local toFind = EID:ReplaceVariableStr(text[pos], numHearts) if text[pos + 1] then - local replaceWith = EID:ReplaceVariableStr(text[pos + 1], {numHearts, plural}) + local replaceWith = EID:ReplaceVariableStr(text[pos + 1], numHearts) descObj.Description = EID:SimpleReplace(descObj.Description, tostring(toFind), replaceWith, 1) end pos = pos + 2 end + -- pluralize + descObj.Description = EID:TryPluralizeString(descObj.Description, numHearts) -- remove HealingRed lines entirely for Soul/Black/None health chars descObj.Description = descObj.Description .. "#" -- gsub finds final lines better if the desc ends with a line break @@ -1081,8 +1082,8 @@ if EID.isRepentance then descriptionText = descriptionText .. GetFlagString(2, "TearFlagNames", tearFlags2, procChance1, procChance2, procChance3) descriptionText = descriptionText .. GetFlagString(3, "TearFlagNames", tearFlags3, procChance1, procChance2, procChance3) - local plural = amount > 1 and EID:getDescriptionEntry("Pluralize") or "" - descriptionText = EID:ReplaceVariableStr(descriptionText, "pluralize", plural) + -- pluralize + descriptionText = EID:TryPluralizeString(descriptionText, amount) -- Put everything together EID:appendToDescription(descObj, descriptionText) diff --git a/features/eid_tmtrainer.lua b/features/eid_tmtrainer.lua index 31d0f03c..d80191a0 100644 --- a/features/eid_tmtrainer.lua +++ b/features/eid_tmtrainer.lua @@ -23,19 +23,24 @@ local actions = { [0] = "use_active_item", "add_temporary_effect", "convert_enti local triggers = { [0] = "active", "tear_fire", "enemy_hit", "enemy_kill", "damage_taken", "room_clear", "entity_spawned", "pickup_collected", "chain" } local function entityToName(Type, Variant, plural) - plural = plural or false -- -1 is often used as an "any of this type", even if there's only one of that type, so converting it to 0 can help find names -- the string.format is in case this receives the type/variant as a Lua float local e = string.format("%d",Type) .. "." .. string.format("%d",Variant) local eWithZero = string.gsub(e, "-1", "0") local localizedNames = EID:getDescriptionEntry("GlitchedItemText") - local pluralize = EID:getDescriptionEntry("Pluralize") local name = localizedNames[e] or localizedNames[eWithZero] or EID:GetEntityXMLName(Type, Variant, 0) or e --print out entities with no name yet - if name == e then Isaac.DebugString("No name found for " .. e .. " (could be modded)") - elseif plural then name = name .. pluralize end + if name == e then Isaac.DebugString("No name found for " .. e .. " (could be modded)") end + + -- pluralize Entity name + if plural then + name = name .."{pluralize}" + name = EID:TryPluralizeString(name, 2) + -- remove temporary variable, if language did not replace it + name = EID:ReplaceVariableStr(name, "pluralize", "") + end return name end @@ -54,7 +59,6 @@ function EID:CheckGlitchedItemConfig(id) local localizedNames = EID:getDescriptionEntry("GlitchedItemText") local localizedNamesEnglish = EID:getDescriptionEntryEnglish("GlitchedItemText") - local pluralize = EID:getDescriptionEntry("Pluralize") local attributes = "#" -- Check the base item config for the Hearts/Bombs/Coins/Keys this item adds, @@ -85,9 +89,10 @@ function EID:CheckGlitchedItemConfig(id) local prefix = "↑ " if val > 0 then s = "+" .. s else prefix = "↓ " end attributes = attributes .. prefix .. EID:ReplaceVariableStr(localizedNames[v] or localizedNamesEnglish[v], 1, s) - if val ~= 1 and val ~= -1 then attributes = attributes .. pluralize end attributes = attributes .. "#" end + -- pluralize + attributes = EID:TryPluralizeString(attributes, val) end end