mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-09 15:10:00 +00:00
core: use local variable to check for translations
Some old addons (e.g. ArcHUD2) populate a "T" variable in global space which made pfUI/ShaguPlates assume the translations would have already been loaded and further loading has been stopped by this. Now using a local variable as flag to determine if translations where actually processed or not.
This commit is contained in:
@@ -189,19 +189,21 @@ function pfUI:UpdateFonts()
|
||||
end
|
||||
end
|
||||
|
||||
local translations
|
||||
function pfUI:GetEnvironment()
|
||||
-- load api into environment
|
||||
for m, func in pairs(pfUI.api or {}) do
|
||||
pfUI.env[m] = func
|
||||
end
|
||||
|
||||
if pfUI_config and pfUI_config.global and pfUI_config.global.language and not pfUI.env.T then
|
||||
if pfUI_config and pfUI_config.global and pfUI_config.global.language and not translations then
|
||||
local lang = pfUI_config and pfUI_config.global and pfUI_config.global.language and pfUI_translation[pfUI_config.global.language] and pfUI_config.global.language or GetLocale()
|
||||
pfUI.env.T = setmetatable(pfUI_translation[lang] or {}, { __index = function(tab,key)
|
||||
local value = tostring(key)
|
||||
rawset(tab,key,value)
|
||||
return value
|
||||
end})
|
||||
translations = true
|
||||
end
|
||||
|
||||
pfUI.env._G = getfenv(0)
|
||||
|
||||
Reference in New Issue
Block a user