WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Language agnostic parts of global strings? (https://www.wowinterface.com/forums/showthread.php?t=58849)

myrroddin 07-21-21 01:28 AM

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?

Kanegasi 07-21-21 03:16 AM

There is a language drop-down at the top here: https://wow.tools/dbc/?dbc=globalstr...earch=Torghast

myrroddin 07-21-21 03:58 AM

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.

myrroddin 07-21-21 04:55 PM

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.


All times are GMT -6. The time now is 03:36 PM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2021 MMOUI