妨子痣是什么意思| 文科女生学什么专业好| 湿气重吃什么水果| 什么是淀粉| 什么洗面奶好用| 胎动什么感觉| 打假是什么意思| 第二职业干点什么好呢| 阴晴不定是什么意思| 下午一点多是什么时辰| 髋关节弹响是什么原因| 男人气虚吃什么补得快| 京东自营店什么意思| 尿检潜血是什么意思| 站街女是什么意思| 前位子宫是什么意思| 鼻子旁边长痘是什么原因| 弱视是什么意思| 泡菜生花用什么方法可以去掉| 兔配什么生肖最好| 什么食物含钙| 凌晨两点多是什么时辰| 文化大革命什么时候| 西米是用什么做的| 抬举是什么意思| 手背发麻是什么原因| 头部MRI检查是什么意思| 哈尼什么意思| 相招是什么意思| 诸葛亮发明了什么| 富士康体检都检查什么| 保底和底薪有什么区别| 手指缝溃烂擦什么药膏| 佛山有什么特产| 什么的绿叶| 情债是什么意思| 抑郁什么意思| 眼睛散光和近视有什么区别| 夏天防中暑备什么药| 啐了一口是什么意思| 脊髓炎吃什么药| 单核细胞百分比偏高是什么原因| impress是什么意思| 孕囊形态欠规则是什么意思| 不妄作劳什么意思| 真空是什么意思| 月经正常颜色是什么色| 感冒为什么会打喷嚏| 螺蛳吃什么| 爆肝是什么意思| 牙痛不能吃什么东西| 什么手机最贵| 小儿风寒感冒吃什么药最好| 玉鸟吃什么饲料好| 经常眩晕是什么原因| 同舟共济是什么意思| 玉化是什么意思| 除颤是什么意思| 宝宝病毒性感冒吃什么药效果好| 副司长是什么级别| 狗咬人后狗为什么会死| 丑土代表什么| 凌波仙子是什么花| 流汗有什么好处| 一切就绪是什么意思| 马步鱼为什么是甜的| 立flag是什么意思| 汉武帝属什么生肖| 青春期指什么年龄段| lot是什么意思| 长期贫血会导致什么严重后果| 梦见大蛇是什么意思| 喝酒后不能吃什么药| 紫水晶五行属什么| 脑委缩吃什么药能空制| 蝙蝠属于什么类| 宫颈锥切后需要注意什么| 着实是什么意思| 别出心裁什么意思| 吃什么长个子最快| 3月28日是什么星座| 1900年属什么生肖| 胡青是什么| 介错是什么意思| 雷人是什么意思| 人潮汹涌是什么意思| 大祭司是什么意思| 格五行属什么| 地藏王菩萨是管什么的| 什么是抗凝药物| 反话是什么意思| 湿疹不能吃什么| 什么是原研药| 1997年是什么生肖| 肚脐眼左侧是什么器官| 类风湿因子高说明什么| 梦见杀蛇是什么意思| 不可或缺是什么意思| 血管瘤吃什么药| 福晋是什么意思| 生吃大蒜有什么好处| 85年是什么命| 软件测试需要学什么| 半联动是什么意思| 孕妇贫血吃什么药| 血型o型rh阳性是什么意思| 副局级是什么级别| 血糖高的可以吃什么水果| 开心水是什么| 酒后大量出虚汗什么原因| 铁扇公主是什么妖精| 切莫是什么意思| 蜂王浆什么时间吃最好| 宫颈炎是什么| 一什么桥| 房颤有什么危害| 维生素b2吃多了有什么副作用| 圆脸适合什么镜框| jordan是什么牌子| 怀孕初期吃什么菜| 甲亢做什么检查| 梵蒂冈为什么没人敢打| asks是什么意思| aemape是什么牌子| 陪衬是什么意思| 搞基是什么意思| 失眠多梦用什么药| 画蛇添足的故事告诉我们什么道理| 一日三餐是什么意思| 脂肪肝是什么原因造成的| 理想型是什么意思| 结核有什么症状| 何五行属性是什么| 枸杞子和什么泡水喝补肾壮阳| 低头什么节| n字鞋子是什么牌子| 转奶是什么意思| 浮尘是什么意思| 土是念什么| wpw综合症是什么意思| 蜘蛛痣是什么样的| 星链是什么| 沙发是什么发质| 代销商是什么意思| tdp是什么| 肺炎吃什么药好得快| 盆腔炎是什么病| 日皮是什么意思| 什么的肩膀| 为什么要割包皮| 脑炎是什么原因引起的| 洗澡用什么香皂好| 中性粒细胞百分比偏低什么意思| 代孕是什么意思| 阿拉伯人属于什么人种| 小孩包皮挂什么科| c反应蛋白什么意思| 溶血是什么意思| c反应蛋白是什么意思| 雨中即景什么意思| 肩宽适合穿什么样的衣服| 医保卡是什么| 结婚10周年是什么婚| 乳腺增生1类什么意思| 云南在古代叫什么| 刚生完宝宝的产妇吃什么好| 湿热带下是什么意思| 跳蚤是什么样的图片| 什么人容易得类风湿| 安宫牛黄丸什么时间吃最好| 中老年补钙吃什么钙片好| 体外射精是什么意思| 忌出火是什么意思| 黑色的屎是什么原因| 阑尾炎是什么症状| 女人手心热吃什么调理| 纳甲是什么意思| 布施蚂蚁什么食物最好| 蚂蚱吃什么食物| 病态是什么意思| 法国铁塔叫什么名字| 腺体鳞化是什么意思| 眩晕症吃什么药| 情商低是什么意思| 武林外传的客栈叫什么| 什么叫质子| 吃什么可以偷偷流产| 老子和孔子是什么关系| 芒果过敏用什么药| 梦见什么是怀孕的征兆| 药店最怕什么样的举报| 小腹坠胀是什么原因| 左手虎口有痣代表什么| 宝宝头发黄是缺什么| 指鹿为马的反义词是什么| 58年属什么生肖| 菌子不能和什么一起吃| 筷子买什么材质的好| siv是什么意思| 阑尾在什么位置| 看守所和拘留所有什么区别| bid什么意思| 低烧什么症状| 滑板鞋是什么鞋| 去痘印用什么药膏| 智商高的人有什么特征| 小熊猫长什么样| 你太low了是什么意思| 什么的天空填合适的词| 中央处理器由什么组成| 0x00000024蓝屏代码是什么意思| 老鼠尿是什么颜色的| 宫颈纳氏囊肿是什么意思| 胆囊炎吃什么药好得快| 老年人嘴唇发紫是什么原因| 斐乐什么档次| 手臂有痣代表什么| 日本为什么要侵略中国| 黑木耳不能和什么一起吃| 五十是什么之年| 双重所有格是什么意思| 生吃西红柿有什么好处和坏处| 小生化是检查什么项目| 耳钉后面的塞子叫什么| 金星原名叫什么| 什么是素质教育| 父母都是b型血孩子是什么血型| 胃反酸吃什么药最好| 红玫瑰的花语是什么| 牙疼吃什么消炎药| 山药和淮山有什么区别| 三点水卖读什么| 尿急尿频吃什么药| 蒹葭苍苍是什么意思| mers是什么病毒| 人为什么会得甲母痣| 回声不均匀是什么意思| 潜叶蝇打什么药效果好| 田七配什么煲汤最好| 脚板心发热是什么原因| 灵芝长在什么地方| 甲亢有些什么症状| 血沉高是什么意思| 牛肉不能和什么一起吃| 乳腺导管扩张是什么意思| 臆想症是什么病| 什么风什么什么| 建执位是什么意思| 43岁属什么生肖| 大便粗大是什么原因| 黄泉是什么意思| 什么伤口需要打破伤风| 头出虚汗是什么原因引起的| 不过如此是什么意思| 夏天为什么不能喝中药| 猪生肠是什么部位| 输血前八项指什么| 为什么头老是晕晕的| 大小便失禁是什么原因造成的| 尿酸高平时要注意什么| 心里空落落的是什么意思| 脑梗吃什么水果| 晒伤用什么| 风采是什么意思| 百度

3月25日天气预报:今起调成20℃模式

Lua
百度 目击者穆哈迈德·阿卜迪纳索告诉新华社记者,爆炸发生时,那里有数辆汽车正准备接受安检。

CodeDiscussionEditHistoryLinksLink count Subpages:DocumentationTestsResultsSandboxLive code All modules


Purpose

This template is used to show translatable templates in the language of the current page. Templates, like all other MediaWiki pages, can be translated using the Translate extension, which creates subpages with the form "pagename/language code". The template first checks if the name of the page contains a language code. If it does, it then checks if the template name given as a first parameter has a translation in that language. If the page name does not contain a language code, or if the navigation template doesn't exist in that language, it will display the English template.

Help for choosing the right template for your use case:
I18n templates: {{Multilingual description|lang=
|de,en,default=Deutsch/English
|fr=fran?ais
|...
}}
{{de|Deutsch}}
{{en|English}}
{{fr|fran?ais}}
...
{{LangSwitch|lang=
|de,en,default=Deutsch/English
|fr=fran?ais
|...
}}
{{Autotranslate}} {{TNT}}
Recommended use at Categories, galleries File description pages (deprecated, can be safely replaced by {{Multilingual description}}) Small templates, whenever the previous options are not suitable (removes the visual indication of the language before each translated text) Data tables with translated cells or larger templates, when used on pages that do not have language subpages (e.g. not having Main page/en, Main page/de) and where the language displayed will be automatically determined by the language set in user preferences Data tables with translated cells or larger templates, when used on pages that do have language subpages; most of the time these will be pages prepared with the Translate Extension
Requires JavaScript enabled for folding Yes No
Folding can be disabled by user Yes No
Folding is done server-side No Yes
Folding when at least n languages are provided 1 (all translations are shown without folding if the preferred language selected by the user has no matching translation) 4 1
Detection of duplicate, incorrect, or unsupported language codes Yes No Yes
Allows the same translation to be used for several languages Yes No Yes
Supports language fallbacks No Yes No Yes
Collation order of languages (when not folded) Consistent order by native language name, languages grouped by script:
  • LTR scripts: Latin, Latin or Cyrillic, Cyrillic, Greek, other simple LTR alphabets (Armenian, Georgian, etc.), abugidas (North Indian, South Indian, other South-East Asian, etc.), syllabaries (European, American, African, Asian), Korean alphabets (basic Jamos, Hangul including some sinograms), Japanese syllabaries (including some sinograms), sinograms (including some syllabaries)
  • RTL scripts: Hebrew, Arabic, other RTL abjads (Divehi, etc.), RTL syllabaries (N'ko)
As provided by the user in the wikitext (any inconsistent order may be difficult to lookup visually) N/A
Search indexing issues No (all translations are included on the same page, however search results may be less relevant with many languages mixed) Yes (may not index all languages depending on search engines, unless there's a list of links for visiting other languages) Partially (where used; language subpages of templates are indexed) No (translated pages should include a <languages/> navigation bar for visiting other languages)
Page size issues Yes (may exhaust size or time limits in the wiki parser if many languages are included; larger pages to download for all visitors; slower navigation for visitors with slow Internet access; may be costly for visitors with limited data plans) No (only the content for the selected language or a suitable fallback language is present in the generated page)
Contains expensive parser functions No Yes (unless there's an editable /lang subpage listing all the existing translations selected with a {{LangSwitch}})

How to use

  • {{Translatable template|name of template|parameters....}}
  • {{TNT|name of template|parameters....}}
  • {{tnt|name of template|parameters....}}

The above simplied syntax cannot work if the named template also needs to be transcluded in other translatable templates, because it would cause self-recursion of {{Translatable template}}. An alternative is to use {{Translatable template name}} which does not expand the template with its parameters, but only returns the resolved template name, which can then be transcluded normally:

  • {{{{Translatable template name|name of template}}|parameters....}}
  • {{{{TNTN|name of template}}|parameters....}}
  • {{{{tntn|name of template}}|parameters....}}

Example (from Commons:Privacy policy):

{{Translatable template|Commons policies and guidelines}} or {{TNT|Commons policies and guidelines}}

which includes translated versions of {{Commons policies and guidelines}} if it exists, or the English version if translations don't exist.

Parameters

The current version of the template may now include any kind of named or numbered parameters, whose values will be transferred into the called template (with the exception of parameter 1 containing the basename of the translatable template to transclude). Numbered parameters will be shifted down by one position, all named parameters will be passed unchanged.

One named parameter is treated specially:

  • {{Translatable template|namespace=:somename:|page name|parameters....}}
  • {{TNT|namespace=:somename:|page name|parameters....}}
  • {{tnt|namespace=:somename:|page name|parameters....}}

This namespace will be used to specify another namespace from which the translatable pagename will be transcluded, instead of referencing the page name from the default :Template: namespace. Note that this parameter is also passed (without modification) within the parameters of the transclusion.

Example with one parameter (from meta:Global sysops):

  • {{TNT|:Special global permissions/Seealso|Global sysops}}

where "Global sysops" - is value of first unnamed parameter, transferred into called page meta:Special global permissions/Seealso.

See also

Code

local this = {}

function this.checkLanguage(subpage, default)
    --[[Check first if there's an any invalid character that would cause the
        mw.language.isKnownLanguageTag function() to throw an exception:
        - all ASCII controls in [\000-\031\127],
        - double quote ("), sharp sign (#), ampersand (&), apostrophe ('),
        - slash (/), colon (:), semicolon (;), lower than (<), greater than (>),
        - brackets and braces ([, ], {, }), pipe (|), backslash (\\)
        All other characters are accepted, including space and all non-ASCII
        characters (including \192, which is invalid in UTF-8).
    --]]
    if mw.language.isValidCode(subpage) and mw.language.isKnownLanguageTag(subpage)
    --[[However "SupportedLanguages" are too restrictive, as they discard many
        valid BCP47 script variants (only because MediaWiki still does not
        define automatic transliterators for them, e.g. "en-dsrt" or
        "fr-brai" for French transliteration in Braille), and country variants,
        (useful in localized data, even if they are no longer used for
        translations, such as zh-cn, also useful for legacy codes).
        We want to avoid matching subpagenames containing any uppercase letter,
        (even if they are considered valid in BCP 47, in which they are
        case-insensitive; they are not "SupportedLanguages" for MediaWiki, so
        they are not "KnownLanguageTags" for MediaWiki).
        To be more restrictive, we exclude any character
        * that is not ASCII and not a lowercase letter, minus-hyphen, or digit,
          or does not start by a letter or does not finish by a letter or digit;
        * or that has more than 8 characters between hyphens;
        * or that has two hyphens;
        * or with specific uses in template subpages and unusable as languages.
    --]]
    or  string.find(subpage, "^[%l][%-%d%l]*[%d%l]$") ~= nil
    and string.find(subpage, "[%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l][%d%l]") == nil
    and string.find(subpage, "%-%-") == nil
    and subpage ~= "doc"
    and subpage ~= "layout"
    and subpage ~= "sandbox"
    and subpage ~= "testcases"
    then
        return subpage
    end
    -- Otherwise there's currently no known language subpage
    return default
end

--[[Get the last subpage of the current page if it is a translation.
    ]]
function this.getLanguageSubpage()
	--[[This code does not work in all namespaces where the Translate tool works.
	--  It works in the main namespace on Meta because it allows subpages there
	--  It would not work in the main namespace of English Wikipedia (but the
	--  articles are monolignual on that wiki).
	--  On Meta-Wiki the main space uses subpages and its pages are translated.
	--  The Translate tool allows translatng pages in all namespaces, even if
	--  the namespace officially does not have subpages.
	--  On Meta-Wiki the Category namespace still does not have subpages enabled,
	--  even if they would be very useful for categorizing templates, that DO have
	--  subpages (for documentatio and tstboxes pages). This is a misconfiguration
	--  bug of Meta-Wiki. The work-around is to split the full title and then
	--  get the last titlepart.
	local subpage = mw.title.getCurrentTitle().subpageText
	--]]
    local titleparts = mw.text.split(mw.title.getCurrentTitle().fullText, '/')
    local subpage = titleparts[#titleparts]
    return this.checkLanguage(subpage, '')
end

--[[Get the last subpage of the current frame if it is a translation.
    Not used locally.
    ]]
function this.getFrameLanguageSubpage(frame)
    local titleparts = mw.text.split(frame:getParent():getTitle(), '/')
    local subpage = titleparts[#titleparts]
    return this.checkLanguage(subpage, '')
end

--[[Get the language of the current page.
    Not used locally.
    ]]
function this.getLanguage()
    local subpage = mw.title.getCurrentTitle().subpageText
    return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())
end

--[[Get the language of the current frame.
    Not used locally.
    ]]
function this.getFrameLanguage(frame)
    local titleparts = mw.text.split(frame:getParent():getTitle(), '/')
    local subpage = titleparts[#titleparts]
    return this.checkLanguage(subpage, mw.language.getContentLanguage():getCode())
end

function this.title(namespace, basepagename, subpage)
    local message, title
    local pagename = basepagename
    if (subpage or '') ~= ''
    then
        pagename = pagename .. '/' .. subpage
    end
    local valid, title = xpcall(function()
            return mw.title.new(pagename, namespace) -- costly
        end, function(msg) -- catch undocumented exception (!?)
            -- thrown when namespace does not exist. The doc still
            -- says it should return a title, even in that case...
            message = msg
        end)
    if valid and title ~= nil and (title.id or 0) ~= 0
    then
        return title
    end
    return { -- "pseudo" mw.title object with id = nil in case of error
        prefixedText = pagename, -- the only property we need below
        message = message -- only for debugging
    }
end

--[[If on a translation subpage (like Foobar/de), this function returns
    a given template in the same language, if the translation is available.
    Otherwise, the template is returned in its default language, without
    modification.
    This is aimed at replacing the current implementation of Template:TNTN.

    This version does not expand the returned template name: this solves the
    problem of self-recursion in TNT when translatable templates need themselves
    to transclude other translable templates (such as Tnavbar).
    ]]
function this.getTranslatedTemplate(frame, withStatus)
    local args = frame.args
    local pagename = args['template']
    
    --[[Check whether the pagename is actually in the Template namespace, or
        if we're transcluding a main-namespace page.
        (added for backward compatibility of Template:TNT)
        ]]
    local title
    local namespace = args['namespace'] or ''
    if (namespace ~= '') -- Checks for namespace parameter for custom ns.
    then
        title = this.title(namespace, pagename) -- Costly
    else -- Supposes that set page is in ns10.
    	namespace = 'Template'
        title = this.title(namespace, pagename) -- Costly
        if title.id == nil
        then -- not found in the Template namespace, assume the main namespace (for backward compatibility)
    	    namespace = ''
            title = this.title(namespace, pagename) -- Costly
        end
    end
    
    -- Get the last subpage and check if it matches a known language code.
    local subpage = args['uselang'] or ''
    if (subpage == '')
    then
        subpage = this.getLanguageSubpage()
    end
    if (subpage == '')
    then
        -- Check if a translation of the pagename exists in English
        local newtitle = this.title(namespace, pagename, 'en') -- Costly
        -- Use the translation when it exists
        if newtitle.id ~= nil
        then
            title = newtitle
        end
    else
        -- Check if a translation of the pagename exists in that language
        local newtitle = this.title(namespace, pagename, subpage) -- Costly
        if newtitle.id == nil
        then
            -- Check if a translation of the pagename exists in English
            newtitle = this.title(namespace, pagename, 'en') -- Costly
        end
        -- Use the translation when it exists
        if newtitle.id ~= nil
        then
            title = newtitle
        end
    end
    -- At this point the title should exist
    if withStatus then
    	-- status returned to Lua function below
        return title.prefixedText, title.id ~= nil
    else
    	-- returned directly to MediaWiki
        return title.prefixedText
    end
end

--[[If on a translation subpage (like Foobar/de), this function renders
    a given template in the same language, if the translation is available.
    Otherwise, the template is rendered in its default language, without
    modification.
    This is aimed at replacing the current implementation of Template:TNT.
    
    Note that translatable templates cannot transclude themselves other
    translatable templates, as it will recurse on TNT. Use TNTN instead
    to return only the effective template name to expand externally, with
    template parameters also provided externally.
    ]]
function this.renderTranslatedTemplate(frame)
	local title, found = this.getTranslatedTemplate(frame, true)
    -- At this point the title should exist prior to performing the expansion
    -- of the template, otherwise render a red link to the missing page
    -- (resolved in its assumed namespace). If we don't tet this here, a
    -- script error would be thrown. Returning a red link is consistant with
    -- MediaWiki behavior when attempting to transclude inexistant templates.
	if not found then
		return '[[' .. title .. ']]'
	end

    -- Copy args pseudo-table to a proper table so we can feed it to expandTemplate.
    -- Then render the pagename.
    local args = frame.args
    local pargs = (frame:getParent() or {}).args
    local arguments = {}
    if (args['noshift'] or '') == ''
    then
        for k, v in pairs(pargs) do
            -- numbered args >= 1 need to be shifted
            local n = tonumber(k) or 0
            if (n > 0)
            then
                if (n >= 2)
                then
                    arguments[n - 1] = v
                end
            else
                arguments[k] = v
            end
        end
    else -- special case where TNT is used as autotranslate
    	-- (don't shift again what is shifted in the invokation)
        for k, v in pairs(pargs) do
            arguments[k] = v
        end
    end
    arguments['template'] = title -- override the existing parameter of the base template name supplied with the full name of the actual template expanded
    arguments['namespace'] = nil -- discard the specified namespace override
    arguments['uselang'] = args['uselang'] -- argument forwarded into parent frame
    arguments['noshift'] = args['noshift'] -- argument forwarded into parent frame
    
    return frame:expandTemplate{title = ':' .. title, args = arguments}
end

return this
硫黄和硫磺有什么区别 1月13是什么星座 耳语是什么意思 跳蚤什么样 肺结核有什么症状
哇咔咔是什么意思 一直流口水是什么原因 为什么会堵奶 cnm是什么意思 什么是佛教什么是道教
属兔与什么属相相克 2月10日什么星座 尿酸高的人吃什么食物好 势不可挡是什么意思 羊病是什么病
做梦梦到男朋友出轨了是什么意思 pe和pb是什么意思 四川耙耳朵是什么意思 ahc是韩国什么档次 日记可以写什么
呕心沥血是什么意思hcv7jop9ns0r.cn 剖腹产吃什么下奶快hcv9jop5ns1r.cn 心率快吃什么药效果更佳hcv8jop7ns8r.cn 65年属什么生肖0297y7.com 排档是什么意思hcv8jop8ns6r.cn
维生素a中毒是什么症状hcv9jop4ns8r.cn 尿酸高要注意什么hcv9jop3ns3r.cn 友五行属什么hcv8jop4ns5r.cn 爱奇艺积分有什么用travellingsim.com 腰肌劳损是什么原因造成的hcv8jop0ns5r.cn
经常吃紧急避孕药有什么危害hcv9jop4ns0r.cn 什么都值得买hcv8jop7ns6r.cn 三亚免税店什么最便宜hcv9jop2ns6r.cn 鱼不能和什么食物一起吃creativexi.com 左手麻木是什么原因引起的hcv9jop2ns7r.cn
晚上适合吃什么wzqsfys.com 门特是什么意思hcv8jop8ns6r.cn 小m是什么意思jingluanji.com 读书与吃药是什么生肖jasonfriends.com 摩托车代表什么生肖hcv8jop7ns8r.cn
百度