I guess you can try intercepting UI functions that set the text of various UI elements by hooking into the UI object metatables. For example, if you want to intercept and modify the text of every FontString object as they are being set, this example code would be a place to start.
Lua Code:
-- First, we dynamicly create a FontString object in order to grab the shared FontString metatable
local meta=getmetatable(UIParent:CreateFontString("BACKGROUND")).__index;
local SetText=meta.SetText;-- Link to our original function
-- We need to secure hook the function in case this would be called by secure code
hooksecurefunc(meta,"SetText",function(self,text)
-- Even though the original function has already set the text as supplied, we'll replace it with our own
-- We don't want to throw a UI error if text isn't a string
if type(text)~="string" then return; end
-- We use string.gsub() to modify the text using the old function
SetText(self,text:gsub("SearchWord","ReplacementWord");
end);
Note the secure hook method may not work for functions like
GameTooltip:AddLine(), in which each call adds a new line.