StringIDReveal_ShowTranslated = StringIDReveal_ShowTranslated or false

local text_actual = LocalizationManager.text
function LocalizationManager:text(string_id, macros, ...)
	if StringIDReveal_ShowTranslated then
		return text_actual(self, string_id, macros, ...)
	else
		if macros ~= nil then
			for name, data in pairs(macros) do
				string_id = tostring(string_id) .. " | " .. tostring(name) .. " = " .. tostring(data)
			end
		end
		return string_id
	end
end

-- Helper functions used by the toggle.lua script
local function IsInHUDChat()
	if managers.hud ~= nil and managers.hud._chat_focus == true then
		return true
	end
	return false
end

local function IsInLobbyChat()
	-- From MenuManager:show_global_success()
	local menu = managers.menu:active_menu()
	-- From MenuManager:is_in_root() and MenuLobbyRenderer:sync_chat_message()
	if menu ~= nil and menu.renderer ~= nil and menu.renderer._node_gui_stack ~= nil then
		local row_item_chat = nil
		for __, node_gui in ipairs(menu.renderer._node_gui_stack) do
			row_item_chat = node_gui:row_item_by_name("chat")
			if row_item_chat ~= nil and row_item_chat.chat_input ~= nil and row_item_chat.chat_input:script() ~= nil then
				-- From MenuInput:mouse_pressed()
				return row_item_chat.chat_input:script().focus
			end
		end
	end
	return false
end

function StringIDReveal_InChat()
	return IsInHUDChat() or IsInLobbyChat()
end
