Jump to content

Module:Sandbox/Wangxuan8331800/SB2: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
No edit summary
Line 2: Line 2:


function yesno(a)
function yesno(a)
local answer
if a == ("yes" or "y" or "1") then
if a == ("yes" or "y" or "1") then
a = 1
a = 1
Line 12: Line 13:


function bold_title(a)
function bold_title(a)
if yesno(bold) == 0 then
if yesno(bold) == 0 then
else
else
Line 25: Line 27:
local title = frame.args[1]
local title = frame.args[1]
bold = frame.args.bold
local bold = frame.args.bold
local diff = frame.args.diff
local ja = frame.args.ja
local ko = frame.args.ko
local en = frame.args.en
local na = frame.args.na
local eu = frame.agrs.eu
local cn = frame.agrs.cn
local hk = frame.args.hk
local tw = frame.args.tw
local note = frame.args[2]
-- Load parameters end
-- Load parameters end
Line 37: Line 53:
-- Main part end
-- Main part end
-- Japanese / Korean group begin
local non_english_group
if (ja ~= nil and ko ~= nil) then
non_english_group = '<span class="error"><code>&#124;ja&#61;</code>和<code>&#124;ko&#61;</code>只能同時填入一個,請填寫遊戲原生發行版本語言名稱</span>'
elseif ja ~= nil then
if yesno(diff) == 1 or na ~= nil or eu ~= nil then
non_english_group = '日版名:'
else
non_english_group = '日语:'
end
non_english_group = non_english_group .. '<span lang="ja" xml:lang="ja">-{' .. ja .. '}-</span>'
elseif ko ~= nil then
if yesno(diff) == 1 or na ~= nil or eu ~= nil then
non_english_group = '韩版名:'
else
non_english_group = '韩语:'
end
non_english_group = non_english_group .. '<span lang="ko" xml:lang="ko">-{' .. ko .. '}-</span>'
else
end
-- Japanese / Korean group end
-- Japanese / Korean group end
-- English / America / Eroupe group begin
if (ja ~= nil or ko ~= nil) and (en ~= nil or na ~= nil or eu ~= nil) then
local english_group = ','
end
if na ~= nil and eu ~= nil then
english_group = english_group .. '美版名:<span lang="en" xml:lang="en">-{<i>' .. na .. '</i>}-</span>,欧版名:<span lang="en" xml:lang="en">-{<i>' .. eu .. '</i>}-</span>'
elseif na ~= nil then
english_group = english_group .. '美版名:<span lang="en" xml:lang="en">-{<i>' .. na .. '</i>}-</span>'
elseif eu ~= nil then
english_group = english_group .. '欧版名:<span lang="en" xml:lang="en">-{<i>' .. eu .. '</i>}-</span>'
elseif en ~= nil then
if yesno(diff) == 1 then
english_group = english_group .. '英文版名:'
else
english_group = english_group .. '英语:'
end
english_group = english_group .. '<span lang="en" xml:lang="en">-{<i>' .. en .. '</i>}-</span>'
end
-- English / America / Eroupe group end
-- Mainland / Taiwan / Hong Kong Translation group begin
local translation_group
if hk == tw and cn ~= nil then
translation_group = ',-{'
.. 'zh-hans:中国大陆译作“-{zh-hans|' .. bold_title(cn) .. '}-”,台港译作“-{zh-hans|' .. bold_title(tw) .. '}-”;'
.. 'zh-hant:中國大陸譯作「-{zh-hant|' .. bold_title(cn) .. '}-」,台港譯作「-{zh-hant|' .. bold_title(tw) .. '}-」;'
.. 'zh-cn:台港译作“-{zh-hans|' .. bold_title(tw) .. '}-”; '
.. 'zh-tw:中國大陸譯作「-{zh-hant|' .. bold_title(cn) .. '}-」;'
.. '}-'
-- elseif hk == cn and tw ~= nil then
-- translation_group = ',-{'
-- .. 'zh-cn:台湾译作“-{zh-hans|' .. bold(tw) .. '}-”;'
-- zh-hk:台灣譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{tw}}}}-'''」;
-- zh-tw:中國大陸和香港譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{cn}}}}-'''」;
-- zh-hans:中国大陆和香港译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{cn}}}}-'''”,台湾译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{tw}}}}-'''”;
-- zh-hant:中國大陸和香港譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{cn}}}}-'''」,台灣譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{tw}}}}-'''」;}-



--#default=,-{zh-cn:台湾译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{tw}}}}-'''”,香港译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{hk}}}}-'''”; zh-hk:中國大陸譯作「'''-{<includeonly>zh-hans{{!}}</includeonly>{{{cn}}}}-'''」,台灣譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{tw}}}}-'''」; zh-tw:中國大陸譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{cn}}}}-'''」,香港譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{hk}}}}-'''」; zh-hans:中国大陆译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{cn}}}}-'''”,香港译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{hk}}}}-'''”,台湾译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{tw}}}}-'''”; zh-hant:中國大陸譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{cn}}}}-'''」,香港譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{hk}}}}-'''」,台灣譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{tw}}}}-'''」;}-<!--
end


return title .. '(' .. ')'
return title .. '(' .. non_english_group .. english_group .. translation_group .. note .. ')'
end
end



Revision as of 06:00, 1 February 2014

local p = {}

function yesno(a)
	local answer
	if a == ("yes" or "y" or "1") then
		a = 1
	elseif a == ("no" or "n" or "0") then
		a = 0
	end
	
	return a
