Reaper Death Alerts

Reaper Death Alerts

39 Downloads

language Problem

Filgaja opened this issue · 1 comments

commented

Hey there! 👋

I play WoW in German (deDE), and I noticed that the class icons were not displaying correctly. After investigating, I found that the issue occurs because WoW returns localized class names in deDE , but the .tga image files are named in English (e.g., Rogue.tga, Warrior.tga).

For example:

GetClassInfo(4) returns "Schurke" instead of "Rogue".
GetClassInfo(1) returns "Krieger" instead of "Warrior".
The AddOn then tries to load Schurke.tga, but this file does not exist in the assets.

To fix this, I added a simple German-to-English class name mapping before assigning the image:

local class_translation_deDE = {
    ["Krieger"] = "Warrior",
    ["Jäger"] = "Hunter",
    ["Schurke"] = "Rogue",
    ["Priester"] = "Priest",
    ["Schamane"] = "Shaman",
    ["Magier"] = "Mage",
    ["Hexenmeister"] = "Warlock",
    ["Druide"] = "Druid",
    ["Paladin"] = "Paladin"
}

---@param self DeathToast
---@param class string
---@return classIcon Frame
local function createClassIcon(self, class)
    local classIcon = CreateFrame("Frame", nil, self.toast, "BackdropTemplate")
    classIcon:SetSize(48, 48)
    classIcon:SetPoint("LEFT", self.toast, "LEFT", 8, 0)
    classIcon:SetBackdrop({
        bgFile = nil,
        edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
        tile = true, tileSize = 16, edgeSize = 12,
        insets = { left = 2, right = 2, top = 2, bottom = 2 }
    })
    local color = self.rarity:getColor()
    classIcon:SetBackdropBorderColor(color.red, color.green, color.blue)

    -- Fix: Convert German class names to English for image loading
    if GetLocale() == "deDE" then
        class = class_translation_deDE[class] or class
    end

    local icon = classIcon:CreateTexture(nil, "ARTWORK")
    if class == "" then
        icon:SetTexture("Interface\\Addons\\Reaper\\Assets\\Icons\\Misc\\Tombstone")
    else
        icon:SetTexture("Interface\\Addons\\Reaper\\Assets\\Icons\\Classes\\" .. class)
    end
    icon:SetSize(42, 42)
    icon:SetPoint("CENTER", classIcon, "CENTER", 0, 0)
    
    return classIcon
end

Else you could localize the icons and names.
Or maybe create a a localization mapping file for multiple langugaes.

Dont know if you planned to implement multiple lanuages :)

commented

Okay nevermind it dosnt work well in german oO
especialy i cant join hrdcoreDeaths in german language

Image

Here you can see i can geht informatione of your hdceathalertschannel your addon is using but i am not able to get informationen out of "HardcoreDeaths"

Image

Here you can Skywonin got killed. (blue message) but there is no informationen on hcdeathalertschannel and also no popup. Same with Marnoss . Rogueexy got an alert of reaper

Image

And also where came the alert for ärrow from?

Image

There was no msg in the german "HardcoreTode"

I am highly confused