跳转到内容

模组:ZhLangconv/doc

本页使用了标题或全文手工转换
维基百科,自由的百科全书

这是Module:ZhLangconv的文档页面

local lc = require('Module:ZhLangconv').new('zh')

print(lc:convert('汉语', 'zh-hant'))
print(lc:convert('漢語', 'zh-hans'))

mw.logObject(lc:convertToVariants('移动支付', 'all'))

mw.logObject(lc:resolveVariantTitle(mw.title.new('玉米淀粉')))
mw.logObject(lc:resolveVariantTitle('玉米澱粉'))
mw.logObject(lc:resolveVariantTitle('不存在的标题abcd123'))

mw.logObject(lc:resolveVariantBatch({mw.title.new('汉语'), mw.title.new('漢語')}))
mw.logObject(lc:resolveVariantBatch({mw.title.new('汉语'), mw.title.new('漢語')}, {['preferNonRedirect'] = true}))

用于模板时请使用不转换标记-{}-或-{R|}-包裹输出,以免被重复转换。亦可使用“预览字词转换”小工具(MediaWiki:Gadget-PreviewWithVariant.js)或NOCONTENTCONVERT/NOCC魔术字停用页面的字词转换。模板用法:

{{#invoke:ZhLangconv|convert|汉语|zh-hant}}

{{#invoke:ZhLangconv|resolve|漢語}}

{{#invoke:ZhLangconv|resolve|漢語|preferNonRedirect=yes}}

兼容性

[编辑]

本模块依赖解析器扩展标签<langconvert>(phab:T263082)在commit 4e6b470be(MediaWiki 1.46.0-wmf.24)之后的行为。

由于phab:T426195,MediaWiki 1.46.0以上的版本暂时只能转换到zh-hans与zh-hant,无法使用zh-cn、zh-tw等地区目标。