function GameTranslator.TranslateGameText(e,R,d)if CoreScriptTranslateGameText then local e=getTranslator()if e then return e:RobloxOnlyTranslate(R,d)else return d end else return d end end local function R()for R,d in pairs(registryInfoMap)do R.Text=GameTranslator:TranslateGameText(d.context,d.text)end end if CoreScriptTranslateGameText then LocalizationService.AutoTranslateWillRun:Connect(R)end function GameTranslator.TranslateAndRegister(B,R,d,e)if CoreScriptTranslateGameText then R.Text=B:TranslateGameText(d,e)registerGui(R,d,e)end return e end return GameTranslator
-- This is meant for translating user game text that appears under CoreGui.
-- It uses Player.LocaleId and the LocalizationTables under LocalizationService.
-- This includes team names, score names, tool names, and notification toasts.
-- DO NOT USE THIS TO TRANSLATE ROBLOX TEXT IN ROBLOX GUIS!!!
-- Text from Roblox in Roblox guis should use LocalizationService.RobloxLocaleId
-- and the CoreScriptLocalization table, NOT user tables with the game locale ID.

function GameTranslator:TranslateGameText(context, text)
	if CoreScriptTranslateGameText then
		local translator = getTranslator()
		if translator then
			return translator:RobloxOnlyTranslate(context, text)
		else
			return text
		end
	else
		return text
	end
end

local function retranslateAll()
	for element, info in pairs(registryInfoMap) do
		element.Text = GameTranslator:TranslateGameText(info.context, info.text)
	end
end

if CoreScriptTranslateGameText then
	LocalizationService.AutoTranslateWillRun:Connect(retranslateAll)
end

function GameTranslator:TranslateAndRegister(element, context, text)
	if CoreScriptTranslateGameText then
		element.Text = self:TranslateGameText(context, text)
		registerGui(element, context, text)
	end

	return text
end

return GameTranslator
