Module:Korean transliteration notice
Appearance
![]() | This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
This module is for generating various Korean transliteration notice templates.
Automatically generates "variant" from the title template that invokes it (e.g., invoking from "Template:Revised Romanization" gives "Revised Romanization" as variant).
All templates using this support the following parameters:
- small, form and including – unnecessary to use in templates as grabbed when passed in from talk pages
- id – the HTML id used in edit notices; "editnotice" is automatically appended
- image – name of file to be used as an icon, without the File: prefix.
- variant – defaults to the template name; the variant of transliteration, which should be a Wikipedia article.
- transliteration examples – gives transliteration examples in parentheses
- compare – comparison with other transliterations of Korean
- text – custom text, set only if required to be different from the default
- doc if set to no, will not load the automatic documentation at Module:Korean transliteration notice/documentation
- editnotice_cat if set to yes, categorizes in edit notice category
- nocat disables documentation if set to true
- size set the size of the image (example:
)|size=60px
Examples
As of July 2024, Template:Revised Romanization uses the following parameters:
{{#invoke:Korean transliteration notice|main | id = rr | image = Hunmin jeong-eum.jpg | transliteration_examples = ''Joseon'', ''Tteokbokki'', ''Pansori'' | compare = [[McCune-Reischauer|MR]], [[Yale romanization of Korean|Yale]] }}
which produces:
![]() | This module is written in Revised Romanization of Korean, which has its own transliteration conventions (Joseon, Tteokbokki, Pansori) and some terms that are used in it may be different or absent from MR, Yale other varieties of Korean. According to the relevant style guide, this should not be changed without broad consensus. |
Other Examples:
local p = {}
local categoryHandler = require('Module:Category handler').main
local yesno = require('Module:Yesno')
local mArguments = require('Module:Arguments')
local n
function p.main(frame)
local fulltitle = frame:getParent():getTitle()
local templatetitle = string.sub(fulltitle, 10)
local title = mw.title.getCurrentTitle()
if mw.title.equals(title, mw.title.makeTitle('Template', title.rootText)) then
n = mArguments.getArgs(frame, {parentFirst = true})
n.variant = n.variant or templatetitle
if n.doc ~= 'no' then
return frame:expandTemplate {title = 'Korean transliteration notice/documentation', args = n}
end
end
return p._main(frame, templatetitle)
end
function p._main(frame, templatetitle)
n = mArguments.getArgs(frame, {parentFirst = true})
n.variant = n.variant or templatetitle
n.category = ''
n.transliteration_examples = n.transliteration_examples or n['transliteration examples']
n.bid = not not n.id
if not n.text then
p.modify_text()
p.base_text(frame)
end
p.cat('Wikipedia articles that use ' .. n.variant)
return p.style(frame) .. (n.category or '')
end
function p.cat(category)
category = string.format('[[Category:%s]]', category)
n.category = n.category .. (categoryHandler{category, nocat = n.nocat, page = n.page, talk = category, template = category} or '')
end
function p.modify_text()
n.transliteration = ''
n.extravariant = ''
n.extraguide = ''
bRR = yesno(n.RR)
bMR = yesno(n.MR)
bYale = yesno(n.Yale)
if bRR then
n.transliteration_examples = "''Gim'', ''Seoul'', ''Han River''; note that '''-g''' is used instead of -k"
p.cat('Wikipedia articles that use Revised Romanization')
if n.bid then n.id = n.id .. n.RR end
if bMR then
n.extravariant = ' with [[Revised Romanization|RR]] and [[McCune-Reischauer|MR]] transliteration'
n.transliteration_examples = n.transliteration_examples .. "; ''Kim'', ''Sŏul'', ''Han-gang''"
p.MR()
return
end
n.extravariant = n.extravariant .. ' with [[Revised Romanization]]'
return
elseif bMR then
n.extravariant = ' with [[McCune-Reischauer]] transliteration'
n.transliteration_examples = n.transliteration_examples and n.transliteration_examples .. "; ''Kim'', ''Sŏul'', ''Han-gang''" or "''Kim'', ''Sŏul'', ''Han-gang''"
p.MR()
return
elseif bYale then
n.extravariant = ' with [[Yale Romanization]]'
n.transliteration_examples = n.transliteration_examples and n.transliteration_examples .. "; ''Kim'', ''Swuwl'', ''Hankang''" or "''Kim'', ''Swuwl'', ''Hankang''"
p.Yale()
return
end
if n.transliteration_examples then n.transliteration = ', which has its own transliteration conventions' end
end
function p.MR()
n.extraguide = ' and [[Wikipedia:Naming conventions (Korean)|Korean naming conventions]]'
p.cat('Wikipedia articles that use McCune-Reischauer transliteration')
n.flag = 'no'
if n.bid then n.id = n.id .. 'mr' end
end
function p.Yale()
n.extraguide = ' and [[Wikipedia:Naming conventions (Korean)|Korean naming conventions]]'
p.cat('Wikipedia articles that use Yale Romanization')
n.flag = 'no'
if n.bid then n.id = n.id .. 'yale' end
end
function p.base_text(frame)
n.subjectspace = require('Module:Pagetype').main()
n.transliteration_examples = n.transliteration_examples and string.format(' (%s)', n.transliteration_examples) or ''
n.terms = n[1] or n.terms
n.terms = n.terms and string.format(' (including %s)', n.terms) or ''
n.compare = n.compare and (n.compare .. ' ') or ''
n.text = string.format([=[This %s is '''written in [[%s]]%s'''%s%s and some terms that are used in it%s may be different or absent from %sother [[List of dialects of Korean|varieties of Korean]]. According to the [[Wikipedia:Manual of Style#National varieties of Korean|relevant style guide]]%s, this should not be changed without [[Wikipedia:Consensus#Levels of consensus|broad consensus]].]=],
n.subjectspace, n.variant, n.extravariant, n.transliteration, n.transliteration_examples, n.terms, n.compare, n.extraguide)
end
function p.style(frame)
local size
if yesno(n.small) then size = '30px'
elseif n.size then size = n.size
else size = '50px'
end
if n.image then
if n.flag == nil or yesno(n.flag) then
n.image = string.format('[[File:%s|%s]]', n.image, size)
else
if yesno(n.color) then
n.image = string.format('[[File:Globe spelling color.png|%s]]', size)
else
n.image = string.format('[[File:Globe spelling colour.svg|%s]]', size)
end
end
end
if n.form == 'editnotice' then
if n.bid then n.id = n.id .. 'editnotice' end
n.expiry = n.expiry or 'indefinite'
if yesno(n.editnotice_cat) then
p.cat(string.format('Pages with %s editnotice', n.variant))
end
return frame:expandTemplate{title = 'editnotice', args = n}
else
local message_box = require('Module:Message box').main
if not n.image then n.image = 'none' end
n['type'] = 'style'
return message_box('tmbox', n)
end
end
return p