WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Reverse-Localized Hyperlinks (https://www.wowinterface.com/forums/showthread.php?t=44629)

Jarod24 10-04-12 03:20 PM

Reverse-Localized Hyperlinks
 
Ok. here is the issue.

I use the English client when i play WoW.
Some of my guildmembers are from Italy and they started using the ITA client.

Every time some of them put links in guildchat then the link-text will ofc will be italian and i will have no idea what they are talking about.

I was dabbling with the idea of making a small addon that will parse the links in chat and then lookup the item using the clients local cache, however i wanted to check first if someone knows if there is any existing addon out there that does this already before i started work?

Dridzt 10-04-12 03:32 PM

If you click the link what item tooltip is shown? English or Italian?

Maybe one of the hoverlink addons would be a suitable workaround?

Jarod24 10-04-12 04:10 PM

Ok, so when you just see the link in chat it uses the Italian title.

When you click on the link you will see the info in english (i.e your localized language).



Not much of an issue then i guess.

Phanx 10-04-12 05:23 PM

Something like this should work:
Code:

local function TranslateLinks(_, _, message, ...)
        local linkType, linkID, linkText = strmatch(message, "|H(.-):(%d+).*%|h[(.+)%]")
        if linkType == "item" then
                local itemName = GetItemInfo(linkID)
                message = gsub(message, linkText, itemName)
        end
        return false, message, ...
end

local events = {
        "CHAT_MSG_BATTLEGROUND",
        "CHAT_MSG_BATTLEGROUND_LEADER",
        "CHAT_MSG_CHANNEL",
        "CHAT_MSG_GUILD",
        "CHAT_MSG_OFFICER",
        "CHAT_MSG_PARTY",
        "CHAT_MSG_PARTY_LEADER",
        "CHAT_MSG_RAID",
        "CHAT_MSG_RAID_LEADER",
        "CHAT_MSG_SAY",
        "CHAT_MSG_YELL",
}

for _, event in pairs(events) do
        ChatFrame_AddMessageEventFilter(event, TranslateLinks)
end

If the color codes are inside the brackets, the pattern will need to be changed.

You could easily extend it to handle other types of links, though I'm not sure there's a clean way (eg. not tooltip scanning) to get information about quests by their questID, and maybe some other link types.

Jarod24 10-05-12 08:21 AM

+1 for Phanx for posting a almost complete solution.

Phanx 10-05-12 06:09 PM

If you're using it, feel free to post a more "complete" version for others to use. ;)

Jarod24 01-18-13 05:06 PM

Quote:

Originally Posted by Phanx (Post 265997)
If you're using it, feel free to post a more "complete" version for others to use. ;)

Ok, i finally got around to doing this.

I've now uploaded a new addon called "LinkTranslator" to curseforge and wowinterface.
It simply translates [itemlinks] to the language that you are using ingame.

So instead of seeing [La spada di impotnente la grande calzone] you will see [The Sword of Awesome] (if you're running the english client)

Curse: www.curse.com/addons/wow/linktranslator
Curseforge: wow.curseforge.com/addons/linktranslator/
WowInterface: http://www.wowinterface.com/download...o.php?id=22069


Phanx is da man!

Phanx 01-18-13 05:30 PM

How the hell did you turn the 663 bytes of code I posted into the 55 kilobytes of your addon? That's an 8400% increase in code size... I glanced at the code and found it nearly unreadable, with everything passing through long function chains and split up over 5 files. What is this, I don't even...


All times are GMT -6. The time now is 08:20 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI