Module:Translations: Difference between revisions

From Cassette Beasts
Solari (talk | contribs)
i THINK we're ready
Solari (talk | contribs)
implement error handling
Line 4: Line 4:


function p.get_tl(frame)
function p.get_tl(frame)
return translations[frame.args[1]][frame.args[2]]
local result = translations[frame.args[1]][frame.args[2]]
if result == nil then
result = '???'
end
return result
end
end


return p
return p

Revision as of 21:20, 14 July 2025

Documentation for this module may be created at Module:Translations/doc

local p = {}

local translations = mw.text.jsonDecode(mw.title.new('Data:Translations'):getContent())

function p.get_tl(frame)
	local result = translations[frame.args[1]][frame.args[2]]
	
	if result == nil then
		result = '???'
	end
	
	return result
end

return p