模块:Phrases:修订间差异
来自「荏苒之境」
无编辑摘要 |
无编辑摘要 |
||
第9行: | 第9行: | ||
local parent_frame = frame:getParent() | local parent_frame = frame:getParent() | ||
local language = translation. | local language = translation.getCurrentLanguageSubpage() | ||
if language == nil or language == "" then | if language == nil or language == "" then | ||
language = "zh-cn" | language = "zh-cn" |
2025年8月23日 (六) 16:51的版本
此模块的文档可以在模块:Phrases/doc创建
local translation = require("Module:Template translation")
local cargo = mw.ext.cargo
local phrases = {}
phrases.show = function(frame)
local table_name = frame.args.table
local theme = frame.args.theme
local parent_frame = frame:getParent()
local language = translation.getCurrentLanguageSubpage()
if language == nil or language == "" then
language = "zh-cn"
end
local t = {language, "<ul>"}
for _, phrase in ipairs(parent_frame.args) do
cargo.store(table_name, {
Language = language,
Phrase = phrase,
Theme = theme
})
t[#t+1] = "<li>"
t[#t+1] = frame:preprocess(phrase)
t[#t+1] = "</li>"
end
t[#t+1] = "</ul>"
return table.concat(t)
end
return phrases