--[=[
    Parses a localization table and adds a pseudo localized locale to the table.

    @param localizationTable LocalizationTable -- LocalizationTable to add to.
    @param preferredLocaleId string? -- Preferred locale to use. Defaults to "qlp-pls"
    @param preferredFromLocale string? -- Preferred from locale. Defaults to "en-us"
    @return string -- The translated line
]=]

function PseudoLocalize.addToLocalizationTable(localizationTable, preferredLocaleId, preferredFromLocale)
	local localeId = preferredLocaleId or "qlp-pls"
	local fromLocale = preferredFromLocale or "en"

	local entries = localizationTable:GetEntries()
	for _, entry in pairs(entries) do
		if not entry.Values[localeId] then
			local line = entry.Values[fromLocale]
			if line then
				entry.Values[localeId] = PseudoLocalize.pseudoLocalize(line)
			else
				warn(("[PseudoLocalize.addToLocalizationTable] - No entry in key %q for locale %q")
					:format(entry.Key, fromLocale))
			end
		end
	end

	localizationTable:SetEntries(entries)
end
