function EsoPL_doubleNamesAbilities(EsoPL)
	if EsoPL:GetLanguage() == "pl" then
		local rsd = EsoPL.Settings.Data
		-- Bezpieczny fallback: jeśli DataEN nie istnieje, użyj pustej tabeli zamiast nil
		local rsd2 = EsoPL.Settings.DataEN or {}
		
		-- Main Window
		local ZO_Skills_AbilityEntry_SetupOrg = ZO_Skills_AbilityEntry_Setup
		ZO_Skills_AbilityEntry_Setup = function(control, skillData)
			ZO_Skills_AbilityEntry_SetupOrg(control, skillData)
			
			local skillPointAllocator = skillData:GetPointAllocator()
			local skillProgressionData = skillPointAllocator:GetProgressionData()
			local currentAbilityId = skillProgressionData:GetAbilityId()
			
			if EsoPL.Settings.ShowAbilitiesMenu == "en" then
				local finalName
				local polName = GetAbilityName(currentAbilityId)
				local polNameLower = ZO_CachedStrFormat("<<z:1>>", polName)

				if rsd.CraftAbilities[polNameLower] then
					finalName = rsd.CraftAbilities[polNameLower]
				elseif rsd.Abilities and rsd.Abilities[currentAbilityId] then -- POPRAWKA rsd2 -> rsd
					finalName = rsd.Abilities[currentAbilityId] -- POPRAWKA rsd2 -> rsd
				else
					finalName = polName
				end

				control:GetNamedChild("Name"):SetText(EsoPL:MagicReplace(control:GetNamedChild("Name"):GetText(), polName, finalName))
			end
		end
		
		local ZO_Skills_CompanionSkillEntry_SetupOrg = ZO_Skills_CompanionSkillEntry_Setup
		ZO_Skills_CompanionSkillEntry_Setup = function(control, skillData)
			ZO_Skills_CompanionSkillEntry_SetupOrg(control, skillData)
			
			local skillPointAllocator = skillData:GetPointAllocator()
			local skillProgressionData = skillPointAllocator:GetProgressionData()
			local currentAbilityId = skillProgressionData:GetAbilityId()
			
			if rsd.Abilities ~= nil and EsoPL.Settings.ShowAbilitiesMenu == "en" then -- POPRAWKA rsd2 -> rsd
				control:GetNamedChild("Name"):SetText(EsoPL:MagicReplace(control:GetNamedChild("Name"):GetText(), GetAbilityName(currentAbilityId), rsd.Abilities[currentAbilityId])) -- POPRAWKA rsd2 -> rsd
			end
		end

		ZO_SkillsConfirmDialog:SetHandler("OnShow", function()
			
			local skillProgressionData = ZO_SkillsConfirmDialog.data
			local currentAbilityId = skillProgressionData:GetAbilityId()
			
			if rsd.Abilities and rsd.Abilities[currentAbilityId] and EsoPL.Settings.ShowAbilitiesMenu == "en" then -- POPRAWKA rsd2 -> rsd
				ZO_SkillsConfirmDialog:GetNamedChild("AbilityName"):SetText(EsoPL:MagicReplace(ZO_SkillsConfirmDialog:GetNamedChild("AbilityName"):GetText(), GetAbilityName(currentAbilityId), rsd.Abilities[currentAbilityId])) -- POPRAWKA rsd2 -> rsd
			end
		end)
		
		ZO_SkillsMorphDialog:SetHandler("OnShow", function()
			
			local bsAbility = ZO_SkillsMorphDialog:GetNamedChild("BaseAbility")
			local skillProgressionData = bsAbility.skillProgressionData
			local currentAbilityId = skillProgressionData:GetAbilityId()
			
			if rsd.Abilities and rsd.Abilities[currentAbilityId] and EsoPL.Settings.ShowAbilitiesMenu == "en" then -- POPRAWKA rsd2 -> rsd
				ZO_SkillsMorphDialog.desc:SetText(zo_strformat(SI_SKILLS_SELECT_MORPH, rsd.Abilities[currentAbilityId])) -- POPRAWKA rsd2 -> rsd
			end
		end)
		
		-- Advisor
		
		local AdvSetupAbilityEntryOrg = ZO_SKILLS_ADVISOR_SUGGESTION_WINDOW.SetupAbilityEntry
		ZO_SKILLS_ADVISOR_SUGGESTION_WINDOW.SetupAbilityEntry = function(manager, control, skillProgressionData)
			AdvSetupAbilityEntryOrg(manager, control, skillProgressionData)
			
			local skillData = skillProgressionData:GetSkillData()
			local currentAbilityId = skillProgressionData:GetAbilityId()
			
			if EsoPL.Settings.Data.Abilities[currentAbilityId] ~= nil and EsoPL.Settings.ShowAbilitiesMenu == "en" then
				control:GetNamedChild("Name"):SetText(EsoPL:MagicReplace(control:GetNamedChild("Name"):GetText(), GetAbilityName(currentAbilityId), EsoPL.Settings.Data.Abilities[currentAbilityId]))
			end
		end
		
		-- Tooltips
		
		local function modifyTooltip(isPassive, isNew, ...)
			local finalName, finalName2, polName
			
			if EsoPL.Settings.ShowAbilitiesTooltip ~= "pl" then
				if isPassive then
					local skillType, skillLineIndex, skillIndex, rank = ...
					local abilityId = GetSpecificSkillAbilityInfo(skillType, skillLineIndex, skillIndex, 0, rank)
					
					if abilityId and rsd.Abilities and rsd.Abilities[abilityId] then -- POPRAWKA rsd2 -> rsd
						polName = GetAbilityName(abilityId)
						finalName = rsd.Abilities[abilityId] -- POPRAWKA rsd2 -> rsd
					end
				elseif isNew then
					local skillType, skillLineIndex, skillIndex = ...
					local abilityId = GetSpecificSkillAbilityInfo(skillType, skillLineIndex, skillIndex, 0, 1)
					
					if abilityId and rsd.Abilities and rsd.Abilities[abilityId] then -- POPRAWKA rsd2 -> rsd
						polName = GetAbilityName(abilityId)
						finalName = rsd.Abilities[abilityId] -- POPRAWKA rsd2 -> rsd
					end
				else
					local skillType, skillLineIndex, skillIndex, morphChoice, _, _, _, _, _, _, _, _, _, overrideAbilityId = ...
					local abilityId = GetSpecificSkillAbilityInfo(skillType, skillLineIndex, skillIndex, morphChoice, 1)
					
					if overrideAbilityId and rsd.Abilities and rsd.Abilities[overrideAbilityId] then -- POPRAWKA rsd2 -> rsd
						finalName = rsd.Abilities[overrideAbilityId] -- POPRAWKA rsd2 -> rsd
						polName = GetAbilityName(overrideAbilityId)
					elseif overrideAbilityId and not (rsd.Abilities and rsd.Abilities[overrideAbilityId]) then -- POPRAWKA rsd2 -> rsd
						-- finalName2 = nmIcon .. rsd.Abilities[abilityId]
					elseif abilityId and rsd.Abilities and rsd.Abilities[abilityId] then -- POPRAWKA rsd2 -> rsd
						finalName = rsd.Abilities[abilityId] -- POPRAWKA rsd2 -> rsd
						polName = GetAbilityName(abilityId)
					end
				end
				
				if finalName and polName then
					if EsoPL.Settings.ShowAbilitiesTooltip == "plen" then
						finalName = string.format("%s (%s)", polName, finalName)
					elseif EsoPL.Settings.ShowAbilitiesTooltip == "enpl" then
						finalName = string.format("%s (%s)", finalName, polName)
					end
					
					SafeAddString(SI_ABILITY_NAME_AND_RANK, GetString(SI_ABILITY_NAME_AND_RANK):gsub("<<1>>", finalName), 10)
					SafeAddString(SI_ABILITY_TOOLTIP_NAME, finalName, 10)
				end
			end
		end
		
		local function modifyTooltipCompanion(...)
			local finalName, polName
			
			if EsoPL.Settings.ShowAbilitiesTooltip ~= "pl" then
				local abilityId = ...
				
				if abilityId then
					polName = GetAbilityName(abilityId)
					polNameLower = ZO_CachedStrFormat("<<z:1>>", polName)

					if rsd.CraftAbilities[polNameLower] then
						finalName = rsd.CraftAbilities[polNameLower]
					elseif rsd.Abilities and rsd.Abilities[abilityId] then -- POPRAWKA rsd2 -> rsd
						finalName = rsd.Abilities[abilityId] -- POPRAWKA rsd2 -> rsd
					end
				end
				
				if finalName and polName then
					if EsoPL.Settings.ShowAbilitiesTooltip == "plen" then
						finalName = string.format("%s (%s)", polName, finalName)
					elseif EsoPL.Settings.ShowAbilitiesTooltip == "enpl" then
						finalName = string.format("%s (%s)", finalName, polName)
					end
					
					SafeAddString(SI_ABILITY_NAME_AND_RANK, GetString(SI_ABILITY_NAME_AND_RANK):gsub("<<1>>", finalName), 10)
					SafeAddString(SI_ABILITY_TOOLTIP_NAME, finalName, 10)
				end
			end
		end
		
		local function abilityTooltipHook(tooltipControl, method, isPassive, isNew, isCompanion)
			local origMethod = tooltipControl[method]
			tooltipControl[method] = function(self, ...)
				if isCompanion then
					modifyTooltipCompanion(...)
				else
					modifyTooltip(isPassive, isNew, ...)
				end
				
				origMethod(self, ...)
					
				SafeAddString(SI_ABILITY_NAME_AND_RANK, EsoPL.StringsBackup["SI_ABILITY_NAME_AND_RANK"], 10)
				SafeAddString(SI_ABILITY_TOOLTIP_NAME, EsoPL.StringsBackup["SI_ABILITY_TOOLTIP_NAME"], 10)
			end
		end
		
		abilityTooltipHook(SkillTooltip, "SetActiveSkill", false, false, false)
		abilityTooltipHook(SkillTooltip, "SetPassiveSkill", true, false, false)
		abilityTooltipHook(SkillTooltip, "SetSkillAbility", false, true, false)
		abilityTooltipHook(SkillTooltip, "SetCompanionSkill", false, false, true)
		abilityTooltipHook(SkillTooltip, "SetAbilityId", false, false, true)
		
		-- Eksperymenty
		
		local oldFunction = ZO_SkillProgressionData_Base.GetName
		
		function ZO_SkillProgressionData_Base:GetName()
			-- When in gamepad mode, show either English or Polish depending on the user's setting.
			local abilityId = self:GetAbilityId()
			if IsInGamepadPreferredMode() then
				-- if user requested English in menu and an English mapping exists, use it
				-- POPRAWKA: Musimy sprawdzać rsd.Abilities, a nie rsd2.Abilities
				if EsoPL.Settings.ShowAbilitiesMenu == "en" and rsd.Abilities and rsd.Abilities[abilityId] then
					return rsd.Abilities[abilityId]
				end
				-- If "pl" is selected, just return the original Polish name
				return oldFunction(self)
			end
			return oldFunction(self)
		end
		
		local oldFunction4 = ZO_SkillProgressionData_Base.GetFormattedName
		
		function ZO_SkillProgressionData_Base:GetFormattedName(formatter)
			-- When in gamepad mode, show either English or Polish depending on the user's setting.
			local abilityId = self:GetAbilityId()
			if IsInGamepadPreferredMode() then
				-- if user requested English in menu and an English mapping exists, use it
				-- POPRAWKA: Musimy sprawdzać rsd.Abilities, a nie rsd2.Abilities
				if EsoPL.Settings.ShowAbilitiesMenu == "en" and rsd.Abilities and rsd.Abilities[abilityId] then
					return ZO_CachedStrFormat(formatter or SI_ABILITY_NAME, rsd.Abilities[abilityId])
				end
				-- If "pl" is selected, just return the original Polish name
				return oldFunction4(self, formatter)
			end
			return oldFunction4(self, formatter)
		end
		
		--[[ZO_PreHook(GAMEPAD_TOOLTIPS:GetTooltip(GAMEPAD_LEFT_TOOLTIP), "LayoutSkillProgression", function(tooltip, progressionData)
			local abilityId = progressionData:GetAbilityId()
			local polName = GetAbilityName(abilityId)
			local finalName = rsd2.Abilities[abilityId]
			
			d(abilityId, polName, finalName)
			
			if finalName and polName then
				if EsoPL.Settings.ShowAbilitiesTooltip == "plen" then
					finalName = string.format("%s (%s)", polName, finalName)
				elseif EsoPL.Settings.ShowAbilitiesTooltip == "enpl" then
					finalName = string.format("%s (%s)", finalName, polName)
				end
				
				SafeAddString(SI_ABILITY_NAME_AND_RANK, GetString(SI_ABILITY_NAME_AND_RANK):gsub("<<1>>", finalName), 10)
				SafeAddString(SI_ABILITY_TOOLTIP_NAME, finalName, 10)
			end
		end)
		
		ZO_PostHook(GAMEPAD_TOOLTIPS:GetTooltip(GAMEPAD_LEFT_TOOLTIP), "LayoutSkillProgression", function()
			SafeAddString(SI_ABILITY_NAME_AND_RANK, EsoPL.StringsBackup["SI_ABILITY_NAME_AND_RANK"], 10)
			SafeAddString(SI_ABILITY_TOOLTIP_NAME, EsoPL.StringsBackup["SI_ABILITY_TOOLTIP_NAME"], 10)
		end)]]
	end
	EsoPL_doubleNamesAbilities = nil
end