求真百科歡迎當事人提供第一手真實資料,洗刷冤屈,終結網路霸凌。

變更

前往: 導覽搜尋

模块:Lang

增加 2,330 位元組, 5 年前
// Edit via Wikiplus
local maint_msgs = {}; -- and their messages go here
local function page_exists (title)
-- This function implements #ifexist
local noError, titleObject = pcall (mw.title.new, title)
if not noError then
return false
else
if titleObject then
return titleObject.exists
else
return false
end
end
end
--[[--------------------------< I S _ S E T >------------------------------------------------------------------
--[=[-------------------------< M A K E _ C A T E G O R Y >----------------------------------------------------
For individual language, <language>, returns注意:此处有修改 对于中文,则返回以下分类: [[Category:含有明确引用中文的条目]] 对于非中文内容:  如果是常用语言,则直接返回以下分类: [[Category:Articles containing 含有<language语言>-language text的条目]](此处的<语言>为本模块内建)
for English: 如果是非常用语言: [[Category:Articles containing explicitly cited English-language text]] for artificial languages (code: art) 如果存在对应语言的分类,则返回以下分类: [[Category:Articles containing constructed-language text含有<语言>的条目]](此处的<语言>需读取数据库资料)
for ISO 639-2 collective languages (and for 639-1 bh): 反之,则返回以下分类: [[Category:Articles with text from the <language> languages collective含有非中文内容的条目]]
]=]
if (0 ~= namespace) or nocat then -- only categorize in article space
return ''; -- return empty string for concatenation
end
if language_name:find ('languages') then
return table.concat ({'[[Category:Articles with text from the ', language_name, ' collective]]'});
end
table.insert (cat, '[[Category:含有');
if 'zh' == code then table.insert (cat, '明確引用中文'); elseif 'ar' == code then table.insert (cat, '阿拉伯語') elseif 'en' == code then table.insert (cat, 'explicitly cited English英語') elseif 'es' == code then table.insert (cat, '西班牙語') elseif 'de' == code then table.insert (cat, '德語') elseif 'fr' == code then table.insert (cat, '法語') elseif 'ja' == code then table.insert (cat, '日語') elseif 'bg' == code then table.insert (cat, '保加利亞語') elseif 'cs' == code then table.insert (cat, '捷克語') elseif 'da' == code then table.insert (cat, '丹麥語') elseif 'nl' == code then table.insert (cat, '荷蘭語') elseif 'et' == code then table.insert (cat, '愛沙尼亞語') elseif 'fi' == code then table.insert (cat, '芬蘭語') elseif 'el' == code then table.insert (cat, '希臘語') elseif 'hu' == code then table.insert (cat, '匈牙利語') elseif 'ga' == code then table.insert (cat, '愛爾蘭語') elseif 'grc' == code then table.insert (cat, '古希臘語') elseif 'kr' == code then table.insert (cat, '卡努里語') elseif 'la' == code then table.insert (cat, '拉丁語') elseif 'cy' == code then table.insert (cat, '威爾斯語') elseif 'sl' == code then table.insert (cat, '斯洛維尼亞語'); elseif 'artyue' == code then table.insert (cat, 'constructed粵語') elseif (page_exists ('Category:含有' .. language_name .. '的條目') ) then table.insert (cat, language_name);
else
table.insert (cat, language_name'非中文內容');
end
table.insert (cat, '的 目]]');
return table.concat (cat);
table.insert (tout, translit);
if is_set (code) and not style then -- when a language code is provided (always with {{lang-xx}} templates, not always with {{transl}})
table.insert (tout, "</ispan>"); -- close the italic span tag
else
table.insert (tout, "</span>"); -- no language code so close the span tag
else
args.text = args[2] or args.text; -- prefer args.text
end
 
if nil == args.italic then -- nil when |italic= absent or not set or |italic=default; args.italic controls
args.italic = 'unset';
end
if msg then
return make_error_msg (msg, args, 'lang');
end
 
if nil == args.italic then -- nil when |italic= absent or not set or |italic=default; args.italic controls
if ('latn' == subtags.script) or (p.is_latn (args.text) and 'en' ~= code) then -- script set to latn or text is wholly latn script but not rendering English
args.italic = 'italic'; -- DEFAULT for {{lang}} templates is upright; but if latn script set for font-style:italic
else
args.italic = 'inherit'; -- italic not set; script not latn; inherit current style
end
end
if 'invert' == args.italic then
args.text = invert_italics (args.text)
end
 
-- 中文版特化部分:为非中文文字禁用繁简转换,中文文字和其他以汉字作为书写系统的汉语方言文字启用繁简转换。
if 'zh' == code then
args.text = args.text
elseif 'gan' == code then
args.text = args.text
elseif 'wuu' == code then
args.text = args.text
elseif 'yue' == code then
args.text = args.text
elseif 'lzh' == code then
args.text = args.text
elseif 'hsn' == code then
args.text = args.text
else
args.text = '-{' .. args.text .. '}-'
end
if 'invert' == args.italic then
args.text = invert_italics (args.text)
end
 
-- 中文版特化部分:为非中文文字禁用繁简转换,中文文字和其他以汉字作为书写系统的汉语方言文字启用繁简转换。
if 'zh' == code then
args.text = args.text
elseif 'gan' == code then
args.text = args.text
elseif 'wuu' == code then
args.text = args.text
elseif 'yue' == code then
args.text = args.text
elseif 'lzh' == code then
args.text = args.text
elseif 'hsn' == code then
args.text = args.text
else
args.text = '-{' .. args.text .. '}-'
end
if is_set (args.translit) and not p.is_latn (args.text) then -- transliteration (not supported in {{lang}}); not supported when args.text is wholly latn text (this is an imperfect test)
args.translit = '-{' .. args.translit .. '}-'
table.insert (out, ','); -- comma to separate text from translit
if 'none' ~= args.label then
translit_script_name = language_name; -- fall back on language name
end
translit_title = mw.title.makeTitle (0, table.concat ({translit_script_name, ' 罗马 羅馬 化'})); -- make a title object
if translit_title.exists and ('no' ~= args.link) then
table.insert (out, make_wikilink ((translit_script_name or language_name) .. ' 罗马 羅馬 化', '转写')); -- make a wikilink if there is an article to link to
else
table.insert (out, '转写'); -- else define the abbreviation
匿名用戶