local Breeds = require("scripts/settings/breed/breeds")

localization = {
    -- Mod Info
    mod_description = {
        en = "For my Beloved!",
        ["zh-cn"] = "可以选择主动释放的大脑爆裂（捏头）只能锁定哪些敌人，注意这些设置不影响动能剥皮天赋\n建议只开启BOSS、精英、专家、远程类敌人的筛选条件，关闭杂兵敌人避免锁错目标\n汉化：苏格拉OwO",
    },
    mod_name = {
        en = "Emperor's Guidance",
        ["zh-cn"] = "大脑爆裂（捏头）择优选择",
    },
    enable_tooltip = {
        en = "Enable/Disable all enemies in this group.",
        ["zh-cn"] = "启用/禁用此组中的所有敌人",
    },
    visibility_tooltip = {
        en = "Show/hide this group. Does not impact settings.",
        ["zh-cn"] = "显示/隐藏此组，不影响设置",
    },
    -- Global Settings
    global_settings = {
        en = "Global Settings",
        ["zh-cn"] = "全局设置",
    },
    mod_enabled = {
        en = "Enable/Disable Mod",
        ["zh-cn"] = "模组启停",
    },
    mod_enable_toggle = {
        en = "Enable/Disable Mod (Toggle)",
        ["zh-cn"] = "切换模组启停",
    },
    mod_enable_verbose = {
        en = "Notify on Mod Enabled/Disabled",
        ["zh-cn"] = "模组启停状态通知",
    },
    -- Filter Settings
    filter_settings = {
        en = "Filter Settings",
        ["zh-cn"] = "筛设置",
    },
    filter_primary = {
        en = "Apply Filter to Primary",
        ["zh-cn"] = "将筛选条件应用于主要攻击（左键）",
    },
    filter_secondary = {
        en = "Apply Filter to Secondary",
        ["zh-cn"] = "将筛选条件应用于次要攻击（右键）",
    },
    copy_primary_to_secondary = {
        en = "Use Primary Filter for Secondary",
        ["zh-cn"] = "将主要攻击筛选条件应用于次要攻击",
    },
    copy_primary_to_secondary_tooltip = {
        en = "If enabled, secondary fire will use the filter list defined for primary fire, rather than its own unique filter.",
        ["zh-cn"] = "如果启用，次要攻击将使用为主要攻击的筛选列表，而不是其自己的独立筛选条件",
    },
    -- Filter Selection
    filter_select = {
        en = "Filter Selection",
        ["zh-cn"] = "筛选设置",
    },
    filter_select_primary = {
        en = "Primary Fire",
        ["zh-cn"] = "主要攻击（左键）",
    },
    filter_select_secondary = {
        en = "Secondary Fire",
        ["zh-cn"] = "次要攻击（右键）",
    },
    -- Group Names
    boss_group = {
        en = "Bosses",
        ["zh-cn"] = "Boss（除了宿主全启用）",
    },
    elite_group = {
        en = "Elites",
        ["zh-cn"] = "精英（推荐全启用）",
    },
    special_group = {
        en = "Specials",
        ["zh-cn"] = "专家（推荐全启用）",
    },
    fodder_group = {
        en = "Fodder",
        ["zh-cn"] = "杂兵（只启用远程即可）",
    },
    -- Group Toggles
    global_group_toggle = {
        en = "ENABLE/DISABLE ALL",
        ["zh-cn"] = "启用/禁用全部",  
    },
    boss_group_toggle = {
        en = "ENABLE/DISABLE BOSSES",
        ["zh-cn"] = "启用/禁用Boss",
    },
    elite_group_toggle = {
        en = "ENABLE/DISABLE ELITES",
        ["zh-cn"] = "启用/禁用精英",
    },
    special_group_toggle = {
        en = "ENABLE/DISABLE SPECIALS",
        ["zh-cn"] = "启用/禁用专家",
    },
    fodder_group_toggle = {
        en = "ENABLE/DISABLE FODDER",
        ["zh-cn"] = "启用/禁用杂兵",
    }
}

-- MANUAL LOCALIZATION FOR ENEMIES THE GAME LACKS NAMES FOR
local manual = {
    chaos_mutated_poxwalker = {
        en = "Mutated Poxwalker",
        ["zh-cn"] = "变异瘟疫行尸（杂兵）"
    },
    chaos_lesser_mutated_poxwalker = {
        en = "Lesser Mutated Poxwalker",
        ["zh-cn"] = "次级变异瘟疫行尸（杂兵）"
    }
}

-- SEMI-AUTOMATED SUFFIX LOCALIZATION FOR "MUTATOR" ENEMIES
local en_suffix    = " (Variant)"
local zh_tw_suffix = "（變體）"
local zh_cn_suffix = "（群体突变）"

--------------------------------------------------------------------------
-- PLEASE DO NOT EDIT BEYOND THIS POINT IF YOU ARE ADDING LOCALIZATIONS --
--------------------------------------------------------------------------

local manual_localization = {
    chaos_mutated_poxwalker = true,
    chaos_lesser_mutated_poxwalker = true
}

-- Automated localization for enemy names
for breed_name, breed in pairs(Breeds) do
	if breed.tags.minion and not breed.tags.companion then
		local display_name = Localize(breed.display_name)
        local skip = false         -- Unlocalized, do not add to localization
        local special_case = false -- Unlocalized, add manual localization
        if not display_name or string.find(display_name, "unlocalized") then
            -- Locate closest match for mutator enemies
            if string.find(breed_name, "mutator") then
                for alt_breed_name, _ in pairs(Breeds) do
                    if not string.find(alt_breed_name, "mutator") then
                        local base_name = breed_name:gsub("mutator_", "")
                        if string.find(alt_breed_name, base_name, 1, true) then
                            display_name = Localize(Breeds[alt_breed_name].display_name)
                            break
                        end
                    end
                end
            end
            -- Skip items that cannot be localized
            if not display_name or string.find(display_name, "unlocalized") then
                if manual_localization[breed_name] then
                    special_case = true
                end
                skip = true
            end
        end
        if special_case or not skip then
            local primary = breed_name
            --local secondary = breed_name .. "0secondary"
            -- Unlocalized enemies
            if manual_localization[breed_name] then
                localization[primary]   = manual[breed_name]
                --localization[secondary] = manual[breed_name]
            -- Mutator enemies
            elseif string.find(breed_name, "mutator") then
                localization[primary] = {
			        en        = display_name .. en_suffix,
                    ["zh-tw"] = display_name .. zh_tw_suffix,
                    ["zh-cn"] = display_name .. zh_cn_suffix
                }
                --localization[secondary] = {
                --    en        = display_name .. en_suffix,
                --    ["zh-tw"] = display_name .. zh_tw_suffix,
                --    ["zh-cn"] = display_name .. zh_cn_suffix
                --}
            -- Standard enemies
            else
                localization[primary] = {
                    en = display_name
                }
                --localization[secondary] = {
                --    en = display_name
                --}
            end
        end
	end
end

return localization