Quantcast Reverse-Localized Hyperlinks - WoWInterface
Thread Tools Display Modes
10-04-12, 03:20 PM   #1
Jarod24
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 66
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?
__________________
Author of IfThen, Links in Chat
  Reply With Quote
10-04-12, 03:32 PM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,257
If you click the link what item tooltip is shown? English or Italian?

Maybe one of the hoverlink addons would be a suitable workaround?
  Reply With Quote
10-04-12, 04:10 PM   #3
Jarod24
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 66
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.
__________________
Author of IfThen, Links in Chat
  Reply With Quote
10-04-12, 05:23 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
10-05-12, 08:21 AM   #5
Jarod24
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 66
+1 for Phanx for posting a almost complete solution.
__________________
Author of IfThen, Links in Chat
  Reply With Quote
10-05-12, 06:09 PM   #6
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
If you're using it, feel free to post a more "complete" version for others to use.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
01-18-13, 05:06 PM   #7
Jarod24
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 66
Originally Posted by Phanx View Post
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!
__________________
Author of IfThen, Links in Chat
  Reply With Quote
01-18-13, 05:30 PM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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...
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Reverse-Localized Hyperlinks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off