Module:Language screenshot filename

local this = {}

function this.getFilename(frame) scenario = frame.args['scenario'] language = frame.args['language'] -- Get the appropriate Chinese variant. -- The translation is under /zh, but the screenshots are named with -- zh-hans and zh-hant. -- XXX: Until a way to handle variants in Lua is found, -- this is hardcoded as 'zh-hans'. languageParts = mw.text.split( language, '-' ) if languageParts[1] == 'zh' then -- This doesn't actually work :(		-- Commented out until better days.		-- language = frame:preprocess('-{zh-hans:zh-hans;zh-hant:zh-hant;}-')		language = 'zh-hans' -- XXX remove this line when variants are handled	end

filename = scenario .. '-' .. language .. '.png' fileTitle = mw.title.new(filename, 'Media') if not fileTitle.fileExists then filename = scenario .. '-en' .. '.png' end

return 'File:' .. filename end

return this