From 2c684e9e91351d7b7e9424f292dd350a409854b8 Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 11 Feb 2021 11:00:09 +0100 Subject: [PATCH] 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. --- pfUI.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pfUI.lua b/pfUI.lua index f1055761..a3674c7e 100644 --- a/pfUI.lua +++ b/pfUI.lua @@ -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)