View Single Post
09-24-16, 02:35 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
This will probably (I don't have an active subscription and can't actualy test it) do what you want:

Code:
local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function()

	local myLang, _, _, myTimezone = select(5, LibStub("LibRealmInfo"):GetRealmInfo(GetRealmName()))
	myLang = myTimezone == "AEST" and "AU" or myLang:sub(3)

	hooksecurefunc("LFGListSearchEntry_Update", function(self)
		local leaderName = select(13, C_LFGList.GetSearchResultInfo(self.resultID))
		local realmName = leaderName and leaderName:match("%-(.+)")
		if realmName then
			local realmLang, _, _, realmTimezone = select(5, LibStub("LibRealmInfo"):GetRealmInfo(realmName))
			realmLang = realmTimezone == "AEST" and "AU" or realmLang:sub(3)
			if realmLang and realmLang ~= myLang then
				self.ActivityName:SetFormattedText("%s[%s]|r %s", ORANGE_FONT_COLOR_CODE, realmLang, self.ActivityName:GetText())
			end
		end
	end)

end)
Use Vlad's addon creator tool to turn the code into an addon package.

You'll also need to install the LibRealmInfo library as a separate addon to provide the data.

Rather than hiding the info away in a tooltip, it will just add "BR" (for Brazil, etc.) in orange right before the dungeon name (or other zone/activity name) in the main list so you can easily see it while scrolling. It won't add anything for realms in the same region/language as you.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 09-30-16 at 10:42 PM. Reason: Fixed an issue in the code
  Reply With Quote