-- ArenaCore Localization Test Module
-- Simple test commands to verify localization is working

local AC = ArenaCore
if not AC then return end

-- Test command: /aclocaltest
SLASH_ARENACORELOCALTEST1 = "/aclocaltest"
SlashCmdList.ARENACORELOCALTEST = function(msg)
    if not AC or not AC.Localization then
        print("|cffFF0000[ArenaCore]|r Localization module not available")
        return
    end
    
    print("|cff00FF00[ArenaCore Localization Test]|r")
    print("Current Locale:", AC.Localization.currentLocale)
    print("Supports Extended Features:", AC.Localization:SupportsExtendedFeatures())
    print("Is Non-English:", AC.Localization.isNonEnglish)
    
    -- Test cast bar spell names
    local testSpells = {
        [47541] = "Death Coil",
        [118] = "Polymorph", 
        [32375] = "Mass Dispel",
        [527] = "Purify",
        [4987] = "Cleanse"
    }
    
    print("\n|cffFFFF00Spell Name Tests:|r")
    for spellID, fallbackName in pairs(testSpells) do
        local localizedName = AC.Localization:GetSpellName(spellID, fallbackName)
        local isLocalized = localizedName ~= fallbackName
        local status = isLocalized and "|cff00FF00[Localized]|r" or "|cffFF6600[Fallback]|r"
        print(string.format("  %d: %s -> %s %s", spellID, fallbackName, localizedName, status))
    end
    
    -- Test player names (if in arena or test mode)
    print("\n|cffFFFF00Player Name Tests:|r")
    for i = 1, 3 do
        local unit = "arena" .. i
        if UnitExists(unit) then
            local localizedName = AC.Localization:GetPlayerName(unit)
            local standardName = UnitFullName(unit) or UnitName(unit)
            print(string.format("  %s: %s", unit, localizedName or "None"))
        else
            print(string.format("  %s: |cff888888Not available|r", unit))
        end
    end
    
    -- Test cast bar specific function
    print("\n|cffFFFF00Cast Bar Spell Name Tests:|r")
    for spellID, fallbackName in pairs(testSpells) do
        local castBarName = AC.Localization:GetCastBarSpellName(spellID, fallbackName)
        print(string.format("  %d: %s", spellID, castBarName))
    end
    
    print("\n|cff00FF00Test complete! Use /aclocale for more detailed info.|r")
end

-- Quick test: /aclocalquick
SLASH_ARENACORELOCALQUICK1 = "/aclocalquick"
SlashCmdList.ARENACORELOCALQUICK = function()
    if not AC or not AC.Localization then
        print("|cffFF0000[ArenaCore]|r Localization module not available")
        return
    end
    
    -- Quick test of common spells
    local polyName = AC.Localization:GetCastBarSpellName(118, "Polymorph")
    local coilName = AC.Localization:GetCastBarSpellName(47541, "Death Coil")
    
    print("|cff00FF00[ArenaCore Quick Localization Test]|r")
    print("Polymorph:", polyName)
    print("Death Coil:", coilName)
    print("Locale:", AC.Localization.currentLocale)
end

