Module:Translations: Difference between revisions

From Cassette Beasts
Solari (talk | contribs)
No edit summary
Solari (talk | contribs)
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 3: Line 3:
local translations = mw.text.jsonDecode(mw.title.new('Data:Translations'):getContent())
local translations = mw.text.jsonDecode(mw.title.new('Data:Translations'):getContent())


function p.example()
function p.get_tl(frame)
return translations['STATUS_WINDOW_NAME']['de_DE']
if (translations[frame.args[1]] ~= nil) and (translations[frame.args[1]][frame.args[2]] ~= nil) then
end
return translations[frame.args[1]][frame.args[2]]
 
else
function p.get_tl(id, lang)
return '???'
return translations[id][lang]
end
end
end


return p
return p

Latest revision as of 21:27, 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)
	if (translations[frame.args[1]] ~= nil) and (translations[frame.args[1]][frame.args[2]] ~= nil) then
		return translations[frame.args[1]][frame.args[2]]
	else
		return '???'
	end
end

return p