Get cached value for the user language

This commit is contained in:
Tercio Jose
2020-02-10 20:20:09 -03:00
parent 90ca7b9fb4
commit bcdd7ae683
4 changed files with 40 additions and 55 deletions
+1
View File
@@ -44,6 +44,7 @@ functions\report.lua
functions\rowanimation.lua
functions\raidinfo.lua
functions\dungeon.lua
functions\pack.lua
core\timemachine.lua
+2 -2
View File
@@ -4,8 +4,8 @@
_ = nil
_detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0")
_detalhes.build_counter = 7259
_detalhes.alpha_build_counter = 7259 --if this is higher than the regular counter, use it instead
_detalhes.build_counter = 7269
_detalhes.alpha_build_counter = 7269 --if this is higher than the regular counter, use it instead
_detalhes.game_version = "v8.3.0"
_detalhes.userversion = "v8.3.0." .. _detalhes.build_counter
_detalhes.realversion = 140 --core version, this is used to check API version for scripts and plugins (see alias below)
+34 -53
View File
@@ -1,8 +1,11 @@
-- actor container file
local _detalhes = _G._detalhes
local DF = DetailsFramework
local _
local CONST_CLIENT_LANGUAGE = DF.ClientLanguage
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers
@@ -392,15 +395,11 @@
end
return nome, dono_do_pet
end
end
end
--> check pet owner name with correct declension for ruRU locale
--> check pet owner name with correct declension for ruRU locale (from user 'denis-kam' on github)
local find_name_declension = function (petTooltip, playerName)
if (GetLocale() ~= "ruRU") then
return petTooltip:find(playerName)
end
--> 2 - male, 3 - female
for gender = 2, 3 do
for declensionSet = 1, GetNumDeclensionSets(playerName, gender) do
@@ -429,68 +428,50 @@
for playerName, _ in _pairs (_detalhes.tabela_vigente.raid_roster) do
local pName = playerName
playerName = playerName:gsub ("%-.*", "") --remove realm name
if (find_name_declension(text1, playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
--if the user client is in russian language
--make an attempt to remove declensions from the character's name
--this is equivalent to remove 's from the owner on enUS
if (CONST_CLIENT_LANGUAGE == "ruRU") then
if (find_name_declension (text1, playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
else
if (text1:find (playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
end
end
else
if (text1:find (playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
end
end
end
end
local line2 = _G ["DetailsPetOwnerFinderTextLeft3"]
local text2 = line2 and line2:GetText()
if (text2 and text2 ~= "") then
for playerName, _ in _pairs (_detalhes.tabela_vigente.raid_roster) do
local pName = playerName
playerName = playerName:gsub ("%-.*", "") --remove realm name
if (find_name_declension(text2, playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
end
end
end
end
--[[
local find_pet_owner = function (serial, nome, flag, self)
pet_tooltip_frame:SetOwner (WorldFrame, "ANCHOR_NONE")
pet_tooltip_frame:SetHyperlink ("unit:" .. serial or "")
local text = pet_text_object:GetText()
if (text and text ~= "") then
text = text:gsub ("'s", "") --> enUS
if (IsFactionNpc [text]) then
text = follower_text_object:GetText()
if (text) then
text = text:gsub ("'s", "") --> enUS
else
return
end
end
for _, ownerName in _ipairs ({strsplit (" ", text)}) do
local cur_combat = _detalhes.tabela_vigente
if (cur_combat and cur_combat.raid_roster [ownerName]) then
local ownerGuid = _UnitGUID (ownerName)
if (ownerGuid) then
_detalhes.tabela_pets:Adicionar (serial, nome, flag, ownerGuid, ownerName, 0x00000417)
local nome_dele, dono_nome, dono_serial, dono_flag = _detalhes.tabela_pets:PegaDono (serial, nome, flag)
local dono_do_pet
if (nome_dele and dono_nome) then
nome = nome_dele
dono_do_pet = self:PegarCombatente (dono_serial, dono_nome, dono_flag, true, nome)
if (CONST_CLIENT_LANGUAGE == "ruRU") then
if (find_name_declension (text2, playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
else
if (text2:find (playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
end
--print ("Owner Found:", ownerName, nome)
return nome, dono_do_pet
end
else
if (text2:find (playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
end
end
end
end
end
--]]
function container_combatentes:PegarCombatente (serial, nome, flag, criar)
--[[statistics]]-- _detalhes.statistics.container_calls = _detalhes.statistics.container_calls + 1
+3
View File
@@ -0,0 +1,3 @@
local _detalhes = _G._detalhes