local SPELL_MONITOR;
local SPELL_TRIGGER_ENABLE;
local SPELL_TD_ENABLE;

if (GetLocale() == "zhCN") then
	SPELL_MONITOR = {"技能触发", "jinengchufa"};
	SPELL_TRIGGER_ENABLE = "启用技能触发监控";
	SPELL_TRIGGER_CONFIG = "配置";

elseif (GetLocale() == "zhTW") then
	SPELL_MONITOR = {"技能觸發", "jinengchufa"};
	SPELL_TRIGGER_ENABLE = "啟用技能觸發監控";
	SPELL_TRIGGER_CONFIG = "配置";
else
	SPELL_MONITOR = "Spell Trigger";
	SPELL_TRIGGER_ENABLE = "Enable Event Alerter";
	SPELL_TRIGGER_CONFIG = "Config";
end


if IsConfigurableAddOn("EventAlert") then
	ModManagement_RegisterMod(
		"SpellMonitor",
		"Interface\\Icons\\ability_shaman_watershield",
		SPELL_MONITOR,
		"",
		nil,
		nil,
		{[2]=true,[3]=true}

	);
		
	ModManagement_RegisterCheckBox(
		"SpellMonitor",
		SPELL_TRIGGER_ENABLE,
		nil,
		"EnableEventAlert",
		1,
		function (arg)
			if (arg == 1) then
				if not IsAddOnLoaded("EventAlert") then
					LoadAddOn("EventAlert")
				end
				if (IsAddOnLoaded("EventAlert")) then
					EventAlert_Toggle(true)
				end
				
			else
				if (IsAddOnLoaded("EventAlert")) then
					EventAlert_Toggle(false)
				end
			end
		end
	);

	ModManagement_RegisterButton(
		"SpellMonitor",
		SPELL_TRIGGER_CONFIG,
		function()
			if (IsAddOnLoaded("EventAlert")) then
				ShowUIPanel(EA_Options_Frame);
			end
		end,
		nil,
		1
	);
end