--[=[
	Extracts the locale from the name
	@param name string -- The name to parse
	@return string -- The locale
]=]

function JsonToLocalizationTable.localeFromName(name)
	if name:sub(-5) == ".json" then
		return name:sub(1, #name-5)
	else
		return name
	end
end

function JsonToLocalizationTable.getOrCreateLocalizationTable()
	local localizationTable = LocalizationService:FindFirstChild(LOCALIZATION_TABLE_NAME)

	if not localizationTable then
		localizationTable = Instance.new("LocalizationTable")
		localizationTable.Name = LOCALIZATION_TABLE_NAME

		if RunService:IsRunning() then
			localizationTable.Parent = LocalizationService
		end
	end

	return localizationTable
end