end

function bold_title(a)
	
	if yesno(bold) == 0 then
	else
		a = '<b>' .. a .. '</b>'
	end
	
	return a
end

function p.vgname(frame)
	
	-- Load parameters begin
	
	local title = frame.args[1]
	local bold = frame.args.bold
	
	local diff = frame.args.diff
	local ja = frame.args.ja
	local ko = frame.args.ko
	
	local en = frame.args.en
	local na = frame.args.na
	local eu = frame.agrs.eu
	
	local cn = frame.agrs.cn
	local hk = frame.args.hk
	local tw = frame.args.tw
	
	local note = frame.args[2]
	
	-- Load parameters end
	
	-- Main part begin
	title = bold_title(title)
 
	if yesno(bracket) ~= 0 then
		title = '《' .. title .. '》'
	end
	
	-- Main part end
	
	-- Japanese / Korean group begin
	local non_english_group
	if (ja ~= nil and ko ~= nil) then
		non_english_group = '<span class="error"><code>&#124;ja&#61;</code>和<code>&#124;ko&#61;</code>只能同時填入一個,請填寫遊戲原生發行版本語言名稱</span>'
	elseif ja ~= nil then
		if yesno(diff) == 1 or na ~= nil or eu ~= nil then
			non_english_group = '日版名:'
		else
			non_english_group = '日语:'
		end
		non_english_group = non_english_group .. '<span lang="ja" xml:lang="ja">-{' .. ja .. '}-</span>'
	elseif ko ~= nil then
		if yesno(diff) == 1 or na ~= nil or eu ~= nil then
			non_english_group = '韩版名:'
		else
			non_english_group = '韩语:'
		end
		non_english_group = non_english_group .. '<span lang="ko" xml:lang="ko">-{' .. ko .. '}-</span>'	
	else
	end
	
	-- Japanese / Korean group end
	
	-- English / America / Eroupe group begin
	
	if (ja ~= nil or ko ~= nil) and (en ~= nil or na ~= nil or eu ~= nil) then
		local english_group = ','
	end
	
	if na ~= nil and eu ~= nil then
		english_group = english_group .. '美版名:<span lang="en" xml:lang="en">-{<i>' .. na .. '</i>}-</span>,欧版名:<span lang="en" xml:lang="en">-{<i>' .. eu .. '</i>}-</span>'
	elseif na ~= nil then
		english_group = english_group .. '美版名:<span lang="en" xml:lang="en">-{<i>' .. na .. '</i>}-</span>'
	elseif eu ~= nil then
		english_group = english_group .. '欧版名:<span lang="en" xml:lang="en">-{<i>' .. eu .. '</i>}-</span>'
	elseif en ~= nil then
		if yesno(diff) == 1 then
			english_group = english_group .. '英文版名:'
		else
			english_group = english_group .. '英语:'
		end
		english_group = english_group .. '<span lang="en" xml:lang="en">-{<i>' .. en .. '</i>}-</span>'
	end
	
	-- English / America / Eroupe group end
	
	-- Mainland / Taiwan / Hong Kong Translation group begin
	local translation_group
	if hk == tw and cn ~= nil then
		translation_group = ',-{'
		.. 'zh-hans:中国大陆译作“-{zh-hans|' .. bold_title(cn) .. '}-”,台港译作“-{zh-hans|' .. bold_title(tw) .. '}-”;' 
		.. 'zh-hant:中國大陸譯作「-{zh-hant|' .. bold_title(cn) .. '}-」,台港譯作「-{zh-hant|' .. bold_title(tw) .. '}-」;' 
		.. 'zh-cn:台港译作“-{zh-hans|' .. bold_title(tw) .. '}-”; '
		.. 'zh-tw:中國大陸譯作「-{zh-hant|' .. bold_title(cn) .. '}-」;'
		.. '}-'
--	elseif hk == cn and tw ~= nil then
--		 translation_group = ',-{'
--		 .. 'zh-cn:台湾译作“-{zh-hans|' .. bold(tw) .. '}-”;'
--  	zh-hk:台灣譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{tw}}}}-'''」;
--  	zh-tw:中國大陸和香港譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{cn}}}}-'''」;
--  	zh-hans:中国大陆和香港译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{cn}}}}-'''”,台湾译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{tw}}}}-'''”;
--  	zh-hant:中國大陸和香港譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{cn}}}}-'''」,台灣譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{tw}}}}-'''」;}-



--#default=,-{zh-cn:台湾译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{tw}}}}-'''”,香港译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{hk}}}}-'''”; zh-hk:中國大陸譯作「'''-{<includeonly>zh-hans{{!}}</includeonly>{{{cn}}}}-'''」,台灣譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{tw}}}}-'''」; zh-tw:中國大陸譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{cn}}}}-'''」,香港譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{hk}}}}-'''」; zh-hans:中国大陆译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{cn}}}}-'''”,香港译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{hk}}}}-'''”,台湾译作“'''-{<includeonly>zh-hans{{!}}</includeonly>{{{tw}}}}-'''”; zh-hant:中國大陸譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{cn}}}}-'''」,香港譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{hk}}}}-'''」,台灣譯作「'''-{<includeonly>zh-hant{{!}}</includeonly>{{{tw}}}}-'''」;}-<!--
end

	return title .. '(' .. non_english_group .. english_group .. translation_group .. note .. ')'
end

return p