![]() | This is the module sandbox page for Module:English variant notice (diff). |
![]() | This Lua module is used on 62,000+ pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
This module is for generating various english variant notice templates.
Automatically generates "variant" from title template that invokes it (e.g invoking from "Template:American English" gives "American English" as variant).
All templates using this support a |Oxford=
parameter for oxford spelling and |IUPAC=
automatically.
Usage
edit- small, form and including – unnecessary to use in templates as grabbed when passed in from talk pages
- id – the HTML id used in editnotices; "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 English, which should be a Wikipedia article.
- spelling examples –gives spelling examples in parentheses
- compare –comparison variants of english
- 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 Template:English variant 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
)
Example
editAs of March 2018, Template:Hiberno-English uses the following parameters:
{{#invoke:English variant notice|main| id = hie| image = Four Provinces Flag.svg{{!}}border| spelling_examples = ''colour'', ''realise'', ''travelled''| compare = [[British English|English]], [[Scottish English|Scottish]] and}}
which produces:
![]() | This module is written in Hiberno-English, which has its own spelling conventions (colour, realise, travelled) and some terms that are used in it may be different or absent from English, Scottish and other varieties of English. According to the relevant style guide, this should not be changed without broad consensus. |
See also
edit- The {{Use X English}} templates
local p = {}local categoryHandler = require( 'Module:Category handler' ).mainlocal yesno = require('Module:Yesno')local mArguments = require('Module:Arguments')local nfunction 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 --if it is on the main template page, load docn = mArguments.getArgs(frame, {parentFirst = true})n.variant = n.variant or templatetitle --automatically use title generated from template nameif n.doc ~= 'no' thenreturn frame:expandTemplate {title = 'English variant notice/documentation', args = n}endendreturn p._main (frame, templatetitle)endfunction p._main (frame, templatetitle)n = mArguments.getArgs(frame, {parentFirst = true})n.variant = n.variant or templatetitle --automatically use title generated from template namen.category = ''n.spelling_examples = n.spelling_examples or n['spelling examples']n.bid = not not n.id --bool of n.id, for making iupac and oxford not be added to the id if it doesn't exist--Generate the text if it isn't specifiedif not n.text thenp.modify_text ()p.base_text (frame)endp.cat ('Wikipedia articles that use '..n.variant)return p.style(frame)..(n.category or '')endfunction 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 '')endfunction p.modify_text ()n.spelling = ''n.extravariant = ''n.extraguide = ''bOxford = yesno(n.Oxford)bIUPAC = yesno(n.IUPAC)chemtext = "; ''aluminium'', ''sulfur'', and ''caesium''"if bOxford thenn.spelling_examples = "''colour'', ''realize'', ''organization'', ''analyse''; note that '''-ize''' is used instead of -ise"p.cat ('Wikipedia articles that use Oxford spelling')if n.bid then n.id = n.id..n.Oxford endif bIUPAC thenn.extravariant = ' with [[Oxford spelling|Oxford]] and [[IUPAC]] spelling'n.spelling_examples= n.spelling_examples..chemtextp.IUPAC ()returnendn.extravariant = n.extravariant..' with [[Oxford spelling]]'returnelseif bIUPAC thenn.extravariant = ' with [[IUPAC]] spelling'n.spelling_examples = n.spelling_examples and n.spelling_examples..chemtext or "''aluminium'', ''sulfur'', and ''caesium''"p.IUPAC ()returnend--only if there are spelling examples, put 'has its own spelling conventions'if n.spelling_examples then n.spelling = ', which has its own spelling conventions' endendfunction p.IUPAC ()n.extraguide = ' and [[Wikipedia:Naming conventions (chemistry)|chemistry naming conventions]]'p.cat('Wikipedia articles that use IUPAC spelling')n.flag = 'no'if n.bid then n.id = n.id..'iupac' endendfunction p.base_text (frame)n.subjectspace = require('Module:Pagetype').main()n.spelling_examples = n.spelling_examples and string.format(' (%s)', n.spelling_examples) or ''n.terms = n[1] or n.termsn.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 the English language|varieties of English]]. According to the [[Wikipedia:Manual of Style#National varieties of English|relevant style guide]]%s, this should not be changed without broad consensus.]=],n.subjectspace, n.variant, n.extravariant, n.spelling, n.spelling_examples, n.terms, n.compare, n.extraguide)endfunction p.style (frame)local sizeif yesno(n.small) then size = '30px'elseif n.size then size = n.sizeelse size = '50px'endif n.image thenif n.flag == nil or yesno(n.flag) thenn.image = string.format('[[File:%s|%s]]', n.image, size)else--check if the globe should be "color" instead of "colour"if yesno(n.color) thenn.image = string.format('[[File:Globe spelling color.png|%s]]', size)elsen.image = string.format('[[File:Globe spelling colour.svg|%s]]', size)endendendif n.form == 'editnotice' thenif n.bid then n.id = n.id..'editnotice' endn.expiry = n.expiry or 'indefinite'--categorize editnotice if specifiedif yesno(n.editnotice_cat) thenp.cat(string.format('Pages with editnotice %s editnotice', n.variant))endreturn frame:expandTemplate{title = 'editnotice', args = n}elselocal message_box = require('Module:Message box').mainif not n.image then n.image = 'none' endn['type'] = 'style'return message_box ('tmbox', n)endendreturn p
🔥 Top keywords: Akademia e Shkencave e RPS te ShqiperiseAlexandria Ocasio-CortezBilderberg GroupCristiano RonaldoDong XiaowanMinecraftOperation GladioPrimal cutRiot FestStrictly Come Dancing (series 7)Main PageSpecial:SearchKalki 2898 ADWikipedia:Featured picturesMartin MullICC Men's T20 World CupUEFA Euro 2024.xxxChris MartinA Quiet Place: Day One2024 ICC Men's T20 World CupProject 2025Joe BidenDua LipaCleopatraJamal Musiala2024 NHL entry draftVirat KohliColdplayDeaths in 2024Simone BilesUEFA European ChampionshipCeline DionCricket World CupThe Bear (TV series)Dakota JohnsonZac EfronCyndi LauperKasper Schmeichel2024 Copa AméricaRuben VargasBronny JamesBad Boys: Ride or DieElizabeth IAbu Ghraib torture and prisoner abuseNicole KidmanDonald TrumpRohit SharmaJasprit Bumrah