local InputUtils = require("scripts/managers/input/input_utils")

local function readable(text)
    local readable_string = ""
    local tokens = string.split(text, "_")
    for i, token in ipairs(tokens) do
        local first_letter = string.sub(token, 1, 1)
        token = string.format("%s%s", string.upper(first_letter), string.sub(token, 2))
        readable_string = string.trim(string.format("%s %s", readable_string, token))
    end
    return readable_string
end

local localizations = {
    mod_name = {
        en = " Improved Havoc Tags",
        de = " Verbesserte Verwüstung-Markierungen",
        fr = " Étiquettes Dévastation améliorées",
        it = " Etichette Scompiglio Migliorate",
        ko = " 개선된 파괴 태그",
        es = " Etiquetas de Pandemonio mejoradas",
        ["zh-cn"] = " 更好的浩劫词条显示",
        ["zh-tw"] = " 改善浩劫詞條顯示方式",
        ru = " Хавок - Улучшенные теги",
        ja = " 改良されたハヴォックタグ",
        pl = " Ulepszone oznaczenia Spustoszenie",
        ["pt-br"] = " Marcadores de Devastação Melhorados",
    },
    mod_description = {
        en = "Recolors certain Havoc modifiers to make them easier to identify at a glance in Party Finder. Please reload your mods or restart your game after changing colors!",
        de = "Färbt bestimmte Verwüstung-Modifikatoren um, damit sie im Gruppenfinder schneller erkennbar sind. Bitte die Mods neu laden oder das Spiel neustarten, nachdem Farben geändert wurden!",
        fr = "Recolorie certains modificateurs Dévastation pour les rendre plus faciles à identifier dans le Recherche de Groupe. Rechargez vos mods ou redémarrez le jeu après avoir changé les couleurs !",
        it = "Ricolorare alcuni modificatori Scompiglio per renderli più facili da identificare nella Ricerca Gruppo. Ricarica i mod o riavvia il gioco dopo aver cambiato i colori!",
        ko = "파티 찾기에서 파괴 수식어를 한 눈에 알아보기 쉽도록 색상을 변경합니다. 색상 변경 후 모드를 다시 불러오거나 게임을 재시작하세요!",
        es = "Cambia el color de ciertos modificadores de Pandemonio para facilitar su identificación en el Buscador de Grupo. ¡Recarga los mods o reinicia el juego después de cambiar los colores!",
        ["zh-cn"] = "重新着色浩劫词条，使其在寻找队伍中更一目了然。修改颜色后请重新加载模组或重启游戏！",
        ["zh-tw"] = "重新描述浩劫詞條，使其在尋找隊伍中更一目了然。修改顏色後請重新載入模組或重啟遊戲！",
        ru = "ImprovedHavocTags - Перекрашивает некоторые модификаторы Хавока, чтобы их было легче определить с первого взгляда в поисковике команды. После смены цвета перезагрузите моды или игру!",
        ja = "特定のハヴォック修飾子の色を変更し、パーティーファインダーで一目で判別しやすくします。色を変更した後は、MODを再読み込みするかゲームを再起動してください！",
        pl = "Zmienia kolory niektórych modyfikatorów Spustoszenie, aby łatwiej je rozpoznać w Wyszukiwarce Drużyn. Po zmianie kolorów przeładuj mody lub zrestartuj grę!",
        ["pt-br"] = "Altera as cores de certos modificadores da Devastação para facilitar sua identificação no Localizador de Grupo. Recarregue os mods ou reinicie o jogo após alterar as cores!",
    },
    increased_difficulty = {
        en = Localize("loc_havoc_increased_difficulty_name"),
        de = Localize("loc_havoc_increased_difficulty_name"),
        fr = Localize("loc_havoc_increased_difficulty_name"),
        it = Localize("loc_havoc_increased_difficulty_name"),
        ko = Localize("loc_havoc_increased_difficulty_name"),
        es = Localize("loc_havoc_increased_difficulty_name"),
        ["zh-cn"] = Localize("loc_havoc_increased_difficulty_name"),
        ["zh-tw"] = Localize("loc_havoc_increased_difficulty_name"),
        ru = Localize("loc_havoc_increased_difficulty_name"),
        ja = Localize("loc_havoc_increased_difficulty_name"),
        pl = Localize("loc_havoc_increased_difficulty_name"),
        ["pt-br"] = Localize("loc_havoc_increased_difficulty_name"),
    },
    highest_difficulty = {
        en = Localize("loc_havoc_highest_difficulty_name"),
        de = Localize("loc_havoc_highest_difficulty_name"),
        fr = Localize("loc_havoc_highest_difficulty_name"),
        it = Localize("loc_havoc_highest_difficulty_name"),
        ko = Localize("loc_havoc_highest_difficulty_name"),
        es = Localize("loc_havoc_highest_difficulty_name"),
        ["zh-cn"] = Localize("loc_havoc_highest_difficulty_name"),
        ["zh-tw"] = Localize("loc_havoc_highest_difficulty_name"),
        ru = Localize("loc_havoc_highest_difficulty_name"),
        ja = Localize("loc_havoc_highest_difficulty_name"),
        pl = Localize("loc_havoc_highest_difficulty_name"),
        ["pt-br"] = Localize("loc_havoc_highest_difficulty_name"),
    },
    bolstering_enemies = {
        en = Localize("loc_havoc_bolstering_enemies_name"),
        de = Localize("loc_havoc_bolstering_enemies_name"),
        fr = Localize("loc_havoc_bolstering_enemies_name"),
        it = Localize("loc_havoc_bolstering_enemies_name"),
        ko = Localize("loc_havoc_bolstering_enemies_name"),
        es = Localize("loc_havoc_bolstering_enemies_name"),
        ["zh-cn"] = Localize("loc_havoc_bolstering_enemies_name"),
        ["zh-tw"] = "蠻橫敵軍(加防)",
        ru = Localize("loc_havoc_bolstering_enemies_name"),
        ja = Localize("loc_havoc_bolstering_enemies_name"),
        pl = Localize("loc_havoc_bolstering_enemies_name"),
        ["pt-br"] = Localize("loc_havoc_bolstering_enemies_name"),
    },
    encroaching_garden = {
        en = "Marked Healers",
        de = "Markierte Heiler",
        fr = "Soigneurs Marqués",
        it = "Guaritori Segnati",
        ko = "표식된 치유사",
        es = "Sanadores Marcados",
        ["zh-cn"] = "瘟疫袭来(回血)",
        ["zh-tw"] = "蔓生花園(回血)",
        ru = "Помеченные целители",
        ja = "刻印のヒーラー",
        pl = "Naznaczeni Uzdrowiciele",
        ["pt-br"] = "Curandeiros Marcados",
    },
    encroaching_garden_tooltip = {
        en = "Originally called \"The Encroaching Garden\"",
        de = "Ursprünglich genannt \"Der überwucherte Garten\"",
        fr = "Initialement appelé \"Un havre envahissant\"",
        it = "In origine chiamato \"Il giardino invaso\"",
        ko = "원래 명칭 \"침략의 정원\"",
        es = "Originalmente llamado \"El jardín invasor\"",
        ["zh-cn"] = "原\"瘟疫袭来」\"",
        ["zh-tw"] = "原「蔓生花園」",
        ru = "Первоначально назывался \"Расползающийся сад\"",
        ja = "旧称「侵食の庭園」",
        pl = "Pierwotna nazwa \"Wdzierający się ogród\"",
        ["pt-br"] = "Originalmente chamado \"Jardim Invasor\"",
    },
    enraged = {
        en = "Enraging Elites",
        de = "Wütende Eliten",
        fr = "Élites Enragées",
        it = "Élite Furente",
        ko = "분노한 정예병",
        es = "Élites Enfurecidos",
        ["zh-cn"] = "最后的钟声(狂暴)",
        ["zh-tw"] = "背水一戰(狂暴)",
        ru = "Разъярённая элита",
        ja = "怒れる精鋭",
        pl = "Wściekła Elita",
        ["pt-br"] = "Elites Enfurecidos",
    },
    enraged_tooltip = {
        en = "Originally called \"The Final Toll\"",
        de = "Ursprünglich genannt \"Der ultimative Preis\"",
        fr = "Initialement appelé \"Dernier souffle\"",
        it = "In origine chiamato \"L'ultimo rintocco\"",
        ko = "원래 명칭 \"마지막 고비\"",
        es = "Originalmente llamado \"El último estrago\"",
        ["zh-cn"] = "原\"最后的钟声\"",
        ["zh-tw"] = "原「背水一戰」",
        ru = "Первоначально назывался \"Последняя расплата\"",
        ja = "旧称「最後の抗戦」",
        pl = "Pierwotna nazwa \"Ostatni dzwon\"",
        ["pt-br"] = "Originalmente chamado \"Último Tributo\"",
    },
    chaos_ritual = {
        en = Localize("loc_havoc_chaos_ritual_name"),
        de = Localize("loc_havoc_chaos_ritual_name"),
        fr = Localize("loc_havoc_chaos_ritual_name"),
        it = Localize("loc_havoc_chaos_ritual_name"),
        ko = Localize("loc_havoc_chaos_ritual_name"),
        es = Localize("loc_havoc_chaos_ritual_name"),
        ["zh-cn"] = Localize("loc_havoc_chaos_ritual_name"),
        ["zh-tw"] = "萬惡儀式(宿主)",
        ru = Localize("loc_havoc_chaos_ritual_name"),
        ja = Localize("loc_havoc_chaos_ritual_name"),
        pl = Localize("loc_havoc_chaos_ritual_name"),
        ["pt-br"] = Localize("loc_havoc_chaos_ritual_name"),
    },
    armored_infected = {
        en = Localize("loc_havoc_armored_infected_name"),
        de = Localize("loc_havoc_armored_infected_name"),
        fr = Localize("loc_havoc_armored_infected_name"),
        it = Localize("loc_havoc_armored_infected_name"),
        ko = Localize("loc_havoc_armored_infected_name"),
        es = Localize("loc_havoc_armored_infected_name"),
        ["zh-cn"] = Localize("loc_havoc_armored_infected_name"),
        ["zh-tw"] = "莫比亞21師(防彈)",
        ru = Localize("loc_havoc_armored_infected_name"),
        ja = Localize("loc_havoc_armored_infected_name"),
        pl = Localize("loc_havoc_armored_infected_name"),
        ["pt-br"] = Localize("loc_havoc_armored_infected_name"),
    },
    enemies_corrupted = {
        en = Localize("loc_havoc_enemies_corrupted_name"),
        de = Localize("loc_havoc_enemies_corrupted_name"),
        fr = Localize("loc_havoc_enemies_corrupted_name"),
        it = Localize("loc_havoc_enemies_corrupted_name"),
        ko = Localize("loc_havoc_enemies_corrupted_name"),
        es = Localize("loc_havoc_enemies_corrupted_name"),
        ["zh-cn"] = Localize("loc_havoc_enemies_corrupted_name"),
        ["zh-tw"] = "疫病蔓延(腐化)",
        ru = Localize("loc_havoc_enemies_corrupted_name"),
        ja = Localize("loc_havoc_enemies_corrupted_name"),
        pl = Localize("loc_havoc_enemies_corrupted_name"),
        ["pt-br"] = Localize("loc_havoc_enemies_corrupted_name"),
    },
    enemies_parasite_headshot = {
        en = Localize("loc_havoc_enemies_parasite_headshot_name"),
        de = Localize("loc_havoc_enemies_parasite_headshot_name"),
        fr = Localize("loc_havoc_enemies_parasite_headshot_name"),
        it = Localize("loc_havoc_enemies_parasite_headshot_name"),
        ko = Localize("loc_havoc_enemies_parasite_headshot_name"),
        es = Localize("loc_havoc_enemies_parasite_headshot_name"),
        ["zh-cn"] = Localize("loc_havoc_enemies_parasite_headshot_name"),
        ["zh-tw"] = Localize("loc_havoc_enemies_parasite_headshot_name"),
        ru = Localize("loc_havoc_enemies_parasite_headshot_name"),
        ja = Localize("loc_havoc_enemies_parasite_headshot_name"),
        pl = Localize("loc_havoc_enemies_parasite_headshot_name"),
        ["pt-br"] = Localize("loc_havoc_enemies_parasite_headshot_name"),
    },
    tougher_skin = {
        en = Localize("loc_havoc_tougher_skin_name"),
        de = Localize("loc_havoc_tougher_skin_name"),
        fr = Localize("loc_havoc_tougher_skin_name"),
        it = Localize("loc_havoc_tougher_skin_name"),
        ko = Localize("loc_havoc_tougher_skin_name"),
        es = Localize("loc_havoc_tougher_skin_name"),
        ["zh-cn"] = Localize("loc_havoc_tougher_skin_name"),
        ["zh-tw"] = Localize("loc_havoc_tougher_skin_name"),
        ru = Localize("loc_havoc_tougher_skin_name"),
        ja = Localize("loc_havoc_tougher_skin_name"),
        pl = Localize("loc_havoc_tougher_skin_name"),
        ["pt-br"] = Localize("loc_havoc_tougher_skin_name"),
    },
	rotten_armor = {
        en = Localize("loc_havoc_rotten_armor_name"),
        de = Localize("loc_havoc_rotten_armor_name"),
        fr = Localize("loc_havoc_rotten_armor_name"),
        it = Localize("loc_havoc_rotten_armor_name"),
        ko = Localize("loc_havoc_rotten_armor_name"),
        es = Localize("loc_havoc_rotten_armor_name"),
        ["zh-cn"] = Localize("loc_havoc_rotten_armor_name"),
        ["zh-tw"] = Localize("loc_havoc_rotten_armor_name"),
        ru = Localize("loc_havoc_rotten_armor_name"),
        ja = Localize("loc_havoc_rotten_armor_name"),
        pl = Localize("loc_havoc_rotten_armor_name"),
        ["pt-br"] = Localize("loc_havoc_rotten_armor_name"),
    },
	stimmed_minions = {
        en = Localize("loc_havoc_stimmed_minions_name"),
        de = Localize("loc_havoc_stimmed_minions_name"),
        fr = Localize("loc_havoc_stimmed_minions_name"),
        it = Localize("loc_havoc_stimmed_minions_name"),
        ko = Localize("loc_havoc_stimmed_minions_name"),
        es = Localize("loc_havoc_stimmed_minions_name"),
        ["zh-cn"] = Localize("loc_havoc_stimmed_minions_name"),
        ["zh-tw"] = Localize("loc_havoc_stimmed_minions_name"),
        ru = Localize("loc_havoc_stimmed_minions_name"),
        ja = Localize("loc_havoc_stimmed_minions_name"),
        pl = Localize("loc_havoc_stimmed_minions_name"),
        ["pt-br"] = Localize("loc_havoc_stimmed_minions_name"),
    },
    ember = {
        en = Localize("loc_circumstance_ember_title"),
        de = Localize("loc_circumstance_ember_title"),
        fr = Localize("loc_circumstance_ember_title"),
        it = Localize("loc_circumstance_ember_title"),
        ko = Localize("loc_circumstance_ember_title"),
        es = Localize("loc_circumstance_ember_title"),
        ["zh-cn"] = Localize("loc_circumstance_ember_title"),
        ["zh-tw"] = Localize("loc_circumstance_ember_title"),
        ru = Localize("loc_circumstance_ember_title"),
        ja = Localize("loc_circumstance_ember_title"),
        pl = Localize("loc_circumstance_ember_title"),
        ["pt-br"] = Localize("loc_circumstance_ember_title"),
    },
    toxic_gas = {
        en = Localize("loc_circumstance_toxic_gas_title"),
        de = Localize("loc_circumstance_toxic_gas_title"),
        fr = Localize("loc_circumstance_toxic_gas_title"),
        it = Localize("loc_circumstance_toxic_gas_title"),
        ko = Localize("loc_circumstance_toxic_gas_title"),
        es = Localize("loc_circumstance_toxic_gas_title"),
        ["zh-cn"] = Localize("loc_circumstance_toxic_gas_title"),
        ["zh-tw"] = Localize("loc_circumstance_toxic_gas_title"),
        ru = Localize("loc_circumstance_toxic_gas_title"),
        ja = Localize("loc_circumstance_toxic_gas_title"),
        pl = Localize("loc_circumstance_toxic_gas_title"),
        ["pt-br"] = Localize("loc_circumstance_toxic_gas_title"),
    },
    toxic_gas_cultist_grenadier = {
        en = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        de = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        fr = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        it = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        ko = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        es = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        ["zh-cn"] = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        ["zh-tw"] = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        ru = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        ja = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        pl = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
        ["pt-br"] = Localize("loc_circumstance_toxic_gas_cultist_grenadier_title"),
    },
    ventilation_purge = {
        en = Localize("loc_circumstance_ventilation_purge_title"),
        de = Localize("loc_circumstance_ventilation_purge_title"),
        fr = Localize("loc_circumstance_ventilation_purge_title"),
        it = Localize("loc_circumstance_ventilation_purge_title"),
        ko = Localize("loc_circumstance_ventilation_purge_title"),
        es = Localize("loc_circumstance_ventilation_purge_title"),
        ["zh-cn"] = Localize("loc_circumstance_ventilation_purge_title"),
        ["zh-tw"] = Localize("loc_circumstance_ventilation_purge_title"),
        ru = Localize("loc_circumstance_ventilation_purge_title"),
        ja = Localize("loc_circumstance_ventilation_purge_title"),
        pl = Localize("loc_circumstance_ventilation_purge_title"),
        ["pt-br"] = Localize("loc_circumstance_ventilation_purge_title"),
    },
    ventilation_purge_with_snipers = {
        en = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        de = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        fr = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        it = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        ko = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        es = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        ["zh-cn"] = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        ["zh-tw"] = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        ru = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        ja = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        pl = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
        ["pt-br"] = Localize("loc_circumstance_ventilation_purge_with_snipers_title"),
    },
    darkness = {
        en = Localize("loc_circumstance_darkness_title"),
        de = Localize("loc_circumstance_darkness_title"),
        fr = Localize("loc_circumstance_darkness_title"),
        it = Localize("loc_circumstance_darkness_title"),
        ko = Localize("loc_circumstance_darkness_title"),
        es = Localize("loc_circumstance_darkness_title"),
        ["zh-cn"] = Localize("loc_circumstance_darkness_title"),
        ["zh-tw"] = Localize("loc_circumstance_darkness_title"),
        ru = Localize("loc_circumstance_darkness_title"),
        ja = Localize("loc_circumstance_darkness_title"),
        pl = Localize("loc_circumstance_darkness_title"),
        ["pt-br"] = Localize("loc_circumstance_darkness_title"),
    },
    darkness_hunting_grounds = {
        en = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        de = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        fr = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        it = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        ko = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        es = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        ["zh-cn"] = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        ["zh-tw"] = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        ru = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        ja = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        pl = Localize("loc_circumstance_darkness_hunting_grounds_title"),
        ["pt-br"] = Localize("loc_circumstance_darkness_hunting_grounds_title"),
    },
}

for i, color_name in ipairs(Color.list) do
    local color_values = Color[color_name](255, true)
    local readable_name = readable(color_name)
    localizations["color_option_" .. color_name] = {
        en = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
        de = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
        fr = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
        it = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
        ko = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
        es = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
        ["zh-cn"] = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
        ["zh-tw"] = string.format("{#color(%d,%d,%d)}%s{#reset()}",
            color_values[2], color_values[3], color_values[4],
            readable_name),
        ru = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
        ja = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
        pl = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
        ["pt-br"] = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
            color_values[2], color_values[3], color_values[4], 
            readable_name),
    }
end

local color_names = Color.list
for i, color_name in ipairs(color_names) do
    local color_values = Color[color_name](255, true)
    local readable_name = readable(color_name)
    local text = string.format("{#color(%d,%d,%d)}%s{#reset()}", 
        color_values[2], color_values[3], color_values[4], 
        readable_name)
    localizations[color_name] = {
        en = text,
        de = text,
        fr = text,
        it = text,
        ko = text,
        es = text,
        ["zh-cn"] = text,
        ["zh-tw"] = text,
        ru = text,
        ja = text,
        pl = text,
        ["pt-br"] = text,
    }
end

return localizations