Thread Tools Display Modes
07-21-21, 01:28 AM   #1
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Language agnostic parts of global strings?

I was looking at the global strings, and found NOT_IN_TORGHAST, which is partially useful to me. What I want is just the word "Torghast" without the rest of the phrase "Can't do that in Torghast, Tower of the Damned".

In English, I could match that easily enough, I think, but would my snippet work across all languages the game supports?
Lua Code:
  1. local torghast = NOT_IN_TORGHAST:match("^Torghast$")
  2. print(torghast)
  3. --> "Torghast" in all languages?
Will this work?
  Reply With Quote
07-21-21, 03:16 AM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
There is a language drop-down at the top here: https://wow.tools/dbc/?dbc=globalstr...earch=Torghast
  Reply With Quote
07-21-21, 03:58 AM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
I could already switch the languages by loading the other global strings files. I don't think that will help me to isolate the word "Torghast" in any language.

I might simply have to ask users to localize the word in my addon's language profile.
  Reply With Quote
07-21-21, 04:55 PM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
I am going to test a hack of sorts. 1762 is the uiMapID for Torghast, Tower of the Damned, but I want to check the name and compare it to the minimap's zone text in order to apply Ve'nari reputation to all floors of the tower. What I'd like to avoid is having to do data entry for 100+ uiMapIDs or instanceIDs.
Lua Code:
  1. -- Fancy trick to localize all floors of Torghast, Tower of the Damned
  2. local torghastName = C_Map.GetMapInfo(1762).name
  3.  
  4. local subZone = GetMinimapZoneText()
  5.  
  6. -- Check for all floors of Torghast, Tower of the Damned
  7. local isTorghast = strmatch(subZone, "^" .. torghastName .. ".*")
  8. if isTorghast then
  9.     if self:SetWatchedFactionByFactionID(2432) then -- Ve'nari
  10.         return
  11.     end
  12. end

self:SetWatchedFactionByFactionID() is a function I borrowed from Diplomancer by Phanx and Talyrus to set the watched reputation as an XP bar, passing in the faction I want watched.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Language agnostic parts of global strings?

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