ᥝᥤᥱ ᥑᥤᥱ ᥚᥤᥱ ᥖᥤᥱ ᥕᥣᥱ
tddwiki
https://tdd.wikipedia.org/wiki/%E1%A5%9E%E1%A5%A8%E1%A5%9D%E1%A5%B4_%E1%A5%98%E1%A5%A3%E1%A5%B2_%E1%A5%96%E1%A5%A5%E1%A5%B0
MediaWiki 1.47.0-wmf.22
first-letter
ᥛᥤᥱ ᥖᥤᥱ ᥕᥣᥱ
ᥑᥪᥐ ᥖᥩᥢᥰ
ᥟᥧᥙᥱ ᥐᥧᥛ
ᥚᥧᥱ ᥕᥧᥒᥱ ᥖᥪᥰ
ᥟᥧᥙᥱ ᥐᥧᥛ ᥚᥧᥱ ᥕᥧᥒᥱ ᥖᥪᥰ
ᥝᥤᥱ ᥑᥤᥱ ᥚᥤᥱ ᥖᥤᥱ ᥕᥣᥱ
ᥟᥧᥙᥱ ᥐᥧᥛ ᥝᥤᥱ ᥑᥤᥱ ᥚᥤᥱ ᥖᥤᥱ ᥕᥣᥱ
ᥜᥣᥭᥱ
ᥟᥧᥙᥱ ᥐᥧᥛ ᥜᥣᥭᥱ
ᥛᥤᥱ ᥖᥤᥱ ᥕᥣᥱ ᥝᥤᥱ ᥑᥤᥱ
ᥟᥧᥙᥱ ᥐᥧᥛ ᥛᥤᥱ ᥖᥤᥱ ᥕᥣᥱ ᥝᥤᥱ ᥑᥤᥱ
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ
ᥟᥧᥙᥱ ᥐᥧᥛ ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ
ᥘᥩᥒ ᥓᥩᥭ ᥗᥦᥛ
ᥟᥧᥙᥱ ᥐᥧᥛ ᥘᥩᥒ ᥓᥩᥭ ᥗᥦᥛᥴ
ᥙᥫᥒ ᥗᥣᥢ
ᥟᥧᥙᥱ ᥐᥧᥛ ᥙᥫᥒ ᥗᥣᥢ
TimedText
TimedText talk
ᥛᥨᥝᥱ ᥓᥧᥰ
ᥟᥧᥙᥱ ᥐᥧᥛᥴ ᥛᥩᥱ ᥓᥧᥰ
Event
Event talk
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Transliteration
10
328
7930
7745
2026-10-05T22:50:19Z
Saimawnkham
28
7930
wikitext
text/x-wiki
<includeonly>{{#invoke:lang|xlit}}</includeonly><noinclude>
{{documentation}}
</noinclude>
6xqmrry0ts8m64pa4hv9b2w4jn3c1a7
ᥛᥨᥝᥱ ᥓᥧᥰ:Documentation
828
406
7935
5483
2026-10-05T23:12:47Z
Saimawnkham
28
7935
Scribunto
text/plain
-- This module implements {{documentation}}.
-- Get required modules.
local getArgs = require('Module:Arguments').getArgs
-- Get the config table.
local cfg = mw.loadData('Module:Documentation/config')
local p = {}
-- Often-used functions.
local ugsub = mw.ustring.gsub
local format = mw.ustring.format
----------------------------------------------------------------------------
-- Helper functions
--
-- These are defined as local functions, but are made available in the p
-- table for testing purposes.
----------------------------------------------------------------------------
local function message(cfgKey, valArray, expectType)
--[[
-- Gets a message from the cfg table and formats it if appropriate.
-- The function raises an error if the value from the cfg table is not
-- of the type expectType. The default type for expectType is 'string'.
-- If the table valArray is present, strings such as $1, $2 etc. in the
-- message are substituted with values from the table keys [1], [2] etc.
-- For example, if the message "foo-message" had the value 'Foo $2 bar $1.',
-- message('foo-message', {'baz', 'qux'}) would return "Foo qux bar baz."
--]]
local msg = cfg[cfgKey]
expectType = expectType or 'string'
if type(msg) ~= expectType then
error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2)
end
if not valArray then
return msg
end
local function getMessageVal(match)
match = tonumber(match)
return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4)
end
return ugsub(msg, '$([1-9][0-9]*)', getMessageVal)
end
p.message = message
local function makeWikilink(page, display)
if display then
return format('[[%s|%s]]', page, display)
else
return format('[[%s]]', page)
end
end
p.makeWikilink = makeWikilink
local function makeCategoryLink(cat, sort)
local catns = mw.site.namespaces[14].name
return makeWikilink(catns .. ':' .. cat, sort)
end
p.makeCategoryLink = makeCategoryLink
local function makeUrlLink(url, display)
return format('[%s %s]', url, display)
end
p.makeUrlLink = makeUrlLink
local function makeToolbar(...)
local ret = {}
local lim = select('#', ...)
if lim < 1 then
return nil
end
for i = 1, lim do
ret[#ret + 1] = select(i, ...)
end
-- 'documentation-toolbar'
return format(
'<span class="%s">(%s)</span>',
message('toolbar-class'),
table.concat(ret, ' | ')
)
end
p.makeToolbar = makeToolbar
----------------------------------------------------------------------------
-- Argument processing
----------------------------------------------------------------------------
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame, {
valueFunc = function (key, value)
if type(value) == 'string' then
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
return value
else
return nil
end
else
return value
end
end
})
return p[funcName](args)
end
end
----------------------------------------------------------------------------
-- Entry points
----------------------------------------------------------------------------
function p.nonexistent(frame)
if mw.title.getCurrentTitle().subpageText == 'testcases' then
return frame:expandTemplate{title = 'module test cases notice'}
else
return p.main(frame)
end
end
p.main = makeInvokeFunc('_main')
function p._main(args)
--[[
-- This function defines logic flow for the module.
-- @args - table of arguments passed by the user
--]]
local env = p.getEnvironment(args)
local root = mw.html.create()
root
:wikitext(p._getModuleWikitext(args, env))
:wikitext(p.protectionTemplate(env))
:wikitext(p.sandboxNotice(args, env))
:tag('div')
-- 'documentation-container'
:addClass(message('container'))
:attr('role', 'complementary')
:attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil)
:attr('aria-label', args.heading == '' and 'Documentation' or nil)
:newline()
:tag('div')
-- 'documentation'
:addClass(message('main-div-classes'))
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._content(args, env))
:tag('div')
-- 'documentation-clear'
:addClass(message('clear'))
:done()
:newline()
:done()
:wikitext(p._endBox(args, env))
:done()
:wikitext(p.addTrackingCategories(env))
-- 'Module:Documentation/styles.css'
return mw.getCurrentFrame():extensionTag (
'templatestyles', '', {src=cfg['templatestyles']
}) .. tostring(root)
end
----------------------------------------------------------------------------
-- Environment settings
----------------------------------------------------------------------------
function p.getEnvironment(args)
--[[
-- Returns a table with information about the environment, including title
-- objects and other namespace- or path-related data.
-- @args - table of arguments passed by the user
--
-- Title objects include:
-- env.title - the page we are making documentation for (usually the current title)
-- env.templateTitle - the template (or module, file, etc.)
-- env.docTitle - the /doc subpage.
-- env.sandboxTitle - the /sandbox subpage.
-- env.testcasesTitle - the /testcases subpage.
--
-- Data includes:
-- env.protectionLevels - the protection levels table of the title object.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docpageBase - the text of the base page of the /doc, /sandbox and /testcases pages, with namespace.
-- env.compareUrl - URL of the Special:ComparePages page comparing the sandbox with the template.
--
-- All table lookups are passed through pcall so that errors are caught. If an error occurs, the value
-- returned will be nil.
--]]
local env, envFuncs = {}, {}
-- Set up the metatable. If triggered we call the corresponding function in the envFuncs table. The value
-- returned by that function is memoized in the env table so that we don't call any of the functions
-- more than once. (Nils won't be memoized.)
setmetatable(env, {
__index = function (t, key)
local envFunc = envFuncs[key]
if envFunc then
local success, val = pcall(envFunc)
if success then
env[key] = val -- Memoise the value.
return val
end
end
return nil
end
})
function envFuncs.title()
-- The title object for the current page, or a test page passed with args.page.
local title
local titleArg = args.page
if titleArg then
title = mw.title.new(titleArg)
else
title = mw.title.getCurrentTitle()
end
return title
end
function envFuncs.templateTitle()
--[[
-- The template (or module, etc.) title object.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
-- 'testcases-subpage' --> 'testcases'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local subpage = title.subpageText
if subpage == message('sandbox-subpage') or subpage == message('testcases-subpage') or (subpage == message('doc-subpage') and mw.title.getCurrentTitle().namespace == env.docSpace) then
return mw.title.makeTitle(subjectSpace, title.baseText)
else
return mw.title.makeTitle(subjectSpace, title.text)
end
end
function envFuncs.docTitle()
--[[
-- Title object of the /doc subpage.
-- Messages:
-- 'doc-subpage' --> 'doc'
--]]
local title = env.title
local docname = args[1] -- User-specified doc page.
local docpage
if docname then
docpage = docname
else
docpage = env.docpageBase .. '/' .. message('doc-subpage')
end
return mw.title.new(docpage)
end
function envFuncs.sandboxTitle()
--[[
-- Title object for the /sandbox subpage.
-- Messages:
-- 'sandbox-subpage' --> 'sandbox'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('sandbox-subpage'))
end
function envFuncs.testcasesTitle()
--[[
-- Title object for the /testcases subpage.
-- Messages:
-- 'testcases-subpage' --> 'testcases'
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
end
function envFuncs.protectionLevels()
-- The protection levels table of the title object.
return env.title.protectionLevels
end
function envFuncs.subjectSpace()
-- The subject namespace number.
return mw.site.namespaces[env.title.namespace].subject.id
end
function envFuncs.docSpace()
-- The documentation namespace number. For most namespaces this is the
-- same as the subject namespace. However, pages in the Article, File,
-- MediaWiki or Category namespaces must have their /doc, /sandbox and
-- /testcases pages in talk space.
local subjectSpace = env.subjectSpace
if subjectSpace == 0 or subjectSpace == 6 or subjectSpace == 8 or subjectSpace == 14 then
return subjectSpace + 1
else
return subjectSpace
end
end
function envFuncs.docpageBase()
-- The base page of the /doc, /sandbox, and /testcases subpages.
-- For some namespaces this is the talk page, rather than the template page.
local templateTitle = env.templateTitle
local docSpace = env.docSpace
local docSpaceText = mw.site.namespaces[docSpace].name
-- Assemble the link. docSpace is never the main namespace, so we can hardcode the colon.
return docSpaceText .. ':' .. templateTitle.text
end
function envFuncs.compareUrl()
-- Diff link between the sandbox and the main template using [[Special:ComparePages]].
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.canonicalUrl(
'Special:ComparePages',
{ page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
return tostring(compareUrl)
else
return nil
end
end
return env
end
----------------------------------------------------------------------------
-- Auxiliary templates
----------------------------------------------------------------------------
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
function p._getModuleWikitext(args, env)
local currentTitle = mw.title.getCurrentTitle()
if currentTitle.contentModel ~= 'Scribunto' then return end
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
local moduleWikitext = package.loaded["Module:Module wikitext"]
if moduleWikitext then
return moduleWikitext.main()
end
end
function p.sandboxNotice(args, env)
--[=[
-- Generates a sandbox notice for display above sandbox pages.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-notice-image' --> '[[File:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-testcases-blurb' --> 'See also the companion subpage for $1.'
-- 'sandbox-notice-testcases-link-display' --> 'test cases'
-- 'sandbox-category' --> 'Template sandboxes'
-- 'module-sandbox-category' --> 'Module sandboxes'
-- 'other-sandbox-category' --> 'Sandboxes outside of template or module namespace'
--]=]
local title = env.title
local sandboxTitle = env.sandboxTitle
local templateTitle = env.templateTitle
local subjectSpace = env.subjectSpace
if not (subjectSpace and title and sandboxTitle and templateTitle
and mw.title.equals(title, sandboxTitle)) then
return nil
end
-- Build the table of arguments to pass to {{ombox}}. We need just two fields, "image" and "text".
local omargs = {}
omargs.image = message('sandbox-notice-image')
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
local text = '__EXPECTUNUSEDTEMPLATE__'
local pagetype, sandboxCat
if subjectSpace == 10 then
pagetype = message('sandbox-notice-pagetype-template')
sandboxCat = message('sandbox-category')
elseif subjectSpace == 828 then
pagetype = message('sandbox-notice-pagetype-module')
sandboxCat = message('module-sandbox-category')
else
pagetype = message('sandbox-notice-pagetype-other')
sandboxCat = message('other-sandbox-category')
end
local templateLink = makeWikilink(templateTitle.prefixedText)
local compareUrl = env.compareUrl
if compareUrl then
local compareDisplay = message('sandbox-notice-compare-link-display')
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('sandbox-notice-diff-blurb', {pagetype, templateLink, compareLink})
else
text = text .. message('sandbox-notice-blurb', {pagetype, templateLink})
end
-- Get the test cases page blurb if the page exists. This is something like
-- "See also the companion subpage for [[Template:Foo/testcases|test cases]]."
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
-- Add the sandbox to the sandbox category.
omargs.text = text .. makeCategoryLink(sandboxCat)
-- 'documentation-clear'
return '<div class="' .. message('clear') .. '"></div>'
.. require('Module:Message box').main('ombox', omargs)
end
function p.protectionTemplate(env)
-- Generates the padlock icon in the top right.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels = env.protectionLevels
if not protectionLevels then
return nil
end
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveProt = protectionLevels.move and protectionLevels.move[1]
if editProt then
-- The page is edit-protected.
return require('Module:Protection banner')._main{
message('protection-reason-edit'), small = true
}
elseif moveProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected but not edit-protected. Exclude move
-- protection with the level "autoconfirmed", as this is equivalent to
-- no move protection at all.
return require('Module:Protection banner')._main{
action = 'move', small = true
}
else
return nil
end
end
----------------------------------------------------------------------------
-- Start box
----------------------------------------------------------------------------
p.startBox = makeInvokeFunc('_startBox')
function p._startBox(args, env)
--[[
-- This function generates the start box.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- The actual work is done by p.makeStartBoxLinksData and p.renderStartBoxLinks which make
-- the [view] [edit] [history] [purge] links, and by p.makeStartBoxData and p.renderStartBox
-- which generate the box HTML.
--]]
env = env or p.getEnvironment(args)
local links
local content = args.content
if not content or args[1] then
-- No need to include the links if the documentation is on the template page itself.
local linksData = p.makeStartBoxLinksData(args, env)
if linksData then
links = p.renderStartBoxLinks(linksData)
end
end
-- Generate the start box html.
local data = p.makeStartBoxData(args, env, links)
if data then
return p.renderStartBox(data)
else
-- User specified no heading.
return nil
end
end
function p.makeStartBoxLinksData(args, env)
--[[
-- Does initial processing of data to make the [view] [edit] [history] [purge] links.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'view-link-display' --> 'view'
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'create-link-display' --> 'create'
--]]
local subjectSpace = env.subjectSpace
local title = env.title
local docTitle = env.docTitle
if not title or not docTitle then
return nil
end
if docTitle.isRedirect then
docTitle = docTitle.redirectTarget
end
-- Create link if /doc doesn't exist.
local preload = args.preload
if not preload then
if subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
else
preload = message('docpage-preload')
end
end
return {
title = title,
docTitle = docTitle,
-- View, display, edit, and purge links if /doc exists.
viewLinkDisplay = message('view-link-display'),
editLinkDisplay = message('edit-link-display'),
historyLinkDisplay = message('history-link-display'),
purgeLinkDisplay = message('purge-link-display'),
preload = preload,
createLinkDisplay = message('create-link-display')
}
end
function p.renderStartBoxLinks(data)
--[[
-- Generates the [view][edit][history][purge] or [create][purge] links from the data table.
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
local docTitle = data.docTitle
-- yes, we do intend to purge the template page on which the documentation appears
local purgeLink = makeWikilink("Special:Purge/" .. data.title.prefixedText, data.purgeLinkDisplay)
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, data.editLinkDisplay)
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, data.historyLinkDisplay)
return viewLink .. editLink .. historyLink .. purgeLink
else
local createLink = makeUrlLink(docTitle:canonicalUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
return createLink .. purgeLink
end
return ret
end
function p.makeStartBoxData(args, env, links)
--[=[
-- Does initial processing of data to pass to the start-box render function, p.renderStartBox.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- @links - a string containing the [view][edit][history][purge] links - could be nil if there's an error.
--
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'file-namespace-heading' --> 'Summary'
-- 'other-namespaces-heading' --> 'Documentation'
-- 'testcases-create-link-display' --> 'create'
--]=]
local subjectSpace = env.subjectSpace
if not subjectSpace then
-- Default to an "other namespaces" namespace, so that we get at least some output
-- if an error occurs.
subjectSpace = 2
end
local data = {}
-- Heading
local heading = args.heading -- Blank values are not removed.
if heading == '' then
-- Don't display the start box if the heading arg is defined but blank.
return nil
end
if heading then
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('template-namespace-heading')
elseif subjectSpace == 828 then -- Module namespace
data.heading = message('documentation-icon-wikitext') .. ' ' .. message('module-namespace-heading')
elseif subjectSpace == 6 then -- File namespace
data.heading = message('file-namespace-heading')
else
data.heading = message('other-namespaces-heading')
end
-- Heading CSS
local headingStyle = args['heading-style']
if headingStyle then
data.headingStyleText = headingStyle
else
-- 'documentation-heading'
data.headingClass = message('main-div-heading-class')
end
-- Data for the [view][edit][history][purge] or [create] links.
if links then
-- 'mw-editsection-like plainlinks'
data.linksClass = message('start-box-link-classes')
data.links = links
end
return data
end
function p.renderStartBox(data)
-- Renders the start box html.
-- @data - a table of data generated by p.makeStartBoxData.
local sbox = mw.html.create('div')
sbox
-- 'documentation-startbox'
:addClass(message('start-box-class'))
:newline()
:tag('span')
:addClass(data.headingClass)
:attr('id', 'documentation-heading')
:cssText(data.headingStyleText)
:wikitext(data.heading)
local links = data.links
if links then
sbox:tag('span')
:addClass(data.linksClass)
:attr('id', data.linksId)
:wikitext(links)
end
return tostring(sbox)
end
----------------------------------------------------------------------------
-- Documentation content
----------------------------------------------------------------------------
p.content = makeInvokeFunc('_content')
function p._content(args, env)
-- Displays the documentation contents
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
local content = args.content
if not content and docTitle and docTitle.exists then
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
----------------------------------------------------------------------------
-- End box
----------------------------------------------------------------------------
p.endBox = makeInvokeFunc('_endBox')
function p._endBox(args, env)
--[=[
-- This function generates the end box (also known as the link box).
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
--]=]
-- Get environment data.
env = env or p.getEnvironment(args)
local subjectSpace = env.subjectSpace
local docTitle = env.docTitle
if not subjectSpace or not docTitle then
return nil
end
-- Check whether we should output the end box at all. Add the end
-- box by default if the documentation exists or if we are in the
-- user, module or template namespaces.
local linkBox = args['link box']
if linkBox == 'off'
or not (
docTitle.exists
or subjectSpace == 2
or subjectSpace == 828
or subjectSpace == 10
)
then
return nil
end
-- Assemble the link box.
local text = ''
if linkBox then
text = text .. linkBox
else
text = text .. (p.makeDocPageBlurb(args, env) or '') -- "This documentation is transcluded from [[Foo]]."
if subjectSpace == 2 or subjectSpace == 10 or subjectSpace == 828 then
-- We are in the user, template or module namespaces.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. (p.makeExperimentBlurb(args, env) or '') .. '<br />'
if not args.content and not args[1] then
-- "Please add categories to the /doc subpage."
-- Don't show this message with inline docs or with an explicitly specified doc page,
-- as then it is unclear where to add the categories.
text = text .. (p.makeCategoriesBlurb(args, env) or '')
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
end
end
local box = mw.html.create('div')
-- 'documentation-metadata'
box:attr('role', 'note')
:addClass(message('end-box-class'))
-- 'plainlinks'
:addClass(message('end-box-plainlinks'))
:wikitext(text)
:done()
return '\n' .. tostring(box)
end
function p.makeDocPageBlurb(args, env)
--[=[
-- Makes the blurb "This documentation is transcluded from [[Template:Foo]] (edit, history)".
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'edit-link-display' --> 'edit'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[Help:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
--]=]
local docTitle = env.docTitle
if not docTitle then
return nil
end
if docTitle.exists then
-- /doc exists; link to it.
local docLink = makeWikilink(docTitle.prefixedText)
local editDisplay = message('edit-link-display')
local editLink = makeWikilink("Special:EditPage/" .. docTitle.prefixedText, editDisplay)
local historyDisplay = message('history-link-display')
local historyLink = makeWikilink("Special:PageHistory/" .. docTitle.prefixedText, historyDisplay)
return message('transcluded-from-blurb', {docLink})
.. ' '
.. makeToolbar(editLink, historyLink)
.. '<br />'
elseif env.subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createUrl = docTitle:canonicalUrl{action = 'edit', preload = message('module-preload')}
local createDisplay = message('create-link-display')
local createLink = makeUrlLink(createUrl, createDisplay)
return message('create-module-doc-blurb', {createLink})
.. '<br />'
end
end
function p.makeExperimentBlurb(args, env)
--[[
-- Renders the text "Editors can experiment in this template's sandbox (edit | diff) and testcases (edit) pages."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
--
-- Messages:
-- 'sandbox-link-display' --> 'sandbox'
-- 'sandbox-edit-link-display' --> 'edit'
-- 'compare-link-display' --> 'diff'
-- 'module-sandbox-preload' --> 'Template:Documentation/preload-module-sandbox'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'sandbox-create-link-display' --> 'create'
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'
-- 'sandbox-link-display' --> 'sandbox'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display'--> 'edit'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --> 'create'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display' --> 'edit'
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'
-- 'template-testcases-preload' --> 'Template:Documentation/preload-testcases'
-- 'experiment-blurb-module' --> 'Editors can experiment in this module's $1 and $2 pages.'
-- 'experiment-blurb-template' --> 'Editors can experiment in this template's $1 and $2 pages.'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
local sandboxTitle = env.sandboxTitle
local testcasesTitle = env.testcasesTitle
local templatePage = templateTitle.prefixedText
if not subjectSpace or not templateTitle or not sandboxTitle or not testcasesTitle then
return nil
end
-- Make links.
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditDisplay = message('sandbox-edit-link-display')
local sandboxEditLink = makeWikilink("Special:EditPage/" .. sandboxPage, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('compare-link-display')
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
else
sandboxPreload = message('template-sandbox-preload')
end
local sandboxCreateUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('sandbox-create-link-display')
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
if subjectSpace == 828 then
mirrorUrl = sandboxTitle:canonicalUrl{action = 'edit', preload = templateTitle.prefixedText, summary = mirrorSummary}
end
local mirrorDisplay = message('mirror-link-display')
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
sandboxLinks = message('sandbox-link-display') .. ' ' .. makeToolbar(sandboxCreateLink, mirrorLink)
end
if testcasesTitle.exists then
local testcasesPage = testcasesTitle.prefixedText
local testcasesDisplay = message('testcases-link-display')
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)
local testcasesEditUrl = testcasesTitle:canonicalUrl{action = 'edit'}
local testcasesEditDisplay = message('testcases-edit-link-display')
local testcasesEditLink = makeWikilink("Special:EditPage/" .. testcasesPage, testcasesEditDisplay)
-- for Modules, add testcases run link if exists
if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
local testcasesRunLinkDisplay = message('testcases-run-link-display')
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink, testcasesRunLink)
else
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
end
else
local testcasesPreload
if subjectSpace == 828 then
testcasesPreload = message('module-testcases-preload')
else
testcasesPreload = message('template-testcases-preload')
end
local testcasesCreateUrl = testcasesTitle:canonicalUrl{action = 'edit', preload = testcasesPreload}
local testcasesCreateDisplay = message('testcases-create-link-display')
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)
testcasesLinks = message('testcases-link-display') .. ' ' .. makeToolbar(testcasesCreateLink)
end
local messageName
if subjectSpace == 828 then
messageName = 'experiment-blurb-module'
else
messageName = 'experiment-blurb-template'
end
return message(messageName, {sandboxLinks, testcasesLinks})
end
function p.makeCategoriesBlurb(args, env)
--[[
-- Generates the text "Please add categories to the /doc subpage."
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'doc-link-display' --> '/doc'
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
--]]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))
return message('add-categories-blurb', {docPathLink})
end
function p.makeSubpagesBlurb(args, env)
--[[
-- Generates the "Subpages of this template" link.
-- @args - a table of arguments passed by the user
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'template-pagetype' --> 'template'
-- 'module-pagetype' --> 'module'
-- 'default-pagetype' --> 'page'
-- 'subpages-link-display' --> 'Subpages of this $1'
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
if not subjectSpace or not templateTitle then
return nil
end
local pagetype
if subjectSpace == 10 then
pagetype = message('template-pagetype')
elseif subjectSpace == 828 then
pagetype = message('module-pagetype')
else
pagetype = message('default-pagetype')
end
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
)
return message('subpages-blurb', {subpagesLink})
end
----------------------------------------------------------------------------
-- Tracking categories
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
--[[
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
-- @env - environment table containing title objects, etc., generated with p.getEnvironment
-- Messages:
-- 'display-strange-usage-category' --> true
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
--
-- /testcases pages in the module namespace are not categorised, as they may have
-- {{documentation}} transcluded automatically.
--]]
local title = env.title
local subjectSpace = env.subjectSpace
if not title or not subjectSpace then
return nil
end
local subpage = title.subpageText
if message('display-strange-usage-category', nil, 'boolean')
and (
subpage == message('doc-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
)
then
return makeCategoryLink(message('strange-usage-category'))
end
return ''
end
return p
bo74oekmmsj1xtpw7dlzkvkhc0k05g6
ᥛᥨᥝᥱ ᥓᥧᥰ:Lang
828
426
7927
6041
2026-10-05T22:42:52Z
Saimawnkham
28
7927
Scribunto
text/plain
--[=[
Lua support for the {{lang}}, {{langx}}, {{lang-??}}, and {{transliteration}} templates and replacement of various supporting templates.
]=]
require('strict');
local getArgs = require ('Module:Arguments').getArgs;
local unicode = require ("Module:Unicode data"); -- for is_Latin() and is_rtl()
local yesno = require ('Module:Yesno');
local sandbox = (mw.getCurrentFrame():getTitle():match ('/sandbox') or ''); -- when called from a sandbox template or module load sandbox data and sandbox configuration
local lang_data = mw.loadData ('Module:Lang/data' .. sandbox); -- language name override and transliteration tool-tip tables
local lang_name_table = lang_data.lang_name_table; -- language codes, names, regions, scripts, suppressed scripts
local lang_table = lang_data.lang_name_table.lang;
local lang_dep_table = lang_data.lang_name_table.lang_dep;
local script_table = lang_data.lang_name_table.script;
local region_table = lang_data.lang_name_table.region;
local variant_table = lang_data.lang_name_table.variant;
local suppressed_table = lang_data.lang_name_table.suppressed;
local override_table = lang_data.override;
local synonym_table = mw.loadData ('Module:Lang/ISO 639 synonyms'); -- ISO 639-2/639-2T code translation to 639-1 code
local cfg = mw.loadData ('Module:Lang/configuration' .. sandbox); -- for internationalization
local is_latn_data = mw.loadData ('Module:Lang/data/is latn data');
local sizeof_ranges_t = is_latn_data.sizeof_ranges_t;
local namespace = mw.title.getCurrentTitle().namespace; -- used for categorization
local content_lang = mw.language.getContentLanguage();
local this_wiki_lang_tag = content_lang.code; -- get this wiki's language tag
local this_wiki_lang_dir = content_lang:getDir(); -- get this wiki's language direction
local initial_style_state; -- set by lang_xx_normal() and lang_xx_italic()
local maint_cats = {}; -- maintenance categories go here
local maint_msgs = {}; -- and their messages go here
--[[--------------------------< M A K E _ E R R O R _ S P A N >--------------------------------------------------
]]
local function make_error_span (template, msg)
return table.concat ({'<span style="color:var(--color-error,#d33)">', cfg.misc_text_t.error, ': ', template, msg, '</span>'})
end
--[[--------------------------< S U B S T I T U T E >----------------------------------------------------------
Substitutes $1, $2, etc in <message> with data from <data_t>. Returns plain-text substituted string when
<data_t> not nil; returns <message> else.
]]
local function substitute (message, data_t)
return data_t and mw.message.newRawMessage (message, data_t):plain() or message;
end
--[[--------------------------< M A K E _ E R R O R _ M S G >--------------------------------------------------
Assembles an error message from template name, message text, help link, and error category.
]]
local function make_error_msg (msg, args_t, template)
local category;
local text; -- handle the oddity that is {{langx}}
if cfg.templates_t.langxx == template then
text = args_t.text or args_t[1]; -- for {{lang-xx}}
else
text = args_t.text or args_t[2]; -- for {{lang}}, {{langx}}, and {{transliteration}}
end
if cfg.templates_t.transliteration == template then
category = cfg.make_error_msg_t.xlit_err_cat;
else
category = cfg.make_error_msg_t.lang_err_cat;
end
local category_link = ((0 == namespace or 10 == namespace) and not args_t.nocat) and substitute ('[[Category:$1]]', {category}) or '';
return substitute ('[$1] <span style="color:var(--color-error,#d33)">$2: {{$3}}: $4 ([[:Category:$5|$6]])</span>$7', -- { prevents template name from being treated as a template call in certain situations
{
text or cfg.make_error_msg_t.undefined,
cfg.misc_text_t.error,
template,
msg,
category,
cfg.misc_text_t.help,
category_link
})
end
--[[--------------------------< P A R A M E T E R _ V A L I D A T E >------------------------------------------
]]
local function parameter_validate (args_t, template)
local err_msg = cfg.parameter_validate_t.invalid_param;
if cfg.templates_t.lang == template then -- for {{lang}}
for param, _ in pairs (args_t) do
if not cfg.known_params_t.params_lang_t[param] and -- unique {{lang}} parameters
not cfg.known_params_t.common_params_all_t[param] then -- common to all
return substitute (err_msg, {param}); -- <param> not found so abandon
end
end
elseif cfg.templates_t.langx == template then -- for {{langx}}
for param, _ in pairs (args_t) do
if not cfg.known_params_t.params_langx_t[param] and -- unique {{langx}} parameters
not cfg.known_params_t.params_x_t[param] and -- common to {{langx}} and {{lang-xx}}
not cfg.known_params_t.common_params_all_t[param] then -- common to all
return substitute (err_msg, {param}); -- <param> not found so abandon
end
end
elseif cfg.templates_t.langxx == template then -- for {{lang-xx}}
for param, _ in pairs (args_t) do
if not cfg.known_params_t.params_lang_xx_t[param] and -- unique {{lang-xx}} parameters
not cfg.known_params_t.params_x_t[param] and -- common to {{langx}} and {{lang-xx}}
not cfg.known_params_t.common_params_all_t[param] then -- common to all
return substitute (err_msg, {param}); -- <param> not found so abandon
end
end
end
end
--[[--------------------------< I S _ S E T >------------------------------------------------------------------
Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not
an empty string.
]]
local function is_set (var)
return not (var == nil or var == '');
end
--[[--------------------------< I N V E R T _ I T A L I C S >-------------------------------------------------
This function attempts to invert the italic markup a args.text by adding/removing leading/trailing italic markup
in args.text. Like |italic=unset, |italic=invert disables automatic italic markup. Individual leading/trailing
apostrophes are converted to their HTML numeric entity equivalent so that the new italic markup doesn't become
bold markup inadvertently.
Leading and trailing wiki markup is extracted from args.text into separate table elements. Addition, removal,
replacement of wiki markup is handled by a string.gsub() replacement table operating only on these separate elements.
In the string.gsub() matching pattern, '.*' matches empty string as well as the three expected wiki markup patterns.
This function expects that markup in args.text is complete and correct; if it is not, oddness may result.
]]
local function invert_italics (source)
local invert_pattern_table = { -- leading/trailing markup add/remove/replace patterns
[""]="\'\'", -- empty string becomes italic markup
["\'\'"]="", -- italic markup becomes empty string
["\'\'\'"]="\'\'\'\'\'", -- bold becomes bold italic
["\'\'\'\'\'"]="\'\'\'", -- bold italic become bold
};
local seg = {};
source = source:gsub ("%f[\']\'%f[^\']", '''); -- protect single quote marks from being interpreted as bold markup
seg[1] = source:match ('^(\'\'+%f[^\']).+') or ''; -- get leading markup, if any; ignore single quote
seg[3] = source:match ('.+(%f[\']\'\'+)$') or ''; -- get trailing markup, if any; ignore single quote
if '' ~= seg[1] and '' ~= seg[3] then -- extract the 'text'
seg[2] = source:match ('^\'\'+%f[^\'](.+)%f[\']\'\'+$') -- from between leading and trailing markup
elseif '' ~= seg[1] then
seg[2] = source:match ('^\'\'+%f[^\'](.+)') -- following leading markup
elseif '' ~= seg[3] then
seg[2] = source:match ('(.+)%f[\']\'\'+$') -- preceding trailing markup
else
seg[2] = source -- when there is no markup
end
seg[1] = invert_pattern_table[seg[1]] or seg[1]; -- replace leading markup according to pattern table
seg[3] = invert_pattern_table[seg[3]] or seg[3]; -- replace leading markup according to pattern table
return table.concat (seg); -- put it all back together and done
end
--[[--------------------------< V A L I D A T E _ I T A L I C >------------------------------------------------
Validates |italic= or |italics= assigned values.
When |italic= is set and has an acceptable assigned value, return the matching CSS font-style property value or,
for the special case 'default', return nil.
When |italic= is not set, or has an unacceptable assigned value, return nil and a nil error message.
When both |italic= and |italics= are set, returns nil and a 'conflicting' error message.
The return value nil causes the calling lang, lang_xx, or xlit function to set args.italic according to the template's
defined default ('inherit' for {{lang}}, 'inherit' or 'italic' for {{lang-??}} depending on
the individual template's requirements, 'italic' for {{transliteration}}) or to the value appropriate to |script=, if set ({{lang}}
and {{lang-??}} only).
Accepted values and the values that this function returns are are:
nil - when |italic= absent or not set; returns nil
default - for completeness, should rarely if ever be used; returns nil
yes - force args.text to be rendered in italic font; returns 'italic'
no - force args.text to be rendered in normal font; returns 'normal'
unset - disables font control so that font-style applied to text is dictated by markup inside or outside the template; returns 'inherit'
invert - disables font control so that font-style applied to text is dictated by markup outside or inverted inside the template; returns 'invert'
]]
local function validate_italic (args)
local properties = {[cfg.keywords_t.affirmative] = 'italic', [cfg.keywords_t.negative] = 'normal', [cfg.keywords_t.unset] = 'inherit', [cfg.keywords_t.invert] = 'invert', [cfg.keywords_t.default] = nil};
local italic, count = nil, 0
for _, param in pairs {'italic', 'italics', 'i'} do
local arg = args[param]
if nil ~= arg then
if nil == italic then
italic = arg
end
count = count + 1
end
end
if count > 1 then -- return an error message if more than one is set
return cfg.validate_italic_t.multi_italic;
end
args.style = properties[italic] -- set args.style to an appropriate value
args.italic = italic; -- use args.italic as the canonical parameter
return nil; -- return a nil error message
end
--[=[--------------------------< V A L I D A T E _ C A T _ A R G S >----------------------------------------------------------
Default behavior of the {{lang}} and {{lang-??}} templates is to add categorization when the templates are used in main space.
This default functionality may be suppressed by setting |nocat=yes or |cat=no. This function selects one of these two parameters
to control categorization.
Because having two parameters with 'opposite' names and 'opposite' values is confusing, this function accepts only affirmative
values for |nocat= and only negative values for |cat=; in both cases the 'other' sense (and non-sense) is not accepted and the
parameter is treated as if it were not set in the template.
Sets args.nocat to true if categorization is to be turned off; to nil if the default behavior should apply.
Accepted values for |nocat= are the text strings:
'yes', 'y', 'true', 't', on, '1' -- [[Module:Yesno]] returns logical true for all of these; false or nil else
for |cat=
'no', 'n', 'false', 'f', 'off', '0' -- [[Module:Yesno]] returns logical false for all of these; true or nil else
]=]
local function validate_cat_args (args)
if not (args.nocat or args.cat) then -- both are nil, so categorize
return;
end
if false == yesno (args.cat) or true == yesno (args.nocat) then
args.nocat = true; -- set to true when args.nocat is affirmative; nil else (as if the parameter were not set in the template)
else -- args.nocat is the parameter actually used.
args.nocat = nil;
end
end
--[[--------------------------< I N _ A R R A Y >--------------------------------------------------------------
Whether needle is in haystack.
]]
local function in_array (needle, haystack)
if needle == nil then
return false;
end
for n,v in ipairs (haystack) do
if v == needle then
return n;
end
end
return false;
end
--[[--------------------------< F O R M A T _ I E T F _ T A G >------------------------------------------------
Prettify IETF tags to use recommended subtag formats:
code: lower case
script: sentence case
region: upper case
variant: lower case
private: lower case prefixed with -x-
]]
local function format_ietf_tag (code, script, region, variant, private)
local out = {};
if is_set (private) then
return table.concat ({code:lower(), 'x', private:lower()}, '-'); -- if private, all other tags ignored
end
table.insert (out, code:lower());
if is_set (script) then
script = script:lower():gsub ('^%a', string.upper);
table.insert (out, script);
end
if is_set (region) then
table.insert (out, region:upper());
end
if is_set (variant) then
table.insert (out, variant:lower());
end
return table.concat (out, '-');
end
--[[--------------------------< G E T _ I E T F _ P A R T S >--------------------------------------------------
Extracts and returns IETF language tag parts:
primary language subtag (required) - 2 or 3 character IANA language code
script subtag - four character IANA script code
region subtag - two-letter or three digit IANA region code
variant subtag - four digit or 5-8 alnum variant code; only one variant subtag supported
private subtag - x- followed by 1-8 alnum private code; only supported with the primary language tag
in any one of these forms
lang lang-variant
lang-script lang-script-variant
lang-region lang-region-variant
lang-script-region lang-script-region-variant
lang-x-private
each of lang, script, region, variant, and private, when used, must be valid.
Languages with both two- and three-character code synonyms are promoted to the two-character synonym because
the IANA registry file omits the synonymous three-character code; we cannot depend on browsers understanding
the synonymous three-character codes in the lang= attribute.
For {{lang-??}} templates, the parameters |script=, |region=, and |variant= are supported (not supported in {{lang}}
because those parameters are superfluous to the IETF subtags in |code=).
Returns six values; all lower case. Valid parts are returned as themselves; omitted parts are returned as empty strings, invalid
parts are returned as nil; the sixth returned item is an error message (if an error detected) or nil.
See http://www.rfc-editor.org/rfc/bcp/bcp47.txt section 2.1.
]]
local function get_ietf_parts (source, args_script, args_region, args_variant)
local code, script, region, variant, private; -- IETF tag parts
if not is_set (source) then
return nil, nil, nil, nil, nil, cfg.get_ietf_parts_t.missing_lang_tag;
end
local pattern = { -- table of tables holding acceptable IETF tag patterns and short names of the IETF part captured by the pattern
{'^(%a%a%a?)%-(%a%a%a%a)%-(%a%a)%-(%d%d%d%d)$', 's', 'r', 'v'}, -- 1 - ll-Ssss-RR-variant (where variant is 4 digits)
{'^(%a%a%a?)%-(%a%a%a%a)%-(%d%d%d)%-(%d%d%d%d)$', 's', 'r', 'v'}, -- 2 - ll-Ssss-DDD-variant (where region is 3 digits; variant is 4 digits)
{'^(%a%a%a?)%-(%a%a%a%a)%-(%a%a)%-(%w%w%w%w%w%w?%w?%w?)$', 's', 'r', 'v'}, -- 3 - ll-Ssss-RR-variant (where variant is 5-8 alnum characters)
{'^(%a%a%a?)%-(%a%a%a%a)%-(%d%d%d)%-(%w%w%w%w%w%w?%w?%w?)$', 's', 'r', 'v'}, -- 4 - ll-Ssss-DDD-variant (where region is 3 digits; variant is 5-8 alnum characters)
{'^(%a%a%a?)%-(%a%a%a%a)%-(%d%d%d%d)$', 's', 'v'}, -- 5 - ll-Ssss-variant (where variant is 4 digits)
{'^(%a%a%a?)%-(%a%a%a%a)%-(%w%w%w%w%w%w?%w?%w?)$', 's', 'v'}, -- 6 - ll-Ssss-variant (where variant is 5-8 alnum characters)
{'^(%a%a%a?)%-(%a%a)%-(%d%d%d%d)$', 'r', 'v'}, -- 7 - ll-RR-variant (where variant is 4 digits)
{'^(%a%a%a?)%-(%d%d%d)%-(%d%d%d%d)$', 'r', 'v'}, -- 8 - ll-DDD-variant (where region is 3 digits; variant is 4 digits)
{'^(%a%a%a?)%-(%a%a)%-(%w%w%w%w%w%w?%w?%w?)$', 'r', 'v'}, -- 9 - ll-RR-variant (where variant is 5-8 alnum characters)
{'^(%a%a%a?)%-(%d%d%d)%-(%w%w%w%w%w%w?%w?%w?)$', 'r', 'v'}, -- 10 - ll-DDD-variant (where region is 3 digits; variant is 5-8 alnum characters)
{'^(%a%a%a?)%-(%d%d%d%d)$', 'v'}, -- 11 - ll-variant (where variant is 4 digits)
{'^(%a%a%a?)%-(%w%w%w%w%w%w?%w?%w?)$', 'v'}, -- 12 - ll-variant (where variant is 5-8 alnum characters)
{'^(%a%a%a?)%-(%a%a%a%a)%-(%a%a)$', 's', 'r'}, -- 13 - ll-Ssss-RR
{'^(%a%a%a?)%-(%a%a%a%a)%-(%d%d%d)$', 's', 'r'}, -- 14 - ll-Ssss-DDD (region is 3 digits)
{'^(%a%a%a?)%-(%a%a%a%a)$', 's'}, -- 15 - ll-Ssss
{'^(%a%a%a?)%-(%a%a)$', 'r'}, -- 16 - ll-RR
{'^(%a%a%a?)%-(%d%d%d)$', 'r'}, -- 17 - ll-DDD (region is 3 digits)
{'^(%a%a%a?)$'}, -- 18 - ll
{'^(%a%a%a?)%-x%-(%w%w?%w?%w?%w?%w?%w?%w?)$', 'p'}, -- 19 - ll-x-pppppppp (private is 1-8 alnum characters)
}
local t = {}; -- table of captures; serves as a translator between captured IETF tag parts and named variables
for i, v in ipairs (pattern) do -- spin through the pattern table looking for a match
local c1, c2, c3, c4; -- captures in the 'pattern' from the pattern table go here
c1, c2, c3, c4 = source:match (pattern[i][1]); -- one or more captures set if source matches pattern[i])
if c1 then -- c1 always set on match
code = c1; -- first capture is always code
t = {
[pattern[i][2] or 'x'] = c2, -- fill the table of captures with the rest of the captures
[pattern[i][3] or 'x'] = c3, -- take index names from pattern table and assign sequential captures
[pattern[i][4] or 'x'] = c4, -- index name may be nil in pattern[i] table so "or 'x'" spoofs a name for this index in this table
};
script = t.s or ''; -- translate table contents to named variables;
region = t.r or ''; -- absent table entries are nil so set named IETF parts to empty string for concatenation
variant= t.v or '';
private = t.p or '';
break; -- and done
end
end
if not code then
return nil, nil, nil, nil, nil, substitute (cfg.get_ietf_parts_t.unrecog_tag, {source}); -- don't know what we got but it is malformed
end
code = code:lower(); -- ensure that we use and return lower case version of this
if not (override_table[code] or lang_table[code] or synonym_table[code] or lang_dep_table[code]) then
return nil, nil, nil, nil, nil, substitute (cfg.get_ietf_parts_t.unrecog_code, {code}); -- invalid language code, don't know about the others (don't care?)
end
if synonym_table[code] then -- if 639-2/639-2T code has a 639-1 synonym
table.insert (maint_cats, substitute (cfg.get_ietf_parts_t.maint_promo_cat, {code}));
table.insert (maint_msgs, substitute (cfg.get_ietf_parts_t.maint_promo_msg, {code, synonym_table[code]}));
code = synonym_table[code]; -- use the synonym
end
if is_set (script) then
if is_set (args_script) then
return code, nil, nil, nil, nil, cfg.get_ietf_parts_t.redundant_scr; -- both code with script and |script= not allowed
end
else
script = args_script or ''; -- use args.script if provided
end
if is_set (script) then
script = script:lower(); -- ensure that we use and return lower case version of this
if not script_table[script] then
return code, nil, nil, nil, nil, substitute (cfg.get_ietf_parts_t.unrecog_scr_code, {script, code}); -- language code OK, invalid script, don't know about the others (don't care?)
end
end
if suppressed_table[script] then -- ensure that code-script does not use a suppressed script
if in_array (code, suppressed_table[script]) then
return code, nil, nil, nil, nil, substitute (cfg.get_ietf_parts_t.script_code, {script, code}); -- language code OK, script is suppressed for this code
end
end
if is_set (region) then
if is_set (args_region) then
return code, nil, nil, nil, nil, cfg.get_ietf_parts_t.redundant_reg; -- both code with region and |region= not allowed
end
else
region = args_region or ''; -- use args.region if provided
end
if is_set (region) then
region = region:lower(); -- ensure that we use and return lower case version of this
if not region_table[region] then
return code, script, nil, nil, nil, substitute (cfg.get_ietf_parts_t.unrecog_reg_code, {region, code});
end
end
if is_set (variant) then
if is_set (args_variant) then
return code, nil, nil, nil, nil, cfg.get_ietf_parts_t.redundant_var; -- both code with variant and |variant= not allowed
end
else
variant = args_variant or ''; -- use args.variant if provided
end
if is_set (variant) then
variant = variant:lower(); -- ensure that we use and return lower case version of this
if not variant_table[variant] then -- make sure variant is valid
return code, script, region, nil, nil, substitute (cfg.get_ietf_parts_t.unrecog_var, {variant});
end -- does this duplicate/replace tests in lang() and lang_xx()?
if is_set (script) then -- if script set it must be part of the 'prefix'
if not in_array (table.concat ({code, '-', script}), variant_table[variant]['prefixes']) then
return code, script, region, nil, nil, substitute (cfg.get_ietf_parts_t.unrecog_var_code_scr, {variant, code, script});
end
elseif is_set (region) then -- if region set, there are some prefixes that require lang code and region (en-CA-newfound)
if not in_array (code, variant_table[variant]['prefixes']) then -- first see if lang code is all that's required (en-oxendict though en-GB-oxendict is preferred)
if not in_array (table.concat ({code, '-', region}), variant_table[variant]['prefixes']) then -- now try for lang code and region (en-CA-newfound)
return code, script, region, nil, nil, substitute (cfg.get_ietf_parts_t.unrecog_var_code_reg, {variant, code, region});
end
end
else -- cheap way to determine if there are prefixes; fonipa and others don't have prefixes; # operator always returns 0
if variant_table[variant]['prefixes'][1] and not in_array (code, variant_table[variant]['prefixes']) then
return code, script, region, nil, nil, substitute (cfg.get_ietf_parts_t.unrecog_var_code, {variant, code});
end
end
end
if is_set (private) then
private = private:lower(); -- ensure that we use and return lower case version of this
if not override_table[table.concat ({code, '-x-', private})] then -- make sure private tag is valid; note that index
return code, script, region, nil, nil, substitute (cfg.get_ietf_parts_t.unrecog_pri, {private});
end
end
return code, script, region, variant, private, nil; -- return the good bits; make sure that msg is nil
end
--[=[-------------------------< M A K E _ W I K I L I N K >----------------------------------------------------
Makes a wikilink; when both link and display text is provided, returns a wikilink in the form [[L|D]]; if only
link is provided, returns a wikilink in the form [[L]]; if neither are provided or link is omitted, returns an
empty string.
]=]
local function make_wikilink (link, display)
if is_set (link) then
if is_set (display) then
return table.concat ({'[[', link, '|', display, ']]'});
else
return table.concat ({'[[', link, ']]'});
end
else
return '';
end
end
--[[--------------------------< D I V _ M A R K U P _ A D D >--------------------------------------------------
Adds <i> and </i> tags to list-item text or to implied <p>..</p> text. Mixed not supported.
]]
local function div_markup_add (text, style)
if text:find ('^\n[%*:;#]') then -- look for list markup; list markup must begin at start of text
if 'italic' == style then
return text:gsub ('(\n[%*:;#]+)([^\n]+)', '%1<i>%2</i>'); -- insert italic markup at each list item
else
return text;
end
end
if text:find ('\n+') then -- look for any number of \n characters in text
text = text:gsub ('([^\n])\n([^\n])', '%1 %2'); -- replace single newline characters with a space character which mimics MediaWiki
if 'italic' == style then
text = text:gsub('[^\n]+', '<p><i>%1</i></p>'); -- insert p and italic markup tags at each implied p (two or more consecutive '\n\n' sequences)
else
text = text:gsub ('[^\n]+', '<p>%1</p>'); -- insert p markup at each implied p
text = text:gsub ('\n', ''); -- strip newline characters
end
end
return text;
end
--[[--------------------------< T I T L E _ W R A P P E R _ M A K E >------------------------------------------
Makes a <span title="<title text>"><content_text></span> or <div title="<title text>"><content_text></div> where
<title text> is in the tool-tip in the wiki's local language and <content_text> is non-local-language text in
HTML markup. This because the lang= attribute applies to the content of its enclosing tag.
<tag> holds a string 'div' or 'span' used to choose the correct wrapping tag.
]]
local function title_wrapper_make (title_text, content_text, tag)
local wrapper_t = {};
table.insert (wrapper_t, table.concat ({'<', tag})); -- open opening wrapper tag
table.insert (wrapper_t, ' title=\"'); -- begin title attribute
table.insert (wrapper_t, title_text); -- add <title_text>
table.insert (wrapper_t, '\">'); -- end title attribute and close opening wrapper tag
table.insert (wrapper_t, content_text); -- add <content_text>
table.insert (wrapper_t, table.concat ({'</', tag, '>'})); -- add closing wrapper tag
return table.concat (wrapper_t); -- make a big string and done
end
--[[--------------------------< M A K E _ T E X T _ H T M L >--------------------------------------------------
Add the HTML markup to text according to the type of content that it is: <span> or <i> tags for inline content or
<div> tags for block content
The lang= attribute also applies to the content of the tag where it is placed so this is wrong because 'Spanish
language text' is English:
<i lang="es" title="Spanish language text">casa</i>
should be:
<span title="Spanish language text"><i lang="es">casa</i></span>
or for <div>...</div>:
<div title="Spanish language text"><div lang="es"><spanish-language-text></div></div>
]]
local function make_text_html (code, text, tag, rtl, style, size, language)
local html_t = {};
local style_added = '';
local wrapper_tag = tag; -- <tag> gets modified so save a copy for use when/if we create a wrapper span or div
if text:match ('^%*') then
table.insert (html_t, '*'); -- move proto language text prefix outside of italic markup if any; use numeric entity because plain splat confuses MediaWiki
text = text:gsub ('^%*', ''); -- remove the splat from the text
end
if 'span' == tag then -- default HTML tag for inline content
if 'italic' == style then -- but if italic
tag = 'i'; -- change to <i> tags
end
else -- must be div so go
text = div_markup_add (text, style); -- handle implied <p>, implied <p> with <i>, and list markup (*;:#) with <i>
end
table.insert (html_t, table.concat ({'<', tag})); -- open the <i>, <span>, or <div> HTML tag
code = code:gsub ('%-x%-.*', ''); -- strip private use subtag from code tag because meaningless outside of Wikipedia
table.insert (html_t, table.concat ({' lang="', code, '\"'})); -- add language attribute
if (rtl or unicode.is_rtl(text)) and ('ltr' == this_wiki_lang_dir) then -- text is right-to-left on a left-to-right wiki
table.insert (html_t, ' dir="rtl"'); -- add direction attribute for right-to-left languages
elseif not (rtl or unicode.is_rtl(text)) and ('rtl' == this_wiki_lang_dir) then -- text is left-to-right on a right-to-left wiki
table.insert (html_t, ' dir="ltr"'); -- add direction attribute for left-to-right languages
end
if 'normal' == style then -- when |italic=no
table.insert (html_t, ' style=\"font-style: normal;'); -- override external markup, if any
style_added = '\"'; -- remember that style attribute added and is not yet closed
end
if is_set (size) then -- when |size=<something>
if is_set (style_added) then
table.insert (html_t, table.concat ({' font-size: ', size, ';'})); -- add when style attribute already inserted
else
table.insert (html_t, table.concat ({' style=\"font-size: ', size, ';'})); -- create style attribute
style_added = '\"'; -- remember that style attribute added and is not yet closed
end
end
table.insert (html_t, table.concat ({style_added, '>'})); -- close the opening HTML tag
table.insert (html_t, text); -- insert the text
table.insert (html_t, table.concat ({'</', tag, '>'})); -- close the 'text' <i>, <span>, or <div> HTML tag
if is_set (language) then -- create a <title_text> string for the title= attribute in a wrapper span or div
local title_text;
if 'zxx' == code then -- special case for this tag 'no linguistic content'
title_text = substitute ('$1 $2', {language, cfg.make_text_html_t.zxx}); -- not a language so don't use 'language' in title text
elseif mw.ustring.find (language, 'languages', 1, true) then
title_text = substitute ('$1 $2', {language, cfg.make_text_html_t.collective}); -- for collective languages
else
title_text = substitute ('$1-$2', {language, cfg.make_text_html_t.individual}); -- for individual languages
end
return title_wrapper_make (title_text, table.concat (html_t), wrapper_tag);
else
return table.concat (html_t);
end
end
--[=[-------------------------< M A K E _ C A T E G O R Y >----------------------------------------------------
For individual language, <language>, returns:
[[Category:Articles containing <language>-language text]]
For English:
[[Category:Articles containing explicitly cited English-language text]]
For ISO 639-2 collective languages (and for 639-1 bh):
[[Category:Articles with text in <language> languages]]
]=]
local function make_category (code, language_name, nocat, name_get)
if ((0 ~= namespace) or nocat) and not name_get then -- only categorize in article space
return ''; -- return empty string for concatenation
end
if mw.ustring.find (language_name, 'languages', 1, true) then
return substitute ('[[$1 $2]]', {cfg.make_category_t.collective_cat, language_name});
end
if this_wiki_lang_tag == code then
return substitute ('[[$1 $2 $3-$4]]', { -- unique category name for the local language
cfg.make_category_t.cat_prefix,
cfg.make_category_t.explicit_cat,
language_name,
cfg.make_category_t.cat_postfix,
});
else
return substitute ('[[$1 $2-$3]]', { -- category for individual languages
cfg.make_category_t.cat_prefix,
language_name,
cfg.make_category_t.cat_postfix,
});
end
end
--[[--------------------------< M A K E _ T R A N S L I T >----------------------------------------------------
Return translit <i lang=xx-Latn>...</i> where xx is the language code; else return empty string.
The value |script= is not used in {{transliteration}} for this purpose; instead it uses |code. Because language scripts
are listed in the {{transliteration}} switches they are included in the data tables. The script parameter is introduced
at {{Language with name and transliteration}}. If |script= is set, this function uses it in preference to code.
To avoid confusion, in this module and the templates that use it, the transliteration script parameter is renamed
to be |translit-script= (in this function, tscript).
This function is used by both lang_xx() and xlit()
lang_xx() always provides code, language_name, and translit; may provide tscript; never provides style
xlit() always provides language_name, translit, and one of code or tscript, never both; always provides style
For {{transliteration}}, style only applies when a language code is provided.
]]
local function make_translit (code, language_name, translit, std, tscript, style, engvar)
local title_t = lang_data.translit_title_table; -- table of transliteration standards and the language codes and scripts that apply to those standards
local title_text = ''; -- tool tip text for title= attribute
std = std and std:lower(); -- lower case for table indexing
if not is_set (std) and not is_set (tscript) then -- when neither standard nor script specified
title_text = language_name; -- write a generic tool tip
if not mw.ustring.find (language_name, 'languages', 1, true) then -- collective language names (plural 'languages' is part of the name)
title_text = substitute ('$1-$2', {title_text, cfg.misc_text_t.language}); -- skip this text (individual and macro languages only)
end
title_text = substitute ('$1 $2', {title_text, mw.ustring.lower (cfg.engvar_t[engvar]['romanisz_lc'])}); -- finish the tool tip; use romanization when neither script nor standard supplied
elseif is_set (std) and is_set (tscript) then -- when both are specified
if title_t[std] then -- and if standard is legitimate
if title_t[std][tscript] then -- and if script for that standard is legitimate
if script_table[tscript] then
title_text = substitute ('$1$2 ($3 $4) $5', { -- add the appropriate text to the tool tip
title_text,
title_t[std][tscript:lower()],
script_table[tscript],
cfg.make_translit_t.script,
cfg.make_translit_t.transliteration,
});
else
title_text = title_text .. title_t[std]['default']; -- use the default if script not in std table; TODO: maint cat? error message because script not found for this standard?
end
else
title_text = title_text .. title_t[std]['default']; -- use the default if script not in std table; TODO: maint cat? error message because script not found for this standard?
end
else
return ''; -- invalid standard, setup for error message
end
elseif is_set (std) then -- translit-script not set, use language code
if not title_t[std] then return ''; end -- invalid standard, setup for error message
if title_t[std][code] then -- if language code is in the table (xlit may not provide a language code)
local fmt_str = '$1$2 ($3 $4) $5'; -- generic format string for tool tip
if language_name:match ('languages') then
fmt_str = '$1$2 ($3) $5'; -- format string for collective languages tool tip
end
title_text = substitute (fmt_str, { -- add the appropriate text to the tool tip
title_text,
title_t[std][code:lower()],
language_name,
cfg.misc_text_t.language,
cfg.make_translit_t.transliteration,
});
else -- code doesn't match
title_text = title_text .. title_t[std]['default']; -- so use the standard's default
end
else -- here if translit-script set but translit-std not set
if title_t['no_std'][tscript] then
title_text = title_text .. title_t['no_std'][tscript]; -- use translit-script if set
elseif title_t['no_std'][code] then
title_text = title_text .. title_t['no_std'][code]; -- use language code
else
if is_set (tscript) then
title_text = substitute ('$1$2-$3 $4', { -- write a script tool tip
title_text,
language_name,
cfg.make_translit_t.script,
cfg.make_translit_t.transliteration,
});
elseif is_set (code) then
if not mw.ustring.find (language_name, 'languages', 1, true) then -- collective language names (plural 'languages' is part of the name)
title_text = substitute ('$1-$2', { -- skip this text (individual and macro languages only)
title_text,
cfg.misc_text_t.language,
});
end
title_text = substitute ('$1 $2', { -- finish the tool tip
title_text,
cfg.make_translit_t.transliteration,
});
else
title_text = substitute ('$1 $2', { -- generic tool tip (can we ever get here?)
title_text,
cfg.make_translit_t.transliteration,
});
end
end
end
local tag
if is_set (code) then -- when a language code is provided (always with {{lang-??}} templates, not always with {{transliteration}})
code = code:match ('^(%a%a%a?)'); -- strip all subtags leaving only the language subtag
if not style then -- nil for the default italic style
tag = '<i lang="%s-Latn">%s</i>'
else
tag = '<span style="font-style: %s" lang="%s-Latn">%s</span>' -- non-standard style, construct a span tag for it
tag = string.format(tag, style, "%s", "%s")
end
tag = string.format(tag, code, "%s")
else
tag = '<span>%s</span>' -- when no language code: no lang= attribute, not italic ({{transliteration}} only)
end
tag = string.format(tag, translit) -- add the translit text
if '' == title_text then -- when there is no need for a tool-tip
return tag; -- done
else
title_text = cfg.engvar_sel_t.gb == engvar and title_text:gsub ('([Rr]omani)z', '%1s') or title_text; -- gb eng when engvar specifies gb eng; us eng else
return title_wrapper_make (title_text, tag, 'span'); -- wrap with a tool-tip span and done
end
end
--[[--------------------------< V A L I D A T E _ T E X T >----------------------------------------------------
This function checks the content of args.text and returns empty string if nothing is amiss else it returns an
error message. The tests are for empty or missing text and for improper or disallowed use of apostrophe markup.
Italic rendering is controlled by the |italic= template parameter so italic markup should never appear in args.text
either as ''itself'' or as '''''bold italic''''' unless |italic=unset or |italic=invert.
]]
local function validate_text (template, args)
if not is_set (args.text) then
return make_error_msg (cfg.validate_text_t.no_text, args, template);
end
if args.text:find ("%f[\']\'\'\'\'%f[^\']") or args.text:find ("\'\'\'\'\'[\']+") then -- because we're looking, look for 4 appostrophes or 6+ appostrophes
return make_error_msg (cfg.validate_text_t.malformed_markup, args, template);
end
local italic = args.italic;
if (cfg.keywords_t.unset ~= italic) and (cfg.keywords_t.invert ~= italic) then
if args.text:find ("%f[\']\'\'%f[^\']") or args.text:find ("%f[\']\'\'\'\'\'%f[^\']") then -- italic but not bold, or bold italic
return make_error_msg (cfg.validate_text_t.italic_markup, args, template);
end
end
end
--[[--------------------------< R E N D E R _ M A I N T >------------------------------------------------------
Render mainenance messages and categories.
]]
local function render_maint (nocat)
local maint = {};
if 0 < #maint_msgs then -- when there are maintenance messages
table.insert (maint, table.concat ({'<span class="lang-comment" style="font-style: normal; display: none; color: #33aa33; margin-left: 0.3em;">'})); -- opening <span> tag
for _, msg in ipairs (maint_msgs) do
table.insert (maint, table.concat ({msg, ' '})); -- add message strings
end
table.insert (maint, '</span>'); -- close the span
end
if (0 < #maint_cats) and (0 == namespace) and not nocat then -- when there are maintenance categories; article namespace only
for _, cat in ipairs (maint_cats) do
table.insert (maint, table.concat ({'[[Category:', cat, ']]'})); -- format and add the categories
end
end
return table.concat (maint);
end
--[[--------------------------< P R O T O _ P R E F I X >------------------------------------------------------
For proto languages, text is prefixed with a splat. We do that here as a flag for make_text_html() so that a splat
will be rendered outside of italic markup (if used). If the first character in text here is already a splat, we
do nothing.
proto_param is boolean or nil; true adds splat prefix regardless of language name; false removes and inhibits
regardless of language name; nil does nothing; presumes that the value in text is correct but removes extra splac.
]]
local function proto_prefix (text, language_name, proto_param)
if false == proto_param then -- when forced by |proto=no
return text:gsub ('^%**', ''); -- return text without splat prefix regardless of language name or existing splat prefix in text
elseif (language_name:find ('^Proto%-') or (true == proto_param)) then -- language is a proto or forced by |proto=yes
return text:gsub ('^%**', '*'); -- prefix proto-language text with a splat; also removes duplicate prefixing splats
end
return text:gsub ('^%*+', '*'); -- return text unmolested except multiple splats reduced to one splat
end
--[[--------------------------< H A S _ P O E M _ T A G >------------------------------------------------------
Looks for a poem strip marker in text; returns true when found; false else.
Auto-italic detection disabled when text has poem stripmarker because it is not possible for this code to know
the content that will replace the stripmarker.
]]
local function has_poem_tag (text)
return text:find ('\127[^\127]*UNIQ%-%-poem%-[%a%d]+%-QINU[^\127]*\127') and true or false;
end
--[[--------------------------< H T M L _ T A G _ S E L E C T >------------------------------------------------
Inspects content of and selectively trims text. Returns text and the name of an appropriate HTML tag for text.
If text contains:
\n\n text has implied <p>..</p> tags - trim leading and trailing whitespace and return
If text begins with list markup:
\n* unordered
\n; definition
\n: definition
\n# ordered
trim all leading whitespace except \n and trim all trailing whitespace
If text contains <poem>...</poem> stripmarker, return text unmodified and choose <div>..</div> tags because
the stripmarker is replaced with text wrapped in <div>..</div> tags.
If the text contains any actual <div>...</div> tags, then it's again returned unmodified and <div>...</div>
tags are used to wrap it, to prevent div/span inversion.
]]
local function html_tag_select (text)
local tag;
if has_poem_tag (text) then -- contains poem stripmarker (we can't know the content of that)
tag = 'div'; -- poem replacement is in div tags so lang must use div tags
elseif text:find ('<div') then -- reductive; if the text contains a div tag, we must use div tags
tag = 'div';
elseif mw.text.trim (text):find ('\n\n+') then -- contains implied p tags
text = mw.text.trim (text); -- trim leading and trailing whitespace characters
tag = 'div'; -- must be div because span may not contain p tags (added later by MediaWiki); poem replacement is in div tags
elseif text:find ('\n[%*:;%#]') then -- if text has list markup
text = text:gsub ('^[\t\r\f ]*', ''):gsub ('%s*$', ''); -- trim all whitespace except leading newline character '\n'
tag = 'div'; -- must be div because span may not contain ul, dd, dl, ol tags (added later by MediaWiki)
else
text = mw.text.trim (text); -- plain text
tag = 'span'; -- so span is fine
end
return text, tag;
end
--[[--------------------------< V A L I D A T E _ P R O T O >--------------------------------------------------
Validates value assigned to |proto=; permitted values are yes and no; yes returns as true, no returns as false,
empty string (or parameter omitted) returns as nil; any other value returns nil with <proto_param> as second
return value for use in error message.
]]
local function validate_proto (proto_param)
if cfg.keywords_t.affirmative == proto_param then
return true;
elseif cfg.keywords_t.negative == proto_param then
return false;
elseif is_set (proto_param) then
return nil, proto_param; -- |proto= something other than 'yes' or 'no'
else
return nil; -- missing or empty
end
end
--[[--------------------------< L A N G U A G E _ N A M E _ G E T >--------------------------------------------
Common function to return language name from the data set according to IETF tag.
Returns language name if found in data tables; nil else.
]]
local function language_name_get (ietf, code, cat)
ietf = ietf:lower(); -- ietf:lower() because format_ietf_tag() returns mixed case
local name; -- remains nil if not found
if override_table[ietf] then -- look for whole IETF tag in override table
name = override_table[ietf];
elseif override_table[code] then -- not there so try basic language tag
name = override_table[code];
elseif lang_table[code] then -- shift to IANA active tag/name table
name = lang_table[code];
elseif lang_dep_table[code] then -- try the IANA deprecated tag/name table
name = lang_dep_table[code];
end
if lang_dep_table[code] and cat then -- because deprecated code may have been overridden to en.wiki preferred name
table.insert (maint_cats, substitute (cfg.language_name_get_t.deprecated_cat, {code}));
table.insert (maint_msgs, substitute (cfg.language_name_get_t.deprecated_msg, {code}));
end
return name; -- name from data tables or nil
end
--[[--------------------------< T E X T _ S C R I P T _ M A T C H _ T E S T >----------------------------------
IETF script subtag should match the script of the <text>. This module does not attempt to know all scripts and
what they look like. It does know what Latn script looks like so when <text> is written using other than the Latn
script, the IETF script subtag, if present, should not be Latn.
Conversely, when <text> is written using the Latn script, the IETF script subtag, if present, should be Latn.
For the purposes of this test, Latf (Fraktur) and Latg (Gaelic) are considered to be equivalent to Latn because
unicode treats these two scripts as font-specific variants of Latn.
Returns an error message when mismatch detected; nil else.
]]
local function text_script_match_test (script, is_latn_text, pos, char)
local scripts_t = {['latf'] = true, ['latg'] = true, ['latn'] = true}; -- unicode 'latn' scripts; 'latf' and 'latg' are font variants so there are no Fraktur or Gaelic codepoints
if is_set (script) then -- don't bother with the rest of this if <script> is nil or empty string
script = script:lower(); -- lower case to index into <scripts_t>
if is_latn_text then -- when text is wholly Latn script
if not scripts_t[script] then -- but a non-Latn script is specified
return cfg.text_script_match_test_t.latn_txt_mismatch; -- emit an error message
end
else -- when text is not wholly Latn script
if scripts_t[script] then -- but a Latn script is specified
return substitute (cfg.text_script_match_test_t.latn_scr_mismatch, {pos, char}); -- emit an error message with position of first offending character
end
end
end
end
--[[--------------------------< B I N A R Y _ S E A R C H >---------------------------------------------------
conducts a binary search of <ranges_t> for a sub-range that holds <target>.
returns boolean true if a sub-range holding <target> is found; boolean false else.
]]
local function binary_search (target, ranges_t)
local idx_bot = 1; -- initialize to index of first key
local idx_top = sizeof_ranges_t; -- initialize to index of last key (number of keys)
if (target < ranges_t[idx_bot][1]) or (target > ranges_t[idx_top][2]) then -- invalid; target out of range
return; -- abandon
end
local idx_mid; -- calculated index of range midway between top index and bottom index
local flag = false; -- flag to tell us when we've evaluated last (highest) range in <ranges_t>
while 1 do
idx_mid = math.ceil ((idx_bot + idx_top) / 2); -- get the mid-point in the <ranges_t> sequence
if (target >= ranges_t[idx_mid][1]) and (target <= ranges_t[idx_mid][2]) then -- indexed range low value <= target <= indexed range high value
return true; -- we found the range that holds the <target> character; return true
elseif (target > ranges_t[idx_mid][2]) then -- is <target> > indexed range high value?
idx_bot = idx_mid; -- adjust <idx_bot> up
else -- here when <target> less than indexed range low value
idx_top = idx_mid - 1; -- adjust <idx_top> down
end
if flag then
break; -- here when we just evaluated the last range and <target> not found
end
if not flag and (idx_bot == idx_top) then -- set true just before we evaluate the last (highest) range in <ranges_t>
flag = true;
end
end
end
--[[--------------------------< I S _ L A T I N >--------------------------------------------------------------
compare <text> as codepoints to lists of known codepoints accepted as Latn script
returns boolean true and modified <text> when <text> is wrapped in accept-as-written markup
returns boolean true and <text> when codepoint is known
returns boolean false, <text>, non-Latn codepoint position in <text> (left to right), and the codepoint character
when codepoint is not known
TODO: when text has accept-as-written markup, return a non-boolean value to indicate that <text> is not wholly
latn script? Use that return value to create non-Latn HTML lang= attribute because <text> isn't really
latn so lang=und (undetermined)? or instead, omit the -Latn subtag? (without -Latn need to force |italic=yes)
]]
local function is_latin (text, tag)
local count;
text, count = text:gsub ('^%(%((.+)%)%)$', '%1'); -- remove accept-as-written markup if present
if 0 ~= count then
return true, text; -- markup present so assume that <text> is Latn-script
end
local pos = 0; -- position counter for error messaging
for codepoint in mw.ustring.gcodepoint (text) do -- fetch each code point
pos = pos + 1; -- bump the position counter
if not is_latn_data.singles_t[codepoint] and -- codepoint not found in the singles list?
not binary_search (codepoint, is_latn_data.ranges_t) and -- codepoint not a member of a listed range?
not (tag and is_latn_data.specials_t[codepoint] and is_latn_data.specials_t[codepoint][tag]) then -- not a language-specific codepoint?
return false, text, pos, mw.ustring.char (codepoint); -- codepoint not known; return false with codepoint position and character representation
end
end
return true, text; -- is known; return <text>
end
--[[--------------------------< _ L A N G >--------------------------------------------------------------------
Entry point for {{lang}}.
There should be no reason to set parameters in the {{lang}} {{#invoke:}}
<includeonly>{{#invoke:lang|lang}}</includeonly>
Parameters are received from the template's frame (parent frame).
]]
local function _lang (args)
local out = {};
local language_name; -- used to make category names
local category_name; -- same as language_name except that it retains any parenthetical disambiguators (if any) from the data set
local subtags = {}; -- IETF subtags script, region, variant, and private
local code; -- the language code
local msg; -- for error messages
local tag = 'span'; -- initial value for make_text_html()
local template = args.template or cfg.templates_t.lang;
maint_cats = {}; -- initialize because when this module required into another module, these only declared once so only initialzed once
maint_msgs = {};
validate_cat_args (args); -- determine if categorization should be suppressed
if args[1] and args.code then
return make_error_msg (substitute (cfg.lang_t.conflict_n_param, {'1', cfg.lang_t.conflict_n_param_types.code}), args, template);
else
args.code = args[1] or args.code; -- prefer args.code
end
if args[2] and args.text then
return make_error_msg (substitute (cfg.lang_t.conflict_n_param, {'2', cfg.lang_t.conflict_n_param_types.text}), args, template);
else
args.text = args[2] or args.text; -- prefer args.text
end
msg = validate_italic (args);
if msg then
return make_error_msg (msg, args, template);
end
msg = validate_text (template, args); -- ensure that |text= is set
if is_set (msg) then -- msg is an already-formatted error message
return msg;
end
args.text, tag = html_tag_select (args.text); -- inspects text; returns appropriate HTML tag with text trimmed accordingly
args.rtl = args.rtl == cfg.keywords_t.affirmative; -- convert to boolean: 'yes' -> true, other values -> false
args.proto, msg = validate_proto (args.proto); -- return boolean, or nil, or nil and error message flag
if msg then
return make_error_msg (substitute (cfg.lang_t.invalid_proto, {msg}), args, template);
end
code, subtags.script, subtags.region, subtags.variant, subtags.private, msg = get_ietf_parts (args.code); -- |script=, |region=, |variant= not supported because they should be part of args.code ({{{1}}} in {{lang}})
if msg then
return make_error_msg (msg, args, template);
end
local is_latn_text, pos, char;
is_latn_text, args.text, pos, char= is_latin (args.text, code); -- make a boolean
msg = text_script_match_test (subtags.script, is_latn_text, pos, char)
if msg then -- if an error detected then there is an error message
return make_error_msg (msg, args, template);
end
if nil == args.style then -- nil when |italic= absent or not set or |italic=default; args.style controls
if ('latn' == subtags.script) or -- script is latn
(this_wiki_lang_tag ~= code and not is_set (subtags.script) and not has_poem_tag (args.text) and is_latn_text) then -- text not this wiki's language, no script specified and not in poem markup but is wholly latn script (auto-italics)
args.style = 'italic'; -- DEFAULT for {{lang}} templates is upright; but if latn script set for font-style:italic
else
args.style = 'inherit'; -- italic not set; script not latn; inherit current style
end
end
if is_set (subtags.script) then -- if script set, override rtl setting
if in_array (subtags.script, lang_data.rtl_scripts) then
args.rtl = true; -- script is an rtl script
else
args.rtl = false; -- script is not an rtl script
end
end
args.code = format_ietf_tag (code, subtags.script, subtags.region, subtags.variant, subtags.private); -- format to recommended subtag styles
language_name = language_name_get (args.code, code, true); -- get language name; try IETF tag first, then code w/o variant then code w/ variant
if cfg.keywords_t.invert == args.style and 'span' == tag then -- invert only supported for in-line content
args.text = invert_italics (args.text)
end
args.text = proto_prefix (args.text, language_name, args.proto); -- prefix proto-language text with a splat
table.insert (out, make_text_html (args.code, args.text, tag, args.rtl, args.style, args.size, language_name));
table.insert (out, make_category (code, language_name, args.nocat));
table.insert (out, render_maint (args.nocat)); -- maintenance messages and categories
return table.concat (out); -- put it all together and done
end
--[[--------------------------< L A N G >----------------------------------------------------------------------
Entry point for {{lang}}.
There should be no reason to set parameters in the {{lang}} {{#invoke:}}
<includeonly>{{#invoke:lang|lang}}</includeonly>
Parameters are received from the template's frame (parent frame).
]]
local function lang (frame)
local args_t = getArgs (frame, { -- this code so that we can detect and handle wiki list markup in text
valueFunc = function (key, value)
if 2 == key or 'text' == key then -- the 'text' parameter; do not trim wite space
return value; -- return untrimmed 'text'
elseif value then -- all other values: if the value is not nil
value = mw.text.trim (value); -- trim whitespace
if '' ~= value then -- empty string when value was only whitespace
return value;
end
end
return nil; -- value was empty or contained only whitespace
end -- end of valueFunc
});
args_t.fn = nil; -- unset because not supported but this function might have been called by {{lang|fn=lang|...}}
local msg = parameter_validate (args_t, cfg.templates_t.lang); -- verify that all supplied parameters are supported by {{lang-??}}
if msg then
return make_error_msg (msg, args_t, cfg.templates_t.lang); -- when template has unsupported params, abandon with error message
end
return _lang (args_t);
end
--[[--------------------------< T R A N S L A T I O N _ M A K E >----------------------------------------------
Stand-alone function to create literal translation of main text.
Also used by {{lang-x2}}.
]]
local function translation_make (args_t)
local translation_t = {', '}; -- initialize output
if 'none' ~= args_t.label then -- if we want a label
table.insert (translation_t, '<small>'); -- open the <small> HTML tag
if cfg.keywords_t.negative == args_t.link then
table.insert (translation_t, substitute ('<abbr title="$1">$2</abbr>', {cfg.translation_make_t.lit_xlation, cfg.translation_make_t.lit_abbr})); -- unlinked form
else
table.insert (translation_t, make_wikilink (cfg.translation_make_t.lit_xlation, cfg.translation_make_t.lit_abbr)); -- linked form
end
table.insert (translation_t, " </small>"); -- close the <small> HTML tag
end
table.insert (translation_t, table.concat ({ -- user styling spans match spand from {{gloss}}
'<span class="gloss-quot">\'</span>', -- user styling span for quote marks; use HTML entities to avoid wiki markup confusion
'<span class="gloss-text">', -- open user styling span for the translation
args_t.translation, -- the translation
'</span>', -- close user styling span for the translation
'<span class="gloss-quot">\'</span>' -- user styling span for quote marks
}));
return table.concat (translation_t); -- make a big string and done
end
--[[--------------------------< _ L A N G _ X X >--------------------------------------------------------------
For the {{lang-??}} templates, the only parameter required to be set in the template is the language code. All
other parameters can, usually should, be written in the template call. For {{lang-??}} templates for languages
that can have multiple writing systems, it may be appropriate to set |script= as well.
For each {{lang-??}} template choose the appropriate entry-point function so that this function knows the default
styling that should be applied to text.
For normal, upright style:
<includeonly>{{#invoke:lang|lang_xx_inherit|code=xx}}</includeonly>
For italic style:
<includeonly>{{#invoke:lang|lang_xx_italic|code=xx}}</includeonly>
All other parameters should be received from the template's frame (parent frame)
Supported parameters are:
|code = (required) the IANA language code
|script = IANA script code; especially for use with languages that use multiple writing systems
|region = IANA region code
|variant = IANA variant code
|text = (required) the displayed text in language specified by code
|link = boolean false ('no') does not link code-spcified language name to associated language article
|rtl = boolean true ('yes') identifies the language specified by code as a right-to-left language
|nocat = boolean true ('yes') inhibits normal categorization; error categories are not affected
|cat = boolian false ('no') opposite form of |nocat=
|italic = boolean true ('yes') renders displayed text in italic font; boolean false ('no') renders displayed text in normal font; not set renders according to initial_style_state
|lit = text that is a literal translation of text
|label = 'none' to suppress all labeling (language name, 'translit.', 'lit.')
any other text replaces language-name label - automatic wikilinking disabled
for those {{lang-??}} templates that support transliteration (those templates where |text= is not entirely latn script):
|translit = text that is a transliteration of text
|translit-std = the standard that applies to the transliteration
|translit-script = ISO 15924 script name; falls back to code
For {{lang-??}}, the positional parameters are:
{{{1}}} text
{{{2}}} transliterated text
{{{3}}} literal translation text
no other positional parameters are allowed
]]
local function _lang_xx (args, base_template) -- base_template will be either of 'langx' or 'lang-xx'
local out = {};
local language_name; -- used to make display text, article links
local category_name; -- same as language_name except that it retains any parenthetical disambiguators (if any) from the data set
local subtags = {}; -- IETF subtags script, region, and variant
local code; -- the language code
local translit_script_name; -- name associated with IANA (ISO 15924) script code
local translit;
local msg; -- for error messages
local tag = 'span'; -- initial value for make_text_html()
local template = args.template or base_template;
maint_cats = {}; -- initialize because when this module required into another module, these only declared once so only initialzed once
maint_msgs = {};
local text_idx = (cfg.templates_t.langx == base_template) and 2 or 1; -- for {{langx}} 'text' positional parameter is '2'
local translit_idx = (cfg.templates_t.langx == base_template) and 3 or 2;
local xlate_idx = (cfg.templates_t.langx == base_template) and 4 or 3;
if args[text_idx] and args.text then
return make_error_msg (substitute (cfg.lang_t.conflict_n_param, {text_idx, cfg.lang_t.conflict_n_param_types.text}), args, template);
else
args.text = args[text_idx] or args.text; -- prefer positional 'text' parameter
end
msg = validate_italic (args);
if msg then
return make_error_msg (msg, args, template);
end
msg = validate_text (template, args); -- ensure that |text= is set, does not contain italic markup and is protected from improper bolding
if is_set (msg) then
return msg;
end
args.text, tag = html_tag_select (args.text); -- inspects text; returns appropriate HTML tag with text trimmed accordingly
if args[translit_idx] and args.translit then
return make_error_msg (substitute (cfg.lang_t.conflict_n_param, {translit_idx, cfg.lang_t.conflict_n_param_types.translit}), args, template);
else
args.translit = args[translit_idx] or args.translit -- prefer positional 'translit' parameter
end
args.engvar = cfg.engvar_sel_t[args.engvar] or cfg.default_engvar; -- |engvar= when valid; cfg.default_engvar else
if args[xlate_idx] and (args.translation or args.lit) then
return make_error_msg (substitute (cfg.lang_xx_t.conflict_n_lit, {xlate_idx}), args, template);
elseif args.translation and args.lit then
return make_error_msg (cfg.lang_xx_t.conflict_lit, args, template);
else
args.translation = args[xlate_idx] or args.translation or args.lit; -- prefer positional 'translation' parameter
end
if args.links and args.link then
return make_error_msg (cfg.lang_xx_t.conflict_link, args, template);
else
args.link = args.link or args.links; -- prefer args.link
end
validate_cat_args (args); -- determine if categorization should be suppressed
args.rtl = args.rtl == cfg.keywords_t.affirmative; -- convert to boolean: 'yes' -> true, other values -> false
code, subtags.script, subtags.region, subtags.variant, subtags.private, msg = get_ietf_parts (args.code, args.script, args.region, args.variant); -- private omitted because private
if msg then -- if an error detected then there is an error message
return make_error_msg (msg, args, template);
end
if args.translit then
local latn, pos, char;
latn, args.translit, pos, char = is_latin (args.translit, (('' ~= subtags.private) and (code .. '-x-' .. subtags.private)) or code);
if not latn then
return make_error_msg (substitute (cfg.lang_xx_t.translit_nonlatn, {pos, char}), args, template);
end
end
local is_latn_text, text, pos, char = is_latin (args.text, code); -- make a boolean
args.text = text; -- may have been modified (accept-as-written markup removed)
msg = text_script_match_test (subtags.script, is_latn_text, pos, char)
if msg then -- if an error detected then there is an error message
return make_error_msg (msg, args, template);
end
if cfg.templates_t.langx == base_template then -- auto-italics for {{langx}} templates; adapted from {{lang}} (no support for poem tag)
if nil == args.style then -- nil when |italic= absent or not set or |italic=default; args.style controls
if ('latn' == subtags.script) or -- script is latn
(this_wiki_lang_tag ~= code and not is_set (subtags.script) and is_latn_text) then -- text is not this wiki's language, no script specified and is wholly latn script (auto-italics)
args.style = 'italic'; -- set font-style:italic
else
args.style = 'inherit'; -- italic not set; script not latn; inherit current style
end
end
else -- {{lang-xx}} does not do auto italics; retained for those wikis that don't support {{langx}}
if nil == args.style then -- args.style controls
if is_set (subtags.script) then
if 'latn' == subtags.script then
args.style = 'italic'; -- |script=Latn; set for font-style:italic
else
args.style = initial_style_state; -- italic not set; script is not latn; set for font-style:<initial_style_state>
end
else
args.style = initial_style_state; -- here when |italic= and |script= not set; set for font-style:<initial_style_state>
end
end
end
if is_set (subtags.script) then -- if script set override rtl setting
if in_array (subtags.script, lang_data.rtl_scripts) then
args.rtl = true; -- script is an rtl script
else
args.rtl = false; -- script is not an rtl script
end
end
args.proto, msg = validate_proto (args.proto); -- return boolean, or nil, or nil and error message flag
if msg then
return make_error_msg (substitute (cfg.lang_t.invalid_proto, {args.proto}), args, template);
end
args.code = format_ietf_tag (code, subtags.script, subtags.region, subtags.variant, subtags.private); -- format to recommended subtag styles
language_name = language_name_get (args.code, code, true); -- get language name; try IETF tag first, then code w/o variant then code w/ variant
category_name = language_name; -- category names retain IANA parenthetical diambiguators (if any)
language_name = language_name:gsub ('%s+%b()', ''); -- remove IANA parenthetical disambiguators or qualifiers from names that have them
if args.label then
if 'none' ~= args.label then
table.insert (out, table.concat ({args.label, ': '})); -- custom label
end
else
if cfg.keywords_t.negative == args.link then
table.insert (out, language_name); -- language name without wikilink
else
if mw.ustring.find (language_name, 'languages', 1, true) then
table.insert (out, make_wikilink (language_name)); -- collective language name uses simple wikilink
elseif lang_data.article_name[args.code:lower()] then -- is IETF tag in article name over ride?
table.insert (out, make_wikilink (lang_data.article_name[args.code:lower()], language_name)); -- language name with wikilink from override data
elseif lang_data.article_name[code] then -- is language tag in article override
table.insert (out, make_wikilink (lang_data.article_name[code], language_name)); -- language name with wikilink from override data
else
table.insert (out, make_wikilink (substitute ('$1 $2', {language_name, cfg.misc_text_t.language}), language_name)); -- language name with wikilink
end
end
table.insert (out, ': '); -- separator
end
if cfg.keywords_t.invert == args.italic then
args.text = invert_italics (args.text)
end
args.text = proto_prefix (args.text, language_name, args.proto); -- prefix proto-language text with a splat
table.insert (out, make_text_html (args.code, args.text, tag, args.rtl, args.style, args.size, ('none' == args.label) and language_name or nil))
if is_set (args.translit) and not is_latn_text then -- transliteration; not supported when args.text is wholly latn text (this is an imperfect test)
table.insert (out, ', '); -- comma to separate text from translit
if 'none' ~= args.label then
table.insert (out, '<small>');
if script_table[args['translit-script']] then -- when |translit-script= is set, try to use the script's name
translit_script_name = script_table[args['translit-script']];
else
translit_script_name = language_name; -- fall back on language name
end
local translit_title_obj = mw.title.makeTitle (0, substitute ('$1 $2',{cfg.lang_xx_t.romanization, translit_script_name})); -- make a title object; no engvar, article titles use US spelling
if translit_title_obj.exists and (cfg.keywords_t.negative ~= args.link) then
table.insert (out, make_wikilink (substitute ('$1 $2', {cfg.lang_xx_t.romanization, translit_script_name or language_name}),
substitute ('$1', {cfg.engvar_t[args.engvar]['romanisz_pt']})) .. ':'); -- make a wikilink if there is an article to link to; engvar the display text
else
table.insert (out, substitute ('$1:', {cfg.engvar_t[args.engvar]['romanisz_pt']})); -- else plain text per engvar
end
table.insert (out, ' </small>'); -- close the small tag
end
translit = make_translit (args.code, language_name, args.translit, args['translit-std'], args['translit-script'], nil, args.engvar)
if is_set (translit) then
table.insert (out, translit);
else
return make_error_msg (substitute ('$1: $2', {cfg.lang_xx_t.invalid_xlit_std, args['translit-std'] or '[missing]'}), args, template);
end
elseif is_set (args.translit) and is_latn_text then -- when creating a transliteration of Latn script <text>
return make_error_msg (cfg.lang_xx_t.xlit_of_latn, args, template); -- emit error message and abandon
end
if is_set (args.translation) then -- translation (not supported in {{lang}})
table.insert (out, translation_make (args));
end
table.insert (out, make_category (code, category_name, args.nocat));
table.insert (out, render_maint(args.nocat)); -- maintenance messages and categories
return table.concat (out); -- put it all together and done
end
--[[--------------------------< L A N G _ X X _ A R G S _ G E T >----------------------------------------------
Common function to get args table from {{lang-??}} templates.
Returns table of args.
Text positional parameters are not trimmed here but are selectively trimmed at html_tag_select().
]]
local function lang_xx_args_get (frame, base_template)
local args_t = getArgs(frame,
{
parentFirst= true, -- parameters in the template override parameters set in the {{#invoke:}}
valueFunc = function (key, value)
if ((cfg.templates_t.langx == base_template) and 2 or 1) == key then -- the 'text' positional parameter; 1 for {{lang-??}}, 2 for {{langx}}; do not trim wite space
return value; -- return untrimmed 'text' positional parameter
elseif value then -- all other values: if the value is not nil
value = mw.text.trim (value); -- trim whitespace
if '' ~= value then -- empty string when value was only whitespace
return value;
end
end
return nil; -- value was empty or contained only whitespace
end -- end of valueFunc
});
return args_t;
end
--[[--------------------------< L A N G _ X X _ I T A L I C >--------------------------------------------------
Entry point for those {{lang-??}} templates that call lang_xx_italic(). Sets the initial style state to italic.
]]
local function lang_xx_italic (frame)
local args = lang_xx_args_get (frame, cfg.templates_t.langxx);
args.fn = nil; -- unset because not supported but this function might have been called by {{lang|fn=lang_xx_italic|...}}
local msg = parameter_validate (args, cfg.templates_t.langxx); -- verify that all supplied parameters are supported by {{lang-??}}
if msg then
return make_error_msg (msg, args, cfg.templates_t.langxx); -- when template has unsupported params, abandon with error message
end
initial_style_state = 'italic';
return _lang_xx (args, cfg.templates_t.langxx) .. '[[Category:Pages using Lang-xx templates]]'; -- temporary category
end
--[[--------------------------< _ L A N G _ X X _ I T A L I C >------------------------------------------------
Entry point from another module. Sets the initial style state to italic.
]]
local function _lang_xx_italic (args)
initial_style_state = 'italic';
return _lang_xx (args, cfg.templates_t.langxx);
end
--[[--------------------------< L A N G _ X X _ I N H E R I T >------------------------------------------------
Entry point for those {{lang-??}} templates that call lang_xx_inherit(). Sets the initial style state to inherit.
]]
local function lang_xx_inherit (frame)
local args = lang_xx_args_get (frame, cfg.templates_t.langxx);
args.fn = nil; -- unset because not supported but this function might have been called by {{lang|fn=lang_xx_inherit|...}}
local msg = parameter_validate (args, cfg.templates_t.langxx); -- verify that all supplied parameters are supported by {{lang-??}}
if msg then
return make_error_msg (msg, args, cfg.templates_t.langxx); -- when template has unsupported params, abandon with error message
end
initial_style_state = 'inherit';
return _lang_xx (args, cfg.templates_t.langxx) .. '[[Category:Pages using Lang-xx templates]]'; -- temporary category
end
--[[--------------------------< _ L A N G _ X X _ I N H E R I T >----------------------------------------------
Entry point from another module. Sets the initial style state to inherit.
]]
local function _lang_xx_inherit (args)
initial_style_state = 'inherit';
return _lang_xx (args, cfg.templates_t.langxx);
end
--[[--------------------------< _ L A N G X >------------------------------------------------------------------
Entry point from another module.
]]
local function _langx (args_t)
local langx_data = mw.loadData ('Module:Lang/langx'); -- get necessary data
local rtl_t = langx_data.rtl_t; -- get list of language tags for languages that are rendered right-to-left
local link_t = langx_data.link_t; -- get list of language tags for {{lang-??}} templates that set |link=<something>
local size_t = langx_data.size_t; -- get list of language tags for {{lang-??}} templates that set |size=<something>
local msg = parameter_validate (args_t, cfg.templates_t.langx);
if msg then
return make_error_msg (msg, args_t, cfg.templates_t.langx);
end
args_t.code = args_t[1] or args_t.code; -- get the language tag; must be {{{1}}} or |code=
if not args_t.code then
return make_error_msg (cfg.get_ietf_parts_t.missing_lang_tag, args_t, cfg.templates_t.langx);
end
args_t.rtl = args_t.rtl or (rtl_t[args_t.code] and cfg.keywords_t.affirmative); -- prefer |rtl= in template call, use rtl_t else
args_t.link = args_t.link or link_t[args_t.code]; -- prefer |link= in template call, use link_t felse
args_t.size = args_t.size or size_t[args_t.code]; -- prefer |size= in template call, use size_t else
args_t[1] = nil; -- unset to mimic {{lang-??}} templates which set |code=xx
local lang_subtag = args_t.code; -- use only the base language subtag for unsupported tag test; some args_t.code are modified by |script= etc
return _lang_xx (args_t, cfg.templates_t.langx);
end
--[[--------------------------< L A N G X >--------------------------------------------------------------------
Entry point for {{langx}}.
this function calls _lang_xx() to render non-English text. The {{lang-??}} templates have three positional paramters
but {{langx}} has four:
| 1 | 2 | 3 | 4
{{lang-xx |<text> |<xlit> |<xlat> }}
{{langx |<tag> |<text> |<xlit> |<xlat> }}
The calls to lang_xx_args_get() and _lang_xx() use 'langx' as a flag for those functions to select the proper
positional parameters.
{{lang-??}} depends on the calling template to select 'inherit' or 'italic' to establish the default rendering.
{{langx}} can't do that. The initial version of {{langx}} relied on a list of language tags (inherit_t in ~/langx)
scraped from those {{lang-??}} templates that call lang_xx_inherit() to render text in upright font. langx() now
uses auto-italics code adapted from {{lang}} (doesn't support poem tags).
]]
local function langx (frame)
local args_t = lang_xx_args_get (frame, cfg.templates_t.langx); -- get the arguments; 'langx' is the <base_template> used to decide which positional param is 'text', 'translit', 'lit'
return _langx (args_t);
end
--[[--------------------------< _ I S _ I E T F _ T A G >------------------------------------------------------
Returns true when a language name associated with IETF language tag exists; nil else. IETF language tag must be valid.
All code combinations supported by {{lang}} and the {{lang-??}} templates are supported by this function.
Module entry point from another module.
]]
local function _is_ietf_tag (tag) -- entry point when this module is require()d into another
local c, s, r, v, p, err; -- code, script, region, variant, private, error message
c, s, r, v, p, err = get_ietf_parts (tag); -- disassemble tag into constituent part and validate
return ((c and not err) and true) or nil; -- return true when code portion has a value without error message; nil else
end
--[[--------------------------< I S _ I E T F _ T A G >--------------------------------------------------------
Module entry point from an {{#invoke:}}.
]]
local function is_ietf_tag (frame)
return _is_ietf_tag (getArgs (frame)[1]); -- args[1] is the IETF language tag to be tested; also get parent frame
end
--[[--------------------------< I S _ I E T F _ T A G _ F R A M E >--------------------------------------------
Module entry point from an {{#invoke:}}; same as is_ietf_tag() except does not get parameters from the parent
(template) frame. This function not useful when called by {{lang|fn=is_ietf_tag_frame|<tag>}} because <tag>
is in the parent frame.
]]
local function is_ietf_tag_frame (frame)
return _is_ietf_tag (getArgs (frame, {frameOnly = true,})[1]); -- args[1] is the IETF language tag to be tested; do not get parent frame
end
--[[--------------------------< _ N A M E _ F R O M _ T A G >--------------------------------------------------
Returns language name associated with IETF language tag if valid; error message else.
All code combinations supported by {{lang}} and the {{lang-??}} templates are supported by this function.
Set invoke's |link= parameter to yes to get wikilinked version of the language name.
Module entry point from another module.
]]
local function _name_from_tag (args)
local subtags = {}; -- IETF subtags script, region, variant, and private
local raw_code = args[1]; -- save a copy of the input IETF subtag
local link = cfg.keywords_t.affirmative == args['link']; -- make a boolean
local label = args.label;
local code; -- the language code
local msg; -- gets an error message if IETF language tag is malformed or invalid
local language_name = '';
code, subtags.script, subtags.region, subtags.variant, subtags.private, msg = get_ietf_parts (raw_code);
if msg then
local template = (args['template'] and table.concat ({'{{', args['template'], '}}: '})) or ''; -- make template name (if provided by the template)
return make_error_span (template, msg);
end
raw_code = format_ietf_tag (code, subtags.script, subtags.region, subtags.variant, subtags.private); -- format to recommended subtag styles; private omitted because private
language_name = language_name_get (raw_code, code); -- get language name; try IETF tag first, then code w/o variant then code w/ variant
if 'yes' ~= args.raw then
language_name = language_name:gsub ('%s+%b()', ''); -- remove IANA parenthetical disambiguators or qualifiers from names that have them
end
if link then -- when |link=yes, wikilink the language name
if mw.ustring.find (language_name, 'languages', 1, true) then
language_name = make_wikilink (language_name, label); -- collective language name uses simple wikilink
elseif lang_data.article_name[raw_code:lower()] then -- is IETF tag in article name override?
language_name = make_wikilink (lang_data.article_name[raw_code:lower()], label or language_name); -- language name with wikilink from override data
elseif lang_data.article_name[code] then -- is language tag in article name override?
language_name = make_wikilink (lang_data.article_name[code], label or language_name); -- language name with wikilink from override data
else
language_name = make_wikilink (substitute ('$1 $2', {language_name, cfg.misc_text_t.language}), label or language_name); -- language name with wikilink
end
end
return language_name;
end
--[[--------------------------< N A M E _ F R O M _ T A G >----------------------------------------------------
Module entry point from an {{#invoke:}}.
]]
local function name_from_tag (frame) -- entry point from an {{#invoke:lang|name_from_tag|<IETF tag>|link=<yes>|template=<template name>}}
return _name_from_tag (getArgs(frame)) -- pass-on the args table, nothing else; getArgs() so we also get parent frame
end
--[[--------------------------< _ T A G _ F R O M _ N A M E >--------------------------------------------------
Returns the IETF language tag associated with the language name. Spelling of language name must be correct
according to the spelling in the source tables. When a standard language name has a parenthetical disambiguator,
that disambiguator must be omitted (they are not present in the data name-to-tag tables).
Module entry point from another module.
]]
local function _tag_from_name (args) -- entry point from another module
local msg;
if args[1] and '' ~= args[1] then
local data = mw.loadData ('Module:Lang/tag from name'); -- get the reversed data tables TODO: change when going live
local lang = args[1]:lower(); -- allow any-case for the language name (speeling must till be correct)
local tag = data.rev_override_table[lang] or data.rev_lang_table[lang] or data.rev_lang_dep_table[lang]; -- get the code; look first in the override then in the standard
if tag then
return tag, true; -- language name found so return tag and done; second return used by is_lang_name()
else
msg = substitute (cfg.tag_from_name_t.lang_not_found, {args[1]}); -- language name not found, error message
end
else
msg = cfg.tag_from_name_t.missing_lang_name; -- language name not found, error message
end
local template = '';
if args.template and '' ~= args.template then
template = table.concat ({'{{', args['template'], '}}: '}); -- make template name (if provided by the template)
end
return make_error_span (template, msg);
end
--[[--------------------------< T A G _ F R O M _ N A M E >----------------------------------------------------
Module entry point from an {{#invoke:}}.
]]
local function tag_from_name (frame) -- entry point from an {{#invoke:lang|tag_from_name|<language name>|link=<yes>|template=<template name>}}
local result, _ = _tag_from_name (getArgs(frame)) -- pass-on the args table, nothing else; getArgs() so we also get parent frame; supress second return used by is_lang_name()
return result;
end
--[[--------------------------< I S _ L A N G _ N A M E >------------------------------------------------------
Module entry point from an {{#invoke:}}.
]]
local function is_lang_name (frame)
local _, result = _tag_from_name (getArgs(frame)) -- pass-on the args table, nothing else; getArgs() so we also get parent frame; supress second return used by tag_from_name()
return result and true or nil;
end
--[[--------------------------< _ X L I T >--------------------------------------------------------------------
Module entry point from another module.
]]
local function _xlit (args)
local title_table = lang_data.translit_title_table; -- table of transliteration standards and the language codes and scripts that apply to those standards
local language_name; -- language name that matches language code; used for tool tip
local translit; -- transliterated text to display
local script; -- IANA script
local msg; -- for when called functions return an error message
local template = args.template or cfg.templates_t.transliteration;
maint_cats = {}; -- initialize because when this module required into another module, these only declared once so only initialzed once
maint_msgs = {};
if is_set (args[3]) then -- [3] set when {{transliteration|code|standard|text}}
args.text = args[3]; -- get the transliterated text
args.translit_std = args[2] and args[2]:lower(); -- get the standard; lower case for table indexing
if not title_table[args.translit_std] then
return make_error_msg (substitute (cfg.transl_t.unrecog_xlit_std, {args.translit_std}), args, template);
end
else
if is_set (args[2]) then -- [2] set when {{transliteration|code|text}}
args.text = args[2]; -- get the transliterated text
else
if args[1] and (args[1]:match ('^%a%a%a?%a?$') or -- args[2] missing; is args[1] a language or script tag or is it the transliterated text?
args[1]:match ('^%a%a%a?%-x%-')) then -- or is args[1] a private-use tag
return make_error_msg (cfg.transl_t.no_text, args, template); -- args[1] is a code so we're missing text
else
args.text = args[1]; -- args[1] is not a code so we're missing that; assign args.text for error message
return make_error_msg (cfg.transl_t.missing_lang_scr, args, template);
end
end
end
if is_set (args[1]) then -- IANA language code used for HTML lang= attribute; or ISO 15924 script code
if args[1]:match ('^%a%a%a?%a?$') or args[1]:match ('^%a%a%a?%-x%-') then -- args[1] has correct form?
args.code = args[1]:lower(); -- use the language/script code; only (2, 3, or 4 alpha characters) or private-use; lower case because table indexes are lower case
else
return make_error_msg (substitute (cfg.transl_t.unrecog_lang_scr, {args[1]}), args, template); -- invalid language / script code
end
else
return make_error_msg (cfg.transl_t.missing_lang_scr, args, template); -- missing language / script code so quit
end
local is_latn_text, pos, char;
is_latn_text, args.text, pos, char= is_latin (args.text, args.code); -- is latn text? strip accept-as-written markup
if not is_latn_text then -- when text is not latn
return make_error_msg (substitute (cfg.lang_xx_t.translit_nonlatn, {pos, char}), args, template); -- abandon with error message
end
msg = validate_italic (args);
if msg then
return make_error_msg (msg, args, template);
end
if 'italic' == args.style then -- 'italic' when |italic=yes; because that is same as absent or not set and |italic=default
args.style = nil; -- set to nil;
end
args.engvar = cfg.engvar_sel_t[args.engvar] or cfg.default_engvar; -- |engvar= when valid; cfg.default_engvar else
if override_table[args.code] then -- is code a language code defined in the override table?
language_name = override_table[args.code];
args.code = args.code:match ('^%a%a%a?'); -- if private use, strip all but language subtag
elseif lang_table[args.code] then -- is code a language code defined in the standard language code tables?
language_name = lang_table[args.code];
elseif lang_dep_table[args.code] then -- is code a language code defined in the deprecated language code tables?
language_name = lang_dep_table[args.code];
elseif script_table[args.code] then -- if here, code is not a language code; is it a script code?
language_name = script_table[args.code];
script = args.code; -- code was an ISO 15924 script so use that instead
args.code = ''; -- unset because not a language code
else
return make_error_msg (substitute (cfg.transl_t.unrecog_lang_scr, {args.code}), args, template); -- invalid language / script code
end
-- here only when all parameters passed to make_translit() are valid
return make_translit (args.code, language_name, args.text, args.translit_std, script, args.style, args.engvar);
end
--[[--------------------------< X L I T >----------------------------------------------------------------------
Module entry point from an {{#invoke:}}.
]]
local function xlit (frame)
return _xlit (getArgs(frame));
end
--[[--------------------------< C A T E G O R Y _ F R O M _ T A G >--------------------------------------------
Returns category name associated with IETF language tag if valid; error message else.
All code combinations supported by {{lang}} and the {{lang-??}} templates are supported by this function.
Module entry point from another module.
]]
local function _category_from_tag (args_t)
local subtags = {}; -- IETF subtags script, region, variant, and private
local raw_code = args_t[1]; -- save a copy of the input IETF subtag
local link = cfg.keywords_t.affirmative == args_t.link; -- make a boolean
local label = args_t.label;
local code; -- the language code
local msg; -- gets an error message if IETF language tag is malformed or invalid
local category_name = '';
code, subtags.script, subtags.region, subtags.variant, subtags.private, msg = get_ietf_parts (raw_code);
if msg then
local template = (args_t.template and table.concat ({'{{', args_t.template, '}}: '})) or ''; -- make template name (if provided by the template)
return make_error_span (template, msg);
end
raw_code = format_ietf_tag (code, subtags.script, subtags.region, subtags.variant, subtags.private); -- format to recommended subtag styles; private omitted because private
category_name = language_name_get (raw_code, code); -- get language name; try IETF tag first, then code w/o variant then code w/ variant
category_name = make_category (code, category_name, nil, true):gsub ('[%[%]]', '');
if link then
return table.concat ({'[[:', category_name, ']]'});
else
return category_name;
end
end
--[[--------------------------< C A T E G O R Y _ F R O M _ T A G >--------------------------------------------
Module entry point from an {{#invoke:}}.
]]
local function category_from_tag (frame) -- entry point from an {{#invoke:lang|category_from_tag|<IETF tag>|template=<template name>}}
return _category_from_tag (getArgs (frame)); -- pass-on the args table, nothing else; getArgs() so we also get parent frame
end
--[[--------------------------< E X P O R T E D F U N C T I O N S >------------------------------------------
]]
return {
category_from_tag = category_from_tag, -- frame entry points when this module is #invoke:ed into templates/wikitext
lang = lang, -- entry point for {{lang}}
langx = langx, -- entry point for {{langx}}
lang_xx_inherit = lang_xx_inherit, -- entry points for {{lang-??}}
lang_xx_italic = lang_xx_italic,
is_ietf_tag = is_ietf_tag,
is_ietf_tag_frame = is_ietf_tag_frame,
is_lang_name = is_lang_name,
tag_from_name = tag_from_name, -- returns IETF tag associated with language name
name_from_tag = name_from_tag, -- used for template documentation; possible use in ISO 639 name from code templates
xlit = xlit, -- entry point for {{transliteration}}
_category_from_tag = _category_from_tag, -- API entry points when this module is require()d into other modules
_lang = _lang,
_langx = _langx,
_lang_xx_inherit = _lang_xx_inherit,
_lang_xx_italic = _lang_xx_italic,
_is_ietf_tag = _is_ietf_tag,
get_ietf_parts = get_ietf_parts,
_tag_from_name = _tag_from_name,
_name_from_tag = _name_from_tag,
_xlit = _xlit,
_translation_make = translation_make,
};
c8wgnsqzminhr1dnm7hk761k0hc8av3
ᥛᥫᥒᥰᥟᥣᥱᥙᥣᥰᥢᥤᥰᥕᥣᥰ
0
1142
7922
7898
2026-10-05T22:33:02Z
Saimawnkham
28
ᥟᥣᥙᥳ ᥖᥥᥖᥳ ᥑᥩᥲ ᥛᥧᥢᥰ
7922
wikitext
text/x-wiki
{{Infobox country
| conventional_long_name = ᥛᥫᥒᥰ ᥓᥩᥛ ᥙᥩᥒ ᥓᥪᥒ ᥟᥣᥱ ᥙᥣᥱ ᥢᥤᥱ ᥕᥣᥱ
| native_name = {{small|{{native name|sq|Republika e Shqipërisë}}}}
| common_name = ᥟᥣᥱ ᥙᥣᥱ ᥢᥤᥱ ᥕᥣᥱ
| image_flag = Flag of Albania.svg
| alt_flag = Red flag with a black double-headed eagle in the centre.
| image_coat = [[File:Coat of arms of Albania.svg|60px]]
| national_motto = {{native phrase|sq|[[Ti Shqipëri, më jep nder, më jep emrin Shqipëtar|Ti Shqipëri, më jep nder,<br>më jep emrin Shqipëtar]]|paren=no|italic=yes}}<br>"You Albania, give me honour,<br>you give me the name Albanian"
| national_anthem = {{lang|sq|"[[Himni i Flamurit]]"|italic=no}}<br>"Hymn to the Flag"<br/><div style="display:inline-block;margin-top:0.4em;">[[File:Hymni i Flamurit instrumental.ogg]]</div>
| image_map = [[File:Location_Albania_Europe.png|225px|frameless]]
| map_caption = ᥟᥩᥒᥲ ᥖᥤ ᥟᥣᥱ ᥙᥣᥱ ᥢᥤᥱ ᥕᥣᥱ (ᥔᥤᥴ ᥑᥥᥝᥴ)
| capital = [[Tirana]]
| largest_city = [[Tirana]]
| coordinates = {{coord|41|19|N|19|49|E|type:city(557,000)_region:AL-11}}
| official_languages = [[ᥚᥣᥱ ᥔᥣᥱ ᥟᥣᥱ ᥙᥣᥱ ᥢᥤᥱ ᥕᥣᥱ|ᥟᥣᥱ ᥙᥣᥱ ᥢᥤᥱ ᥕᥣᥱ]]
| languages2_type = ᥚᥣᥱ ᥔᥣᥱ ᥐᥨᥢᥰ ᥑᥫᥰ ᥟᥩᥢᥱ ᥟᥢ ᥘᥭᥲ ᥞᥙᥳ ᥞᥩᥒᥰ ᥝᥭᥳ
| languages2 = {{hlist|[[Greek language|Greek]]|[[Aromanian language|Aromanian]]|[[Macedonian language|Macedonian]]}}
| religion = {{ublist |item_style=white-space; |50.67% [[Islam in Albania|Islam]] |38% [[Christianity in Albania|Christianity]] |3.55% [[Irreligion in Albania|Atheism]] and Agnostic|0.15% other |15.77% undeclared}}<Ref>{{cite web | url=https://www.state.gov/reports/2023-report-on-international-religious-freedom/albania/ | title=Albania }}</ref>
| religion_year = 2023
| religion_ref = {{sfn|2023 Albanian census|2024|p=76}}
| demonym = [[Albanians|Albanian]]
| government_type = [[Unitary parliamentary republic]]
| leader_title1 = [[President of Albania|President]]
| leader_name1 = [[Bajram Begaj]]
| leader_title2 = [[Prime Minister of Albania|Prime Minister]]
| leader_name2 = [[Edi Rama]]
| legislature = [[Parliament of Albania|Kuvendi]]
| leader_title3 = [[Speaker of the Parliament of Albania|Parliament Speaker]]
| leader_name3 = [[Elisa Spiropali]]
| sovereignty_type = [[History of Albania|Establishment history]]
| established_event1 = [[Principality of Arbanon]]
| established_date1 = 1190
| established_event2 = [[Kingdom of Albania (medieval)|Kingdom of Albania]]
| established_date2 = February 1272
| established_event3 = [[Principality of Albania (medieval)|Princedom of Albania]]
| established_date3 = 1368
| established_event4 = [[League of Lezhë]]
| established_date4 = 2 March 1444
| established_event5 = [[Pashalik of Scutari]]/[[Pashalik of Janina|Janina]]/[[Pashalik of Berat|Berat]]
| established_date5 = 1757/1787
| established_event6 = [[League of Prizren]]
| established_date6 = 10 June 1878
| established_event7 = Proclamation of independence from {{nowrap|the [[Ottoman Empire]]}}
| established_date7 = 28 November 1912
| established_event8 = [[Principality of Albania]]
| established_date8 = 29 July 1913
| established_event9 = [[Albanian Republic (1925–1928)|1st Republic of Albania]]
| established_date9 = 31 January 1925
| established_event10 = [[Albanian Kingdom (1928–39)|Kingdom of Albania]]
| established_date10 = 1 September 1928
| established_event11 = [[People's Republic of Albania|2nd Republic of Albania]]
| established_date11 = 10 January 1946
| established_event12 = [[Constitution of the People's Socialist Republic of Albania|3rd Republic of Albania]]
| established_date12 = 28 December 1976
| established_event13 = 4th Republic of Albania
| established_date13 = 29 April 1991
| established_event14 = {{nowrap|[[Constitution of Albania|Current constitution]]}}
| established_date14 = 28 November 1998
| area_km2 = 28,748
| area_sq_mi = 11,100
| area_rank = 140th <!-- Area rank should match [[List of countries and dependencies by area]] -->
| percent_water = 4.7
| population_census = 2,402,113{{sfn|2023 Albanian census|2024|p=105}}
| population_census_year = 2023
| population_density_km2 = 83.6{{sfn|2023 Albanian census|2024|p=105}}
| GDP_PPP = {{increase}} $58.196 billion<ref name="IMFWEO.AL">{{cite web |url=https://www.imf.org/en/Publications/WEO/weo-database/2024/October/weo-report?c=914,&s=NGDP,NGDPD,PPPGDP,NGDPPC,NGDPDPC,PPPPC,&sy=2022&ey=2029&ssm=0&scsm=1&scc=0&ssd=1&ssc=0&sic=0&sort=country&ds=.&br=1 |title=World Economic Outlook Database, October 2024 Edition. (Albania) |publisher=[[International Monetary Fund]] |website=IMF.org |date=10 October 2023 |access-date=11 October 2024}}</ref>
| GDP_PPP_rank = 118th
| GDP_PPP_year = 2024
| GDP_PPP_per_capita = {{increase}} $21,376<ref name="IMFWEO.AL" />
| GDP_PPP_per_capita_rank = 83rd
| GDP_nominal = {{increase}} $26.130 billion<ref name="IMFWEO.AL" />
| GDP_nominal_rank = 125th
| GDP_nominal_year = 2024
| GDP_nominal_per_capita = {{increase}} $9,598<ref name="IMFWEO.AL" />
| GDP_nominal_per_capita_rank = 84th
| Gini_year = 2019
| Gini = 34.3<!-- number only -->
| Gini_change = decrease
| Gini_ref = <ref name=eurogini>{{cite web |title=Gini coefficient of equivalised disposable income – EU-SILC survey |url=https://ec.europa.eu/eurostat/databrowser/view/tessi190/default/table?lang=en |publisher=[[Eurostat]] |website=ec.europa.eu |access-date=12 August 2021}}</ref>
| HDI_year = 2022<!-- Please use the year to which the data refers, not the publication year -->
| HDI_change = increase<!-- increase/decrease/steady -->
| HDI = 0.789
| HDI_ref = <ref name="UNHDR">{{cite web |title=Human Development Report 2023/24 |url=https://hdr.undp.org/system/files/documents/global-report-document/hdr2023-24reporten.pdf |publisher=[[United Nations Development Programme]] |date=13 March 2024 |access-date=13 March 2024}}</ref>
| HDI_rank = 74th
| currency = [[Albanian lek|Lek]]
| currency_code = ALL
| patron_saint = [[Our Lady of Good Counsel]]
| time_zone = [[Central European Time|CET]]
| utc_offset = +1
| time_zone_DST = [[Central European Summer Time|CEST]]
| utc_offset_DST = +2
| drives_on = right
| calling_code = [[Telephone numbers in Albania|+355]]
| cctld = [[.al]]
}}
'''ᥟᥣᥱ ᥙᥣᥱ ᥢᥤᥱ ᥕᥣᥱ''' {{efn|{{IPAc-en|audio=en-us-Albania.ogg|æ|l|ˈ|b|eɪ|n|i|ə|,_|ɔː|l|-}} {{respell|a(w)l|BAY|nee|ə}}; {{langx|sq|Shqipëri}} or {{lang|sq|Shqipëria}}), {{IPA|sq|ʃcipəˈɾi(a)|pron}}; {{langx|aln|Shqipni}} or {{langx|aln|Shqipnia}}, also {{langx|aln|Shqypni}} or {{langx|aln|Shqypnia}}.<ref>{{cite book|url=https://archive.org/details/fialuurivoghels00junggoog|title=Fialuur i voghel scc...p e ltinisct mle...un prei P. Jak Junkut t' Scocniis ...|last=Giacomo Jungg|date=1 January 1895|publisher=N'Sckoder t' Scc...pniis|access-date=23 July 2016|via=the Internet Archive}}</ref>}} ᥟᥢ ᥙᥥᥢ ᥖᥣᥒᥰ ᥐᥣᥢ '''ᥛᥫᥒᥰ ᥓᥩᥛ ᥙᥩᥒ ᥓᥪᥒ ᥟᥣᥱ ᥙᥣᥱ ᥢᥤᥱ ᥕᥣᥱ''' ({{langx|sq|Republika e Shqipërisë|link=no}}),{{efn|{{IPA-sq|ɾɛpuˈblika ɛ ʃcipəˈɾisə|pron}}.}} ᥘᥭᥳ ᥙᥥᥢ ᥛᥫᥒᥰ ᥟᥢ ᥛᥤᥰ ᥝᥭᥳ ᥖᥤ [[ᥕᥧᥰ ᥘᥨᥙᥱ ᥓᥥᥒᥱ ᥓᥣᥢᥰ ᥝᥢᥰ ᥟᥩᥐᥱ]] ᥘᥢᥳ ᥕᥝᥳ.
==ᥑᥨᥝᥲ ᥛᥣᥭᥴ ᥖᥩᥒᥰ==
{{notelist}}
==ᥚᥪᥢ ᥟᥤᥒ==
{{Reflist}}
9roq1iz96dhm20bakiftg7tziipuofc
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:IPAc-en
10
2608
7899
2026-10-05T22:15:44Z
Saimawnkham
28
Created page with "<includeonly>{{#invoke:IPAc-en|main}}</includeonly><noinclude> {{documentation}} </noinclude>"
7899
wikitext
text/x-wiki
<includeonly>{{#invoke:IPAc-en|main}}</includeonly><noinclude>
{{documentation}}
</noinclude>
szcbk6ow194d0m1qh49i8w22cdi4kis
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:IPAc-en/doc
10
2609
7900
2026-10-05T22:17:09Z
Saimawnkham
28
Created page with "<noinclude>{{pp-vandalism|small=yes}}</noinclude>{{documentation subpage}} {{High-use}} {{lua|Module:IPAc-en}} This template is used to display English [[International Phonetic Alphabet]] (IPA). The pronunciation is broken into individual [[diaphoneme]]s so that they will have tooltips (mouse-over text) to indicate pronunciation. All diaphonemes from [[Help:IPA/English]] are available. == ᥘᥩᥒᥲ ᥓᥬᥳ ᥖᥪᥰ == The transcription system of Help:IPA/Engli..."
7900
wikitext
text/x-wiki
<noinclude>{{pp-vandalism|small=yes}}</noinclude>{{documentation subpage}}
{{High-use}}
{{lua|Module:IPAc-en}}
This template is used to display English [[International Phonetic Alphabet]] (IPA). The pronunciation is broken into individual [[diaphoneme]]s so that they will have tooltips (mouse-over text) to indicate pronunciation. All diaphonemes from [[Help:IPA/English]] are available.
== ᥘᥩᥒᥲ ᥓᥬᥳ ᥖᥪᥰ ==
The transcription system of [[Help:IPA/English]], upon which this template relies, is diaphonemic, i.e. meant to cover multiple major varieties of English at once. If you wish to give a narrow transcription of a pronunciation in a certain variety of English, use {{tlx|IPA|2=en{{pipe}}...{{pipe}}generic=yes}}.
Note: Per [[WP:LEAD]], do not use this template in the lead section for common English words (e.g., ''[[pub]]'', ''[[rose]]'', ''[[pencil]]'', ''[[bus]]'', ''[[Monday]]'', ''[[Earth]]'', etc.).
The named parameter {{para|audio}} may be used to link to an audio file.
Notations with audio links will appear under [[:Category:Pages including recorded pronunciations]].
If "[invalid input]" is displayed, it means that an unsupported input was used. Such instances are tallied at [[:Category:Ill-formatted IPAc-en transclusions]], where they can be reviewed and fixed.
== ᥖᥨᥝ ᥴᥕᥣᥒᥱ ==
* {{demo-inline|<nowiki>{{IPAc-en|ˌ|æ|l|ə|ˈ|b|æ|m|ə}}</nowiki>}}
* {{demo-inline|<nowiki>{{IPAc-en|audio=en-us-Alabama.ogg|ˌ|æ|l|ə|ˈ|b|æ|m|ə}}</nowiki>}}
* {{demo-inline|<nowiki>{{IPAc-en|US|audio=en-us-Alabama.ogg|ˌ|æ|l|ə|ˈ|b|æ|m|ə}}</nowiki>}}
Examples using [[X-SAMPA]] spelling for individual diaphonemes:
* {{demo-inline|<nowiki>{{IPAc-en|,|{|l|@|'|b|{|m|@}}</nowiki>}}
* {{demo-inline|<nowiki>{{IPAc-en|lang|audio=en-us-Alabama.ogg|,|{|l|@|'|b|{|m|@}}</nowiki>}}
== Pronunciation and IPA link codes ==
The initial argument (entry after |) can be used to indicate a pronunciation label. The codes are:
{| class="wikitable"
|+ Label codes
! Code !! Output
|-
| <code>lang</code> || English:
|-
| <code>local</code> || locally
|-
| <code>ipa</code> || [[International Phonetic Alphabet|IPA]]:
|-
| <code>also</code> || also
|-
| <code>uk</code> || [[British English|UK]]:
|-
| <code>us</code> || [[American English|US]]:
|-
| <code>uklang</code> || [[British English]]:
|-
| <code>uslang</code> || [[American English]]:
|-
| <code>ukalso</code> || [[British English|UK]] also
|-
| <code>usalso</code> || [[American English|US]] also
|-
| <code>alsouk</code> || also [[British English|UK]]:
|-
| <code>alsous</code> || also [[American English|US]]:
|}
The first argument that is not a code above will be treated as a diaphoneme. All diaphonemes listed at [[Help:IPA/English]] are available (except the ones that span two syllables such as {{IPA|/iə/}}, which need to be input as <code>i|ə</code>). Also available are {{IPA|/ɪəˈr/}}, {{IPA|/ɛəˈr/}}, {{IPA|/ʊəˈr/}}, {{IPA|/ɪəˌr/}}, {{IPA|/ɛəˌr/}}, and {{IPA|/ʊəˌr/}}, preserved for when a centering diphthong precedes a stress.
===Separator codes===
Use an underscore <code>_</code> to separate words. When multiple pronunciations for the same word(s) are possible, use a comma and an underscore <code>,_</code>, which will appear as a comma and a space, to separate the variants. As necessary, use a hyphen <code>-</code> to indicate omitted syllables. Diaphonemes are underlined, but separators are not, and separators do not have any tooltip text.
See the table below for a full list of separator codes.
===Diaphoneme codes===
Note that the aliases include ones that are kept merely for compatibility reasons and therefore not recommended for further use, as they might not accurately represent the sound represented by the output. Aliases from [[X-SAMPA]], on the other hand, are fine.
{{#invoke:IPAc-en/documentation|phonemes}}
== TemplateData ==
{{collapse top|TemplateData}}
{{TemplateData header}}
<templatedata>
{
"format": "inline",
"params": {
"1": {
"label": "1st input",
"type": "string",
"required": true,
"description": "Either a label code (e.g. 'local') or the first diaphoneme"
},
"2": {
"label": "2nd input",
"type": "string",
"required": false
},
"3": {
"label": "3rd input",
"type": "string",
"required": false
},
"4": {
"label": "4th input",
"type": "string",
"required": false
},
"5": {
"label": "5th input",
"type": "string",
"required": false
},
"6": {
"label": "6th input",
"type": "string",
"required": false
},
"7": {
"label": "7th input",
"type": "string",
"required": false
},
"8": {
"label": "8th input",
"type": "string",
"required": false
},
"9": {
"label": "9th input",
"type": "string",
"required": false
},
"10": {
"label": "10th input",
"type": "string",
"required": false
},
"11": {
"label": "11th input",
"type": "string",
"required": false
},
"12": {
"label": "12th input",
"type": "string",
"required": false
},
"13": {
"label": "13th input",
"type": "string",
"required": false
},
"14": {
"label": "14th input",
"type": "string",
"required": false
},
"15": {
"label": "15th input",
"type": "string",
"required": false
},
"16": {
"label": "16th input",
"type": "string",
"required": false
},
"17": {
"label": "17th input",
"type": "string",
"required": false
},
"18": {
"label": "18th input",
"type": "string",
"required": false
},
"19": {
"label": "19th input",
"type": "string",
"required": false
},
"20": {
"label": "20th input",
"type": "string",
"required": false
},
"21": {
"label": "21st input",
"type": "string",
"required": false
},
"22": {
"label": "22nd input",
"type": "string",
"required": false
},
"23": {
"label": "23rd input",
"type": "string",
"required": false
},
"24": {
"label": "24th input",
"type": "string",
"required": false
},
"25": {
"label": "25th input",
"type": "string",
"required": false
},
"26": {
"label": "26th input",
"type": "string",
"required": false
},
"27": {
"label": "27th input",
"type": "string",
"required": false
},
"28": {
"label": "28th input",
"type": "string",
"required": false
},
"29": {
"label": "29th input",
"type": "string",
"required": false
},
"30": {
"label": "30th input",
"type": "string",
"required": false
},
"31": {
"label": "31st input",
"type": "string",
"required": false
},
"32": {
"label": "32nd input",
"type": "string",
"required": false
},
"33": {
"label": "33rd input",
"type": "string",
"required": false
},
"34": {
"label": "34th input",
"type": "string",
"required": false
},
"35": {
"label": "35th input",
"type": "string",
"required": false
},
"36": {
"label": "36th input",
"type": "string",
"required": false
},
"37": {
"label": "37th input",
"type": "string",
"required": false
},
"38": {
"label": "38th input",
"type": "string",
"required": false
},
"39": {
"label": "39th input",
"type": "string",
"required": false
},
"40": {
"label": "40th input",
"type": "string",
"required": false
},
"41": {
"label": "41st input",
"type": "string",
"required": false
},
"42": {
"label": "42nd input",
"type": "string",
"required": false
},
"43": {
"label": "43rd input",
"type": "string",
"required": false
},
"44": {
"label": "44th input",
"type": "string",
"required": false
},
"45": {
"label": "45th input",
"type": "string",
"required": false
},
"46": {
"label": "46th input",
"type": "string",
"required": false
},
"47": {
"label": "47th input",
"type": "string",
"required": false
},
"48": {
"label": "48th input",
"type": "string",
"required": false
},
"49": {
"label": "49th input",
"type": "string",
"required": false
},
"50": {
"label": "50th input",
"type": "string",
"required": false
},
"51": {
"label": "51st input",
"type": "string",
"required": false
},
"52": {
"label": "52nd input",
"type": "string",
"required": false
},
"53": {
"label": "53rd input",
"type": "string",
"required": false
},
"54": {
"label": "54th input",
"type": "string",
"required": false
},
"55": {
"label": "55th input",
"type": "string",
"required": false
},
"56": {
"label": "56th input",
"type": "string",
"required": false
},
"57": {
"label": "57th input",
"type": "string",
"required": false
},
"58": {
"label": "58th input",
"type": "string",
"required": false
},
"59": {
"label": "59th input",
"type": "string",
"required": false
},
"60": {
"label": "60th input",
"type": "string",
"required": false
},
"61": {
"label": "61st input",
"type": "string",
"required": false
},
"62": {
"label": "62nd input",
"type": "string",
"required": false
},
"63": {
"label": "63rd input",
"type": "string",
"required": false
},
"64": {
"label": "64th input",
"type": "string",
"required": false
},
"65": {
"label": "65th input",
"type": "string",
"required": false
},
"66": {
"label": "66th input",
"type": "string",
"required": false
},
"67": {
"label": "67th input",
"type": "string",
"required": false
},
"68": {
"label": "68th input",
"type": "string",
"required": false
},
"69": {
"label": "69th input",
"type": "string",
"required": false
},
"70": {
"label": "70th input",
"type": "string",
"required": false
},
"71": {
"label": "71st input",
"type": "string",
"required": false
},
"72": {
"label": "72nd input",
"type": "string",
"required": false
},
"73": {
"label": "73rd input",
"type": "string",
"required": false
},
"74": {
"label": "74th input",
"type": "string",
"required": false
},
"75": {
"label": "75th input",
"type": "string",
"required": false
},
"76": {
"label": "76th input",
"type": "string",
"required": false
},
"77": {
"label": "77th input",
"type": "string",
"required": false
},
"78": {
"label": "78th input",
"type": "string",
"required": false
},
"79": {
"label": "79th input",
"type": "string",
"required": false
},
"80": {
"label": "80th input",
"type": "string",
"required": false
},
"81": {
"label": "81st input",
"type": "string",
"required": false
},
"82": {
"label": "82nd input",
"type": "string",
"required": false
},
"83": {
"label": "83rd input",
"type": "string",
"required": false
},
"84": {
"label": "84th input",
"type": "string",
"required": false
},
"85": {
"label": "85th input",
"type": "string",
"required": false
},
"86": {
"label": "86th input",
"type": "string",
"required": false
},
"87": {
"label": "87th input",
"type": "string",
"required": false
},
"88": {
"label": "88th input",
"type": "string",
"required": false
},
"89": {
"label": "89th input",
"type": "string",
"required": false
},
"90": {
"label": "90th input",
"type": "string",
"required": false
},
"91": {
"label": "91st input",
"type": "string",
"required": false
},
"92": {
"label": "92nd input",
"type": "string",
"required": false
},
"93": {
"label": "93rd input",
"type": "string",
"required": false
},
"94": {
"label": "94th input",
"type": "string",
"required": false
},
"95": {
"label": "95th input",
"type": "string",
"required": false
},
"96": {
"label": "96th input",
"type": "string",
"required": false
},
"97": {
"label": "97th input",
"type": "string",
"required": false
},
"98": {
"label": "98th input",
"type": "string",
"required": false
},
"99": {
"label": "99th input",
"type": "string",
"required": false
},
"100": {
"label": "100th input",
"type": "string",
"required": false
},
"audio": {
"label": "Audio file",
"description": "The audio file without the \"File:\" prefix",
"example": "En-us-Foobar.ogg",
"type": "wiki-file-name"
}
},
"description": "This template is used to display English International Phonetic Alphabet (IPA). The pronunciation is broken into individual diaphonemes so that they will have tooltips (mouse-over text) to indicate pronunciation."
}
</templatedata>
{{collapse bottom}}
== See also ==
* {{tl|Respell}}, for [[Help:Pronunciation respelling key|pronunciation respelling]]s, which may be used for English words in addition to the IPA
{{IPA templates}}
<includeonly>{{Sandbox other||
[[Category:IPA language templates|c]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
crwqba29btjmpkuzepop3m8lre3fuqs
ᥛᥨᥝᥱ ᥓᥧᥰ:IPAc-en
828
2610
7901
2026-10-05T22:17:38Z
Saimawnkham
28
Created page with "-- This module implements [[Template:IPAc-en]]. local data = mw.loadData('Module:IPAc-en/data') local p = {} -- Global container for tracking categories local categoryHandler = require('Module:Category handler').main local categories = {} -- Trims whitespace from a string local function trim(s) return s:match('^%s*(.-)%s*$') end -- This implements [[Template:Nowrap]]. local function makeNowrapSpan(s) local span = mw.html.create('span') :addClass('rt-commentedText..."
7901
Scribunto
text/plain
-- This module implements [[Template:IPAc-en]].
local data = mw.loadData('Module:IPAc-en/data')
local p = {}
-- Global container for tracking categories
local categoryHandler = require('Module:Category handler').main
local categories = {}
-- Trims whitespace from a string
local function trim(s)
return s:match('^%s*(.-)%s*$')
end
-- This implements [[Template:Nowrap]].
local function makeNowrapSpan(s)
local span = mw.html.create('span')
:addClass('rt-commentedText') -- Works with [[MediaWiki:Gadget-ReferenceTooltips.js]]
:addClass('nowrap')
:wikitext(s)
return tostring(span)
end
local function makePronunciationText(id)
id = id and string.lower(trim(id))
if id and id ~= '' and data.pronunciation[id] then
return data.pronunciation[id].text
end
end
-- This adds a tooltip icon to a label. It implements [[Template:H:title]].
local function makeTooltip(label, tooltip)
-- mw.html doesn't properly escape '|'
return string.format(
'<span title="%s">%s</span>',
mw.text.encode(tooltip, '|'),
label
)
end
local function formatPhonemeGroup(phonemes)
if #phonemes > 0 then
local span = mw.html.create('span')
:css('border-bottom', '1px dotted')
:wikitext(table.concat(phonemes))
return tostring(span)
else
return ''
end
end
local function renderCategories()
local ret = ''
if categoryHandler{ true } then
ret = {}
for cat in pairs(categories) do
table.insert(ret, string.format('[[Category:%s]]', cat))
end
table.sort(ret)
ret = table.concat(ret)
else
ret = ''
end
return ret
end
function p._main(args)
local ret = {}
local i = 0 -- Keeps track of numbered args
-- Pronunciation
do
local pron = {}
while true do
i = i + 1
local pronItem = makePronunciationText(args[i])
if pronItem then
pron[#pron + 1] = pronItem
pron[#pron + 1] = ' '
else
break
end
end
if #pron > 0 then
ret[#ret + 1] = mw.getCurrentFrame():extensionTag({
name = 'templatestyles',
args = { src = 'Module:IPA/styles.css' }
})
ret[#ret + 1] = string.format(
'<span class="IPA-label IPA-label-small">%s</span>',
table.concat(pron)
)
end
end
-- Phonemes
do
-- Loop through the numbered args, separating them into phoneme groups
-- and separator strings (both called "words" for convenience). We only
-- underline the phoneme groups, not the separators.
local words = {}
words[#words + 1] = '/' -- Opening slash
i = i - 1 -- Set up i again as it was changed in the pronunciation loop
local id
repeat
local phonemes = {}
local isWordEnd = false
while not isWordEnd do
i = i + 1
id = args[i]
id = id and trim(id)
if not id then
isWordEnd = true
words[#words + 1] = formatPhonemeGroup(phonemes)
elseif id ~= '' then
local t = data.phonemes[id]
if not t then
-- We were passed an invalid id.
isWordEnd = true
categories["Ill-formatted IPAc-en transclusions"] = true
words[#words + 1] = formatPhonemeGroup(phonemes)
words[#words + 1] = makeTooltip(
string.format(
"<strong class=\"error\">[invalid input: '%s']</strong>",
id
),
'Unrecognized symbol'
)
elseif not t.label then
-- The data module contains bad data, so throw an error.
error(string.format(
"no label was found for id '%s'",
tostring(id)
))
elseif t.tooltip then
-- We are dealing with a regular phoneme.
phonemes[#phonemes + 1] = makeTooltip(
t.label,
t.tooltip
)
else
-- We are dealing with a separator.
isWordEnd = true
words[#words + 1] = formatPhonemeGroup(phonemes)
words[#words + 1] = t.label
end
end
end
until not id
words[#words + 1] = '/' -- Closing slash
-- Wrap the words in a link to IPA help.
local span = mw.html.create('span')
-- Suppress Navigation popups and Page Previews (aka Hovercards)
:addClass('IPA nopopups noexcerpt')
:attr('lang', 'en-fonipa')
:wikitext(string.format(
'[[Help:IPA/English|%s]]',
table.concat(words)
))
ret[#ret + 1] = tostring(span)
end
-- Audio link
do
local file = args.audio and trim(args.audio)
if file and file ~= '' then
categories["Pages including recorded pronunciations"] = true
ret[#ret + 1] = mw.getCurrentFrame():expandTemplate{
title = 'Template:IPA audio link', args = { file } }
end
end
-- Nowrap and categories
ret = makeNowrapSpan(table.concat(ret)) .. renderCategories()
-- Reset the categories table in case we are run again.
categories = {}
return ret
end
function p.main(frame)
return p._main(frame:getParent().args)
end
return p
n18dhnoav7mce9k6g2cxv8uk1aacnlc
ᥛᥨᥝᥱ ᥓᥧᥰ:IPAc-en/doc
828
2611
7902
2026-10-05T22:18:25Z
Saimawnkham
28
Created page with "{{Module rating|protected}} {{High-use|demo=Module:{{ROOTPAGENAME}}}} {{Lua|Module:IPAc-en/data|Module:Category handler}} {{Uses TemplateStyles|Module:IPA/styles.css}} This module implements {{tl|IPAc-en}}. Please see the template page for documentation. To edit the diaphoneme data, go to [[Module:IPAc-en/phonemes]], and to edit the pronunciation data go to [[Module:IPAc-en/pronunciation]]. This module also uses a data-formatting module at [[Module:IPAc-en/data]]. <in..."
7902
wikitext
text/x-wiki
{{Module rating|protected}}
{{High-use|demo=Module:{{ROOTPAGENAME}}}}
{{Lua|Module:IPAc-en/data|Module:Category handler}}
{{Uses TemplateStyles|Module:IPA/styles.css}}
This module implements {{tl|IPAc-en}}. Please see the template page for documentation.
To edit the diaphoneme data, go to [[Module:IPAc-en/phonemes]], and to edit the pronunciation data go to [[Module:IPAc-en/pronunciation]].
This module also uses a data-formatting module at [[Module:IPAc-en/data]].
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:IPA-related modules|c-en]]
}}</includeonly><noinclude>
[[Category:Module documentation pages]]
</noinclude>
ijqpmu6fd1jcsz9ckqkp775gyv3nvtr
ᥛᥨᥝᥱ ᥓᥧᥰ:IPAc-en/data
828
2612
7903
2026-10-05T22:18:42Z
Saimawnkham
28
Created page with "-- This module processes data for [[Module:IPAc-en]]. It is intended to be -- loaded with mw.loadData. local PRONUNCIATION_MODULE = 'Module:IPAc-en/pronunciation' local PHONEME_MODULE = 'Module:IPAc-en/phonemes' local function makeData(oldData) local newData = {} for i, old in ipairs(oldData) do local new = {} for k, v in pairs(old) do if k ~= 'aliases' and k ~= 'code' then new[k] = v end end newData[old.code] = new if old.aliases then for i, a..."
7903
Scribunto
text/plain
-- This module processes data for [[Module:IPAc-en]]. It is intended to be
-- loaded with mw.loadData.
local PRONUNCIATION_MODULE = 'Module:IPAc-en/pronunciation'
local PHONEME_MODULE = 'Module:IPAc-en/phonemes'
local function makeData(oldData)
local newData = {}
for i, old in ipairs(oldData) do
local new = {}
for k, v in pairs(old) do
if k ~= 'aliases' and k ~= 'code' then
new[k] = v
end
end
newData[old.code] = new
if old.aliases then
for i, alias in ipairs(old.aliases) do
newData[alias] = new
end
end
end
return newData
end
local function main()
local pronunciation = makeData(require(PRONUNCIATION_MODULE))
local phonemes = makeData(require(PHONEME_MODULE))
-- Check that no pronunciation keys are also contained in the phonemes
-- data. This would cause silent, hard-to-debug errors if it went
-- unchecked, so make it cause a big red error message instead.
for id in pairs(pronunciation) do
if phonemes[id] then
error(string.format(
"duplicate ID '%s' found in %s and %s",
id,
PRONUNCIATION_MODULE,
PHONEME_MODULE
))
end
end
return {
pronunciation = pronunciation,
phonemes = phonemes,
}
end
return main()
63ca8m7vp9oj803ii5e38i1pq69wf9e
ᥛᥨᥝᥱ ᥓᥧᥰ:IPAc-en/data/doc
828
2613
7904
2026-10-05T22:19:09Z
Saimawnkham
28
Created page with "<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> {{Module rating|protected}} {{High-use}} {{Improve documentation}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; interwikis at Wikidata --> [[Category:IPA-related modules|c-en/data]] }}</includeonly><noinclude> [[Category:Module documentation pages]] </noinclude>"
7904
wikitext
text/x-wiki
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{Module rating|protected}}
{{High-use}}
{{Improve documentation}}
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:IPA-related modules|c-en/data]]
}}</includeonly><noinclude>
[[Category:Module documentation pages]]
</noinclude>
28drgcnnn4t5uytrmyacs8ahhf4kdeu
ᥛᥨᥝᥱ ᥓᥧᥰ:IPAc-en/pronunciation
828
2614
7905
2026-10-05T22:19:41Z
Saimawnkham
28
Created page with "-- This module contains pronunciation-key data for [[Module:IPAc-en]]. return { { code = 'lang', text = 'English:' }, { code = 'pron', text = '' }, { code = 'local', text = 'locally' }, { code = 'ipa', text = '[[International Phonetic Alphabet|IPA]]:' }, { code = 'also', text = 'also' }, { code = 'uk', text = '[[British English|UK]]:' }, { code = 'us', text = '[[American English|US]]:' }, { code = 'uklang', text = '[[Britis..."
7905
Scribunto
text/plain
-- This module contains pronunciation-key data for [[Module:IPAc-en]].
return {
{
code = 'lang',
text = 'English:'
},
{
code = 'pron',
text = ''
},
{
code = 'local',
text = 'locally'
},
{
code = 'ipa',
text = '[[International Phonetic Alphabet|IPA]]:'
},
{
code = 'also',
text = 'also'
},
{
code = 'uk',
text = '[[British English|UK]]:'
},
{
code = 'us',
text = '[[American English|US]]:'
},
{
code = 'uklang',
text = '[[British English]]:'
},
{
code = 'uslang',
text = '[[American English]]:'
},
{
code = 'ukalso',
text = '[[British English|UK]] also'
},
{
code = 'usalso',
text = '[[American English|US]] also'
},
{
code = 'alsouk',
text = 'also [[British English|UK]]:'
},
{
code = 'alsous',
text = 'also [[American English|US]]:'
},
}
skyneclm3gt9868iop1vpqel8zboas5
ᥛᥨᥝᥱ ᥓᥧᥰ:IPAc-en/phonemes
828
2615
7906
2026-10-05T22:20:29Z
Saimawnkham
28
Created page with "-- This module contains phoneme data for [[Module:IPAc-en]]. return { -- CONSONANTS { code = "b", label = "b", tooltip = "'b' in 'buy'", }, { code = "d", label = "d", tooltip = "'d' in 'dye'", }, { code = "dj", aliases = {"dy", "dʲ"}, label = "dj", tooltip = "/dj/: 'd' in 'dew'", }, { code = "dʒ", aliases = {"dZ", "ʤ"}, label = "dʒ", tooltip = "/dʒ/: 'j' in 'jam'", }, { code = "ð", aliases = {"D"}, label = "ð", toolti..."
7906
Scribunto
text/plain
-- This module contains phoneme data for [[Module:IPAc-en]].
return {
-- CONSONANTS
{
code = "b",
label = "b",
tooltip = "'b' in 'buy'",
},
{
code = "d",
label = "d",
tooltip = "'d' in 'dye'",
},
{
code = "dj",
aliases = {"dy", "dʲ"},
label = "dj",
tooltip = "/dj/: 'd' in 'dew'",
},
{
code = "dʒ",
aliases = {"dZ", "ʤ"},
label = "dʒ",
tooltip = "/dʒ/: 'j' in 'jam'",
},
{
code = "ð",
aliases = {"D"},
label = "ð",
tooltip = "/ð/: 'th' in 'this'",
},
{
code = "f",
label = "f",
tooltip = "'f' in 'find'",
},
{
code = "ɡ",
aliases = {"g"},
label = "ɡ",
tooltip = "/ɡ/: 'g' in 'guy'",
},
{
code = "h",
label = "h",
tooltip = "'h' in 'hi'",
},
{
code = "hw",
aliases = {"ʍ"},
label = "hw",
tooltip = "/hw/: 'wh' in 'why'",
},
{
code = "j",
aliases = {"y"},
label = "j",
tooltip = "/j/: 'y' in 'yes'",
},
{
code = "k",
label = "k",
tooltip = "'k' in 'kind'",
},
{
code = "l",
label = "l",
tooltip = "'l' in 'lie'",
},
{
code = "lj",
aliases = {"ly", "lʲ"},
label = "lj",
tooltip = "/lj/: 'l' in 'lute'",
},
{
code = "m",
label = "m",
tooltip = "'m' in 'my'",
},
{
code = "n",
label = "n",
tooltip = "'n' in 'nigh'",
},
{
code = "nj",
aliases = {"ny", "nʲ"},
label = "nj",
tooltip = "/nj/: 'n' in 'new'",
},
{
code = "ŋ",
aliases = {"N", "ng"},
label = "ŋ",
tooltip = "/ŋ/: 'ng' in 'sing'",
},
{
code = "p",
label = "p",
tooltip = "'p' in 'pie'",
},
{
code = "r",
aliases = {"ɹ", "ɻ"},
label = "r",
tooltip = "'r' in 'rye'",
},
{
code = "s",
label = "s",
tooltip = "'s' in 'sigh'",
},
{
code = "sj",
aliases = {"sy", "sʲ"},
label = "sj",
tooltip = "/sj/: 's' in 'consume'",
},
{
code = "ʃ",
aliases = {"S", "sh"},
label = "ʃ",
tooltip = "/ʃ/: 'sh' in 'shy'",
},
{
code = "t",
label = "t",
tooltip = "'t' in 'tie'",
},
{
code = "tj",
aliases = {"ty", "tʲ"},
label = "tj",
tooltip = "/tj/: 't' in 'tune'",
},
{
code = "tʃ",
aliases = {"tS", "ʧ", "ch"},
label = "tʃ",
tooltip = "/tʃ/: 'ch' in 'China'",
},
{
code = "θ",
aliases = {"T"},
label = "θ",
tooltip = "/θ/: 'th' in 'thigh'",
},
{
code = "θj",
aliases = {"θy", "θʲ"},
label = "θj",
tooltip = "/θj/: 'th' in 'enthuse'",
},
{
code = "v",
label = "v",
tooltip = "'v' in 'vie'",
},
{
code = "w",
label = "w",
tooltip = "'w' in 'wind'",
},
{
code = "z",
label = "z",
tooltip = "'z' in 'zoom'",
},
{
code = "zj",
aliases = {"zy", "zʲ"},
label = "zj",
tooltip = "/zj/: 'Z' in 'Zeus'",
},
{
code = "ʒ",
aliases = {"Z", "zh"},
label = "ʒ",
tooltip = "/ʒ/: 's' in 'pleasure'",
},
-- VOWELS
{
code = "ɑː",
aliases = {"A:", "ɑ:", "aː", "a:"},
label = "ɑː",
tooltip = "/ɑː/: 'a' in 'father'",
},
{
code = "ɑːr",
aliases = {"ɑɹ", "aːr", "a:r", "ɑ:r", "ɑr"},
label = "ɑːr",
tooltip = "/ɑːr/: 'ar' in 'far'",
},
{
code = "ɒ",
aliases = {"Q"},
label = "ɒ",
tooltip = "/ɒ/: 'o' in 'body'",
},
{
code = "ɒr",
aliases = {"Qr"},
label = "ɒr",
tooltip = "/ɒr/: 'or' in 'moral'",
},
{
code = "æ",
aliases = {"ae", "{"},
label = "æ",
tooltip = "/æ/: 'a' in 'bad'",
},
{
code = "ær",
aliases = {"aer", "&r", "æɹ"},
label = "ær",
tooltip = "/ær/: 'arr' in 'marry'",
},
{
code = "aɪ",
aliases = {"ai", "aI"},
label = "aɪ",
tooltip = "/aɪ/: 'i' in 'tide'",
},
{
code = "aɪər",
aliases = {"aɪr", "aIr", "aɪə"},
label = "aɪər",
tooltip = "/aɪər/: 'ire' in 'fire'",
},
{
code = "aʊ",
aliases = {"au", "aU"},
label = "aʊ",
tooltip = "/aʊ/: 'ou' in 'mouth'",
},
{
code = "aʊər",
aliases = {"aʊr", "aUr", "aʊə", "aur"},
label = "aʊər",
tooltip = "/aʊər/: 'our' in 'hour'",
},
{
code = "ɛ",
aliases = {"E"},
label = "ɛ",
tooltip = "/ɛ/: 'e' in 'dress'",
},
{
code = "ɛr",
aliases = {"Er"},
label = "ɛr",
tooltip = "/ɛr/: 'err' in 'merry'",
},
{
code = "eɪ",
aliases = {"ei", "eI", "eː", "e:"},
label = "eɪ",
tooltip = "/eɪ/: 'a' in 'face'",
},
{
code = "ɛər",
aliases = {"eir", "eIr", "e@r", "E@r", "ɛɪɹ", "eɪr", "eːr", "e:r", "ɛəɹ", "ɛə", "ɛːr", "ɛ:r", "ɛː", "ɛ:", "E:", "E:r"},
label = "ɛər",
tooltip = "/ɛər/: 'are' in 'bare'",
},
{
code = "ɛəˈr",
aliases = {"ɛə'r", "eəˈr", "eə'r", "e@'r", "E@'r", "ɛːˈr", "E:'r"},
label = "ɛəˈr",
tooltip = "/ɛəˈr/: 'ere' in 'thereof'",
},
{
code = "ɛəˌr",
aliases = {"ɛə,r", "eəˌr", "eə,r", "E@,r", "E@%r", "e@,r", "e@%r", "ɛːˌr", "E:,r", "E:%r"},
label = "ɛəˌr",
tooltip = "/ɛəˌr/: 'ere' in 'thereof'",
},
{
code = "ɪ",
aliases = {"I", "ᵻ"},
label = "ɪ",
tooltip = "/ɪ/: 'i' in 'kit'",
},
{
code = "ɪr",
label = "ɪr",
tooltip = "/ɪr/: 'irr' in 'mirror'",
},
{
code = "iː",
aliases = {"i:"},
label = "iː",
tooltip = "/iː/: 'ee' in 'fleece'",
},
{
code = "ɪər",
aliases = {"i:r", "iːr", "I@r", "i@r", "ɪəɹ", "iːɹ", "ɪə"},
label = "ɪər",
tooltip = "/ɪər/: 'ear' in 'near'",
},
{
code = "ɪəˈr",
aliases = {"ɪə'r", "I@'r"},
label = "ɪəˈr",
tooltip = "/ɪəˈr/: 'er' in 'spheroidal'",
},
{
code = "ɪəˌr",
aliases = {"ɪə,r", "I@,r", "I@%r"},
label = "ɪəˌr",
tooltip = "/ɪəˌr/: 'er' in 'spheroidal'",
},
{
code = "oʊ",
aliases = {"o:", "oː", "ou", "oU", "@u", "@U", "əʊ", "əu", "oʊ-"},
label = "oʊ",
tooltip = "/oʊ/: 'o' in 'code'",
},
{
code = "ɔː",
aliases = {"O", "O:", "ɔ:", "ɒː", "Q:"},
label = "ɔː",
tooltip = "/ɔː/: 'au' in 'fraud'",
},
{
code = "ɔːr",
aliases = {"Or", "ɔɹ", "ɔ(r)", "ɔr", "ɔər", "oUr", "ɔəɹ", "ɔʊɹ", "oʊɹ", "oʊr", "oːr", "o:r", "ɔə", "ɔə(r)"},
label = "ɔːr",
tooltip = "/ɔːr/: 'ar' in 'war'",
},
{
code = "ɔɪ",
aliases = {"oj", "ɔj", "oi", "oɪ", "ɔi", "OI", "oy"},
label = "ɔɪ",
tooltip = "/ɔɪ/: 'oi' in 'choice'",
},
{
code = "ɔɪər",
aliases = {"ɔɪr", "oyr", "ɔɪə"},
label = "ɔɪər",
tooltip = "/ɔɪər/: 'oir' in 'coir'",
},
{
code = "ʊ",
aliases = {"U", "ᵿ"},
label = "ʊ",
tooltip = "/ʊ/: 'u' in 'push'",
},
{
code = "ʊr",
aliases = {"Ur"},
label = "ʊr",
tooltip = "/ʊr/: 'our' in 'courier'",
},
{
code = "uː",
aliases = {"u:"},
label = "uː",
tooltip = "/uː/: 'oo' in 'goose'",
},
{
code = "ʊər",
aliases = {"u:r", "uːr", "u@r", "U@r", "ʊəɹ", "ʊə"},
label = "ʊər",
tooltip = "/ʊər/: 'our' in 'tour'",
},
{
code = "ʊəˈr",
aliases = {"ʊə'r", "U@'r"},
label = "ʊəˈr",
tooltip = "/ʊəˈr/: 'ur' in 'plurality'",
},
{
code = "ʊəˌr",
aliases = {"ʊə,r", "U@,r", "U@%r"},
label = "ʊəˌr",
tooltip = "/ʊəˌr/: 'ur' in 'plurality'",
},
{
code = "ʌ",
aliases = {"V"},
label = "ʌ",
tooltip = "/ʌ/: 'u' in 'cut'",
},
{
code = "ʌr",
aliases = {"Vr", "ʌɹ"},
label = "ʌr",
tooltip = "/ʌr/: 'urr' in 'hurry'",
},
{
code = "ɜːr",
aliases = {"ɝː", "ɝ", "3r", "3:r", "əːr", "@:r", "ɜɹ", "ɜ(r)", "ɜr"},
label = "ɜːr",
tooltip = "/ɜːr/: 'ur' in 'fur'",
},
{
code = "ə",
aliases = {"@"},
label = "ə",
tooltip = "/ə/: 'a' in 'about'",
},
-- SYLLABIC CONSONANTS
{
code = "ər",
aliases = {"ɚ", "@r", "əɹ", "ə(r)"},
label = "ər",
tooltip = "/ər/: 'er' in 'letter'",
},
{
code = "əl",
aliases = {"@l", "ᵊl", "l̩"},
label = "əl",
tooltip = "/əl/: 'le' in 'bottle'",
},
{
code = "ən",
aliases = {"@n", "ᵊn", "n̩"},
label = "ən",
tooltip = "/ən/: 'on' in 'button'",
},
{
code = "əm",
aliases = {"@m", "ᵊm", "m̩"},
label = "əm",
tooltip = "/əm/: 'm' in 'rhythm'",
},
-- ARCHIPHONEMES
{
code = "i",
label = "i",
tooltip = "/i/: 'y' in 'happy'",
},
{
code = "u",
label = "u",
tooltip = "/u/: 'u' in 'influence'",
},
-- MARGINAL SEGMENTS
{
code = "x",
label = "x",
aliases = {"kh"},
tooltip = "/x/: 'ch' in 'loch'",
},
{
code = "ʔ",
aliases = {"?"},
label = "ʔ",
tooltip = "/ʔ/: the catch in 'uh-oh'",
},
{
code = "ɒ̃",
aliases = {"ɑ̃", "ɒ~", "ɑ~", "Q~"},
label = "ɒ̃",
tooltip = "/ɒ̃/: nasal 'an' in 'vin blanc'",
},
{
code = "æ̃",
aliases = {"ae~", "{~", "ã", "a~"},
label = "æ̃",
tooltip = "/æ̃/: nasal 'in' in 'vin blanc'",
},
{
code = "ɜː",
aliases = {"3", "3:", "ɜ:", "ɜ", "əː", "@:"},
label = "ɜː",
tooltip = "/ɜː/: r-less 'ur' in 'nurse'",
},
-- SUPRASEGMENTALS
{
code = "ˈ",
aliases = {"'", '"'},
label = "ˈ",
tooltip = "/ˈ/: primary stress follows",
},
{
code = "ˌ",
aliases = {",", "%"},
label = "ˌ",
tooltip = "/ˌ/: secondary stress follows",
},
{
code = ".",
aliases = {"·"},
label = ".",
tooltip = "/./: syllable break",
},
{
code = "#",
label = "#",
tooltip = "/#/: morpheme break",
},
{
code = "!",
label = "|",
tooltip = "/|/: prosodic break (minor)",
},
{
code = "!!",
aliases = {"‖"},
label = "‖",
tooltip = "/‖/: prosodic break (major)",
},
-- SEPARATORS
-- Tables without tooltip text are used as word separators. In addition to
-- not having any tooltip text in the template output, they are not
-- underlined.
{
code = "_",
label = "<span class=\"wrap\"> </span>",
},
{
code = "nbsp",
aliases = {" "},
label = " ",
},
{
code = ",_",
label = ",<span class=\"wrap\"> </span>",
},
{
code = "-",
aliases = {"–"},
label = "-",
},
{
code = "(",
label = "(",
},
{
code = ")",
label = ")",
},
-- This is useful for highly variable words in place names, which are not
-- important to transcribe.
{
code = "...",
label = " ...<span class=\"wrap\"> </span>",
},
-- Obsolete combinations, kept for compatibility
{
code = "juː",
label = "juː",
tooltip = "/juː/: 'u' in 'cute'",
},
{
code = "jʊər",
label = "jʊər",
tooltip = "/jʊər/: 'ure' in 'cure'",
},
}
rrm0atjuiucipgueuaoozhqg94awcpv
ᥛᥨᥝᥱ ᥓᥧᥰ:IPAc-en/phonemes/doc
828
2616
7907
2026-10-05T22:20:55Z
Saimawnkham
28
Created page with "<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> {{High-use|demo=Module:{{ROOTPAGENAME}}}} {{Module rating|protected}} This module houses {{tl|IPAc-en}}'s diaphoneme symbols and their corresponding shortcuts and tooltips. {{collapse top|Phoneme codes}} {{#invoke:IPAc-en/documentation|phonemes}} {{collapse bottom}} <includeonly>{{Sandbox other|| <!-- Categories below this line, please; int..."
7907
wikitext
text/x-wiki
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{High-use|demo=Module:{{ROOTPAGENAME}}}}
{{Module rating|protected}}
This module houses {{tl|IPAc-en}}'s diaphoneme symbols and their corresponding shortcuts and tooltips.
{{collapse top|Phoneme codes}}
{{#invoke:IPAc-en/documentation|phonemes}}
{{collapse bottom}}
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:IPA-related modules|c-en/phonemes]]
}}</includeonly><noinclude>
[[Category:Module documentation pages]]
</noinclude>
3ujyhnuq47u6foa6pamvnboy1wdbguw
ᥛᥨᥝᥱ ᥓᥧᥰ:IPA/styles.css
828
2617
7908
2026-10-05T22:21:35Z
Saimawnkham
28
Created page with "/* {{pp-template}} */ .IPA-label-small { font-size: 85%; } /* Don't shrink the label where text is already small, per [[MOS:SMALLTEXT]] */ .references .IPA-label-small, .infobox .IPA-label-small, .navbox .IPA-label-small { font-size: 100%; }"
7908
sanitized-css
text/css
/* {{pp-template}} */
.IPA-label-small {
font-size: 85%;
}
/* Don't shrink the label where text is already small, per [[MOS:SMALLTEXT]] */
.references .IPA-label-small,
.infobox .IPA-label-small,
.navbox .IPA-label-small {
font-size: 100%;
}
072qrnoi3jojcokw6kqxca0vddi5ui1
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Tooltip
10
2618
7909
2026-10-05T22:22:38Z
Saimawnkham
28
Created page with "<templatestyles src="Template:Tooltip/styles.css" />{{#ifeq:{{yesno-no|{{{link}}}}}|yes |[[{{{1}}}|<span class="rt-commentedText tooltip {{#ifeq:{{yesno-yes|{{{dotted}}}}}|no||tooltip-dotted}} {{{class|}}}" {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} title="{{#tag:nowiki|{{#invoke:String|replace|{{{2|}}}|"|"}}}}">{{{1|}}}</span>]] |<span class="rt-commentedText tooltip {{#ifeq:{{yesno-yes|{{{dotted}}}}}|no||tooltip-dotted}} {{{class|}}..."
7909
wikitext
text/x-wiki
<templatestyles src="Template:Tooltip/styles.css" />{{#ifeq:{{yesno-no|{{{link}}}}}|yes
|[[{{{1}}}|<span class="rt-commentedText tooltip {{#ifeq:{{yesno-yes|{{{dotted}}}}}|no||tooltip-dotted}} {{{class|}}}" {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} title="{{#tag:nowiki|{{#invoke:String|replace|{{{2|}}}|"|"}}}}">{{{1|}}}</span>]]
|<span class="rt-commentedText tooltip {{#ifeq:{{yesno-yes|{{{dotted}}}}}|no||tooltip-dotted}} {{{class|}}}" {{#if:{{{id|}}}|id="{{{id}}}"}} {{#if:{{{style|}}}|style="{{{style}}}"}} title="{{#tag:nowiki|{{#invoke:String|replace|{{{2|}}}|"|"}}}}">{{Encodefirst|{{trim|1={{{1|}}}}}}}</span>
}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using tooltip with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Tooltip]] with unknown parameter "_VALUE_"|ignoreblank=y| 1 | 2 | class | dotted | id | link | style }}<noinclude>
{{Documentation}}
</noinclude>
4ivp1x5p3c09xnp99igup53f5x07y2q
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Tooltip/styles.css
10
2619
7910
2026-10-05T22:23:05Z
Saimawnkham
28
Created page with "/* {{pp-template}} */ .tooltip-dotted { border-bottom: 1px dotted; cursor: help; }"
7910
sanitized-css
text/css
/* {{pp-template}} */
.tooltip-dotted {
border-bottom: 1px dotted;
cursor: help;
}
a3nuuy8e07xkoz1hiw7pmpuv4gixony
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Tooltip/doc
10
2620
7911
2026-10-05T22:23:26Z
Saimawnkham
28
Created page with "{{Documentation subpage}} <!-- Categories go where indicated at the bottom of this page, please; interwikis go to Wikidata (see also: [[Wikipedia:Wikidata]]). --> {{COinS safe|n}} {{High-use}} {{Bot use warning|bots=[[User:AAlertBot]]}} {{Lua|Module:Check for unknown parameters}} {{Uses TemplateStyles|Template:Tooltip/styles.css}} This template may be used to generate a [[tooltip]] when hovering over marked text. '''Note:''' this template is #When not to use|§ ..."
7911
wikitext
text/x-wiki
{{Documentation subpage}}
<!-- Categories go where indicated at the bottom of this page, please; interwikis go to Wikidata (see also: [[Wikipedia:Wikidata]]). -->
{{COinS safe|n}}
{{High-use}}
{{Bot use warning|bots=[[User:AAlertBot]]}}
{{Lua|Module:Check for unknown parameters}}
{{Uses TemplateStyles|Template:Tooltip/styles.css}}
This template may be used to generate a [[tooltip]] when hovering over marked text.
'''Note:''' this template is [[#When not to use|§ not to be used]] for expanding [[initialism]]s or [[acronyms]]; see template {{t|abbreviation}} for that instead. See {{slink||Notes}} for more details on access limitations for mobile and screen reader users.
== Usage ==
* {{tlc|{{BASEPAGENAME}}|''inline text''|''hover text''}}
* {{tlc|{{BASEPAGENAME}}|''inline text''|''hover text''|dotted{{=}}no|link{{=}}yes|class{{=}}...|style{{=}}...|id{{=}}...}}
=== When not to use ===
'''Abbreviations''' – The {{Tl|Tooltip}} template is {{em|not}} intended for use with abbreviations, including [[acronyms]] and [[initialisms]]; use template {{t|abbreviation}} for that instead.
'''Body text''' – The tooltip template should not be used within the body text of an article if possible (see [[MOS:NOTOOLTIPS]]).
'''As footnotes''' – Tooltips are not a substitute for [[Help:Footnotes|footnotes]]. They are intended to be used for navigational and other secondary features where space is limited. See [[Template:Glossary link]] or [[Template:Cite book/doc#Usage]] for practical examples.
'''In citations''' – Tooltips cannot be used inside [[Wikipedia:Citation templates|citation templates]]. If you're tempted to put a tooltip in a citation, it may be better to place a plaintext note after the citation template but before the closing {{tag|ref|c}} tag, or use a [[WP:Nested footnotes|nested footnote]].
== Parameters ==
There are two required positional parameters, and five optional named parameters:
* {{para|1}} – the term to be explained; displays as text. [[Wiki markup]] is allowed but works more consistently when wrapping the template, see below for linking examples.
* {{para|2}} – the tooltip/pop-up ('''no wiki or HTML markup allowed'''). The popup is created by an HTML <code>title=</code> attribute, so it cannot contain HTML (or markup that resolves to HTML when rendered). This includes simple things like <code><nowiki>''italics''</nowiki></code>.
* {{para|dotted}} – set to {{pval|no}} to remove dotted underline decoration (default: use dotted underline)
* {{para|link}} – set to {{pval|yes}} to link the tooltip to the value in param {{pval|1}} (default: tooltip is unlinked)
These three parameters take the standard values as defined by [[HTML]] and [[CSS]]:
* {{para|class}} – one or more CSS classes (space-separated, enclosed in quotes)
* {{para|id}} – an HTML ID must be unique on the entire page.
* {{para|style}} – CSS to apply to the displayed text (no effect on tooltip/popup). Any style values with embedded blanks must be single-quoted, e.g. {{para|style|font-family: 'Times New Roman', serif;}}
== Examples ==
* {{demo-inline|<nowiki>{{tooltip|conflict of interest|COI as used in Wikipedia policy|dotted=no}}</nowiki>}}
* {{demo-inline|<nowiki>{{tooltip|תוכן נִסתָר|תוכן ברור|dotted=no}}</nowiki>}}
* {{demo-inline|<nowiki>{{tooltip|Sex gap|Difference in life expectancy for female and male}}</nowiki> <!-- from: Caribbean -->}}
* {{demo-inline|<nowiki>{{tooltip|'''$31,152,975'''|Career prize money}}</nowiki> <!-- from: Andre Agassi -->}}
* {{demo-inline|<nowiki>{{tooltip|male|Assigned male at birth}}</nowiki><!-- from: Bakla -->}}
* {{demo-inline|<nowiki>{{tooltip|Cupronickel|75% copper, 25% nickel}}</nowiki> <!-- from: United States cent mintage figures -->}}
* {{demo-inline|<nowiki>{{tooltip|ई|ī|dotted=no}}</nowiki><!-- from: Devanagari-->}}
* {{demo-inline|<nowiki>{{tooltip|''Voyage with a Tail Wind''|simplified Chinese: 顺风相送; traditional Chinese: 順風相送; pinyin: Shùnfēng Xiāngsòng|dotted=no}}</nowiki> <!-- from: 1971 Okinawa Reversion Agreement -->}}
== Template data ==
{{TemplateData header}}
<TemplateData>
{
"description": "A pop-up tooltip displayed on mouse-over.",
"params": {
"1": {
"label": "Term",
"description": "Rendered in-line as normal text",
"type": "string/line",
"required": true
},
"2": {
"label": "Tooltip",
"description": "Shows as a pop-up, mouse-over tooltip",
"type": "string",
"required": true
},
"link": {
"label": "Link",
"description": "set to 'yes' to link the term to the article specified by Term",
"example": "yes",
"type": "boolean",
"default": "no",
"required": false
},
"dotted": {
"label": "Dotted",
"description": "applies the specified CSS directives to the content of parameter 1",
"example": "yes",
"type": "boolean",
"default": "no",
"required": false
},
"style": {
"label": "Style",
"description": "applies the specified CSS directives to the content of parameter 1",
"type": "string",
"required": false
},
"class": {
"label": "Class",
"description": "Adds one or more CSS classes, separated by a blank",
"type": "string",
"required": false
},
"id": {
"label": "ID",
"description": "Adds an HTML id (must be unique in the page)",
"type": "string",
"required": false
}
}
}
</TemplateData>
== Notes ==
* This template is not available in the [[Wikipedia:mobile app|mobile view of Wikipedia]], which lacks the hover feature. As of 2025, [[Help:Mobile access|more English Wikipedia page views occur on mobile than on desktop browsers]].
* [[Screen readers]] often have difficulty with plain hover pop-up text.
== Maintenance categories ==
* {{clc|Pages using tooltip with unknown parameters}}
== See also ==
* {{t|Abbreviation}}
* {{t|Dfn}}
<includeonly>{{Sandbox other||
<!-- Categories go below this line, please; interwikis go to Wikidata, thank you! -->
[[Category:Abbreviation templates| ]]
[[Category:Wikipedia HTML tag-replacing templates]]
[[Category:Semantic markup templates]]
}}</includeonly>
0qssbov42vsn28u3r582le7lfsgja2q
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Encodefirst
10
2621
7912
2026-10-05T22:23:54Z
Saimawnkham
28
Created page with "{{#invoke:MultiReplace|main|1={{{1}}}|2=^:|3=:|4=^;|5=;|6=^*|7=*|8=^#|9=#}}<noinclude> {{Documentation}} </noinclude>"
7912
wikitext
text/x-wiki
{{#invoke:MultiReplace|main|1={{{1}}}|2=^:|3=:|4=^;|5=;|6=^*|7=*|8=^#|9=#}}<noinclude>
{{Documentation}}
</noinclude>
fgsuijq1qbeeru97jz4uaebxs5w3y9x
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Encodefirst/doc
10
2622
7913
2026-10-05T22:24:21Z
Saimawnkham
28
Created page with "{{Documentation subpage}} {{High-use}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> This template replaces the first character of the argument with its [[HTML entity]] if it is one of four wiki markup characters <code>:</code> <code>;</code> <code>*</code> <code>#</code>. This can sometimes fix the issue at [[Help:Template#Problems and workarounds]] where a charact..."
7913
wikitext
text/x-wiki
{{Documentation subpage}}
{{High-use}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
This template replaces the first character of the argument with its [[HTML entity]] if it is one of four wiki markup characters <code>:</code> <code>;</code> <code>*</code> <code>#</code>. This can sometimes fix the issue at [[Help:Template#Problems and workarounds]] where a character may be processed as though it were at the beginning of a line.
== Usage ==
{{Tlx|Encodefirst|<string>}}
== Examples ==
The output looks like the input whether a character is replaced or not.
{{Tlx|Encodefirst|*Lisp}} produces: {{Encodefirst|*Lisp}}
But the output will behave differently from the input in some situations where it is processed. For example, {{tl|Article talk links}} fails as of 2025 if its argument starts with <code>*</code>. Some other templates like {{tl|Article links}} have been modified ([https://en.wikipedia.org/w/index.php?title=Template:Article_links&diff=prev&oldid=1164482475 diff]) to automatically use {{tl|encodefirst}} so the caller doesn't have to do it.
<code><nowiki>{{Article talk links|*Lisp}}</nowiki></code> causes the asterisk to be processed as [[Help:Wiki markup#Lists|list markup]] and produces broken display ([{{fullurl:Special:ExpandTemplates|wpInput=%7B%7BArticle%20talk%20links%7C*Lisp%7D%7D}} test]).
<code><nowiki>{{Article talk links|{{Encodefirst|*Lisp}}}}</nowiki></code> works correctly:
{{Article talk links|{{Encodefirst|*Lisp}}}}
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Text-specific formatting and function templates]]
}}</includeonly>
svp8oh1btzg5zk46uhmfnjviyauyko9
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:H:title
10
2623
7914
2026-10-05T22:24:41Z
Saimawnkham
28
Redirected page to [[ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Tooltip]]
7914
wikitext
text/x-wiki
#REDIRECT [[ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Tooltip]]
n3j7bjnbfjry7j416tgais5stmyh9q0
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Navbar-header
10
2624
7915
2026-10-05T22:25:18Z
Saimawnkham
28
Created page with "<templatestyles src="Navbar-header/styles.css"/><div class="navbar-header" {{#if:{{{fontcolor|}}}|style="color:{{{fontcolor}}};"}}>{{{1}}}<!-- -->{{#invoke:navbar|navbar | 1 = {{{2<noinclude>|Navbar-header</noinclude>}}} | {{#ifeq: {{{plain|}}} |<!--equals:-->1 |<!--then:-->plain |<!--else:-->mini }} = 1 | {{#if: {{{fontcolor|}}} | fontstyle | NULL }} = color:{{{fontcolor}}}; }}<!-- --></div><noinclude> {{documentation}} <!-- Add cats..."
7915
wikitext
text/x-wiki
<templatestyles src="Navbar-header/styles.css"/><div class="navbar-header" {{#if:{{{fontcolor|}}}|style="color:{{{fontcolor}}};"}}>{{{1}}}<!--
-->{{#invoke:navbar|navbar
| 1 = {{{2<noinclude>|Navbar-header</noinclude>}}}
| {{#ifeq: {{{plain|}}}
|<!--equals:-->1
|<!--then:-->plain
|<!--else:-->mini
}} = 1
| {{#if: {{{fontcolor|}}}
| fontstyle | NULL }} = color:{{{fontcolor}}};
}}<!--
--></div><noinclude>
{{documentation}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
sawz1o3sruap1dzfjp3d5m8rozlqfxs
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Navbar-header/styles.css
10
2625
7916
2026-10-05T22:25:46Z
Saimawnkham
28
Created page with "/* {{pp|small=y}} */ .navbar-header { text-align: center; position: relative; white-space: nowrap; } .navbar-header .navbar { position: absolute; right: 0; top: 0; margin: 0 5px; }"
7916
sanitized-css
text/css
/* {{pp|small=y}} */
.navbar-header {
text-align: center;
position: relative;
white-space: nowrap;
}
.navbar-header .navbar {
position: absolute;
right: 0;
top: 0;
margin: 0 5px;
}
nrr75ajmqfdhy5336fwx46f5jitcmny
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Navbar-header/doc
10
2626
7917
2026-10-05T22:26:03Z
Saimawnkham
28
Created page with "{{Documentation subpage}} {{Uses TemplateStyles|Template:Navbar-header/styles.css}} {{used in system|in [[MediaWiki:Abusefilter-warning-predatory]]}} ==Usage== Simply place the following code in the header area of a given [[Wikipedia:Navigation template|template]] to add a centred heading with right justified view/talk/edit link functionality. <blockquote>{{tlxi|Navbar-header|Custom heading|<nowiki>{{subst:PAGENAME}}</nowiki>}}</blockquote> ==Parameters== ===Required=..."
7917
wikitext
text/x-wiki
{{Documentation subpage}}
{{Uses TemplateStyles|Template:Navbar-header/styles.css}}
{{used in system|in [[MediaWiki:Abusefilter-warning-predatory]]}}
==Usage==
Simply place the following code in the header area of a given [[Wikipedia:Navigation template|template]] to add a centred heading with right justified view/talk/edit link functionality.
<blockquote>{{tlxi|Navbar-header|Custom heading|<nowiki>{{subst:PAGENAME}}</nowiki>}}</blockquote>
==Parameters==
===Required===
; {{var|heading}} (first unnamed parameter): Text that appears centered in the titlebar (the top bar).
; {{var|name of template}} (second unnamed parameter): The name of the template, which is needed for the "{{navbar|Navbar-header|plain=1}}" links to work properly on all of the pages where the template is used on. You can enter <code><nowiki>{{subst:PAGENAME}}</nowiki></code> for this value as a shortcut: {{tlc|Navbar-header|{{var|heading}}|<nowiki>{{subst:PAGENAME}}</nowiki>}}
===Optional===
; {{para|plain|1}}: Switches from abbreviated "{{navbar|Navbar-header|mini=1}}" mode to "{{navbar|Navbar-header|plain=1}}", if plain=1 is set.
; {{para|fontcolor}}: Specifies the title text color. Any choice of [[CSS colors]].
==Example==
See {{tl|Article Alerts Navheader}}, for an example.
==See also==
; {{tl|Navbar}}: This template [[Wikipedia:Transclusion|transcludes]] navbar, the source is more customizable.
; {{tl|Navbar-collapsible}}: For use in conjunction with [[Help:Collapsing|collapsible tables]], floats {{navbar|Navbar-header|mini=1}} opposite of the [hide]/[show] feature
Make use of meta-template to reduce code bloat and simplify editing:
{{Navigation templates}}
<includeonly>{{Sandbox other||
<!-- ADD CATEGORIES BELOW THIS LINE -->
[[Category:Internal link templates]]
}}</includeonly>
mpdoi1fh2hskdmp6tcvh1swoce7c3a4
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Navbar-collapsible
10
2627
7918
2026-10-05T22:26:38Z
Saimawnkham
28
Created page with "{{#invoke:navbar|navbar|collapsible=1}}<noinclude> {{documentation}} <!-- Add cats and interwikis to the /doc subpage, not here! --> </noinclude>"
7918
wikitext
text/x-wiki
{{#invoke:navbar|navbar|collapsible=1}}<noinclude>
{{documentation}}
<!-- Add cats and interwikis to the /doc subpage, not here! -->
</noinclude>
e4r99vcw4rjke4n8m49crbdkhwysk1x
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Navbar-collapsible/doc
10
2628
7919
2026-10-05T22:27:08Z
Saimawnkham
28
Created page with "{{Documentation subpage}} {{high-use| 10634 }} {{lua|Module:Navbar}} <!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE --> ==Usage== Simply place the following code in the [[Help:Table/Introduction to tables|header area]] of [[Help:Collapsing|collapsible tables]] to add left justified view/talk/edit link functionality: <syntaxhighlight lang="wikitext">{{Navbar-collapsible| Heading wikitext |{{subst:FULLPAGENAME}}}}</syntaxhighlight> ===Parameters=== ====Mandatory==== ;..."
7919
wikitext
text/x-wiki
{{Documentation subpage}}
{{high-use| 10634 }}
{{lua|Module:Navbar}}
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
==Usage==
Simply place the following code in the [[Help:Table/Introduction to tables|header area]] of [[Help:Collapsing|collapsible tables]] to add left justified view/talk/edit link functionality:
<syntaxhighlight lang="wikitext">{{Navbar-collapsible| Heading wikitext |{{subst:FULLPAGENAME}}}}</syntaxhighlight>
===Parameters===
====Mandatory====
; 1 : (the first unnamed parameter) Text that appears centered in the titlebar (the top bar).
; 2 : (the second unnamed parameter) The name of the template, which is needed for the "{{navbar|Navbar-collapsible|mini=1}}" links to work properly on all of the pages where the template is used on. You can use <code><nowiki>{{subst:FULLPAGENAME}}</nowiki></code> as a shortcut for this value.
====Optional====
; plain : If set to <code>plain=1</code> then {{navbar|Navbar-collapsible|mini=1}} will be expanded to the longer form of {{navbar|Navbar-collapsible|plain=1}}.
; fontcolor : Specifies the title text color and the link color of the {{navbar|Navbar-collapsible|mini=1}}.
==See also==
;{{tl|Navbar}}: This template [[Wikipedia:Transclusion|transcludes]] navbar, the source is more customizable.
;{{tl|Navbar-header}}: Positions {{navbar|Navbar-collapsible|mini=1}} on the right edge of the line, often used in non-collapsible navbox heading.
Make use of meta-template to reduce code bloat and simplify editing:
{{Navigation templates}}
;[[WP:TABLECOLLAPSE]]: Describes use of {{code|1=class="mw-collapsible mw-collapsed"}} &tc.
<includeonly>{{Sandbox other||
[[Category:Internal link templates]]
}}</includeonly>
j0aplbjw1gev9jm2433gc8j6f6j6q76
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:IPA audio link
10
2629
7920
2026-10-05T22:28:51Z
Saimawnkham
28
Created page with " {{Audio|{{{1|}}}||help=no}}<noinclude> {{documentation}} </noinclude>"
7920
wikitext
text/x-wiki
 {{Audio|{{{1|}}}||help=no}}<noinclude>
{{documentation}}
</noinclude>
igny8ptij7w6rb6epgzsg7k8gqbrrog
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:IPA audio link/doc
10
2630
7921
2026-10-05T22:29:14Z
Saimawnkham
28
Created page with "{{Documentation subpage}} {{High-use}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> This template formats the audio link used by [[Template:IPA]] and similar templates at [[:Category:IPA language templates]]. It should not be used directly in articles. {{cot|TemplateData}} <templatedata> { "params": {}, "description": "DO NOT USE THIS TEMPLATE IN ARTICLES." } </templatedata> {{cob}}..."
7921
wikitext
text/x-wiki
{{Documentation subpage}}
{{High-use}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
This template formats the audio link used by [[Template:IPA]] and similar templates at [[:Category:IPA language templates]]. It should not be used directly in articles.
{{cot|TemplateData}}
<templatedata>
{
"params": {},
"description": "DO NOT USE THIS TEMPLATE IN ARTICLES."
}
</templatedata>
{{cob}}
{{IPA templates}}
<includeonly>{{sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:IPA audio templates]]
}}</includeonly>
cjzew7m84700zzxgkg70nxlkzre49t9
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Letter/doc
10
2631
7923
2026-10-05T22:36:19Z
Saimawnkham
28
Created page with "{{See also|Template:Char|Template:Symb|Template:Grapheme|Template:Infobox grapheme}} {{Documentation subpage}} {{Uses TemplateStyles|Template:Letter/styles.css}} {{no documentation}}<!--Needs an explanation that it can be used only in table cells--> == ᥘᥩᥒᥲ ᥓᥬᥳ ᥖᥪᥰ == {| class=wikitable |- |{{letter| l=en | ch1=Q | ch2=q | color=violet}} |{{letter| l=ru | ch1=Б | ch2=б | color=blue}} |<nowiki>{{ letter| l=en | ch1=Q | ch2=q | color=violet }}</nowi..."
7923
wikitext
text/x-wiki
{{See also|Template:Char|Template:Symb|Template:Grapheme|Template:Infobox grapheme}}
{{Documentation subpage}}
{{Uses TemplateStyles|Template:Letter/styles.css}}
{{no documentation}}<!--Needs an explanation that it can be used only in table cells-->
== ᥘᥩᥒᥲ ᥓᥬᥳ ᥖᥪᥰ ==
{| class=wikitable
|-
|{{letter| l=en | ch1=Q | ch2=q | color=violet}}
|{{letter| l=ru | ch1=Б | ch2=б | color=blue}}
|<nowiki>{{ letter| l=en | ch1=Q | ch2=q | color=violet }}</nowiki>{{br}}
<nowiki>{{ letter | l=ru | ch1=Б | ch2=б | color=blue }}</nowiki>
|}
{| class=wikitable
|-
|{{letter|l=ka|tops=ლას|ch=ლ| top=las|s=Geor|color=violet}}
|{{letter|l=en|ch=Թ թ|tops=թո |top=t'o|s=Armn|color=blue}}
|<nowiki>{{ letter | l=ka | tops=ლას | ch=ლ | top=las | s=Geor | color=violet }}</nowiki>{{br}}
<nowiki>{{ letter | l=en | ch=Թ թ | tops=թո |top=t'o |s=Armn | color=blue }}</nowiki>
|}
{|class="wikitable"
|-
|{{letter | l=or | top=5 | ch=୫ | note=pāñca }}
|{{letter| l=or | top=6 | ch=୬ | note=cha'a }}
|<nowiki>{{ letter | l=or | top=5 | ch=୫ | note=pāñca }}</nowiki>{{br}}
<nowiki>{{ letter | l=or | top=6 | ch=୬ | note=cha'a }}</nowiki>
|}
{| class=wikitable
|{{letter|l=jv|s=Arab|ch=اِ|notes=◌ِ + ا}}
|{{letter|l=jv|s=Arab|ch=اُوْ|notes=◌ُ + ا
◌ْ + و + }}
|<nowiki>{{ letter | l=jv | s=Arab | </nowiki>{{script|Arab| اِ }}<nowiki> | notes=</nowiki> {{script|Arab| ◌ِ + ا }} <nowiki> }}</nowiki>
<nowiki>{{ letter | l=jv | s=Arab |</nowiki> {{script|Arab| اُوْ }} <nowiki>| notes= </nowiki>{{script|Arab| ◌ُ + ا
◌ْ + و + }} <nowiki> }}</nowiki>
|}
{| class=wikitable
|- class="letters-wide-right"
|{{letter|color=teal|s=Hano|ch= ᜴}}
|{{letter|iso=-K|color=teal|s=Hano|l=hnn|ch=ᜣ᜴}}
|{{letter|iso=-G|color=teal|s=Hano|l=hnn|ch=ᜤ᜴}}
|}
{| class=wikitable
|-
|{{letter|l=kn|ch1=ಉ|ch2=ು|iso=u|ipa=/u/|color=violet|s=Kann}}
|{{letter|l=te|ch=ఞ|iso=ña|ipa=/ɲa/|color=green |s=Telu}}
|{{letter|l=mni|ch=ꯄꯥ |iso=pā|ipa=/p/|s=Mtei}}
|<nowiki>{{ letter | l=kn | ch1=ಉ | ch2=ು | iso=u | ipa=/u/ | color=violet | s=Kann }}</nowiki>{{br}}
<nowiki>{{ letter | l=te | ch=ఞ | iso=ña | ipa=/ɲa/ | color=green | s=Telu }}</nowiki>{{br}}
<nowiki>{{ letter | l=mni | ch=</nowiki>{{Script|Mtei|ꯄꯥ}}<nowiki> | iso=pā | ipa=/p/ | s=Mtei }}</nowiki>
|}
{| class="wikitable"
|-
|{{letter|l=ne|tops=ब + ◌ि|ch=बि |s=Deva}}
|{{letter|l=ne|tops=ब + ◌ी|ch=बी|s=Deva|note={{noteTag|group=notes2|name=note1|This is a footnote.}}}}
|<nowiki>{{ letter | l=ne | tops=ब + ◌ि | ch=</nowiki>{{Script|Deva|बि}}<nowiki> | s=Deva }}</nowiki>{{br}}
<nowiki>{{ letter | l=ne | tops=ब + ◌ी | ch=</nowiki>{{Script|Deva| बी}}<nowiki> | s=Deva | note={{noteTag|group=notes2|name=note1|This is a footnote.}} }}</nowiki>notes2
|}
{{noteFoot|group=notes2}}
{| class="wikitable"
|+ Basic hiragana characters
|-
! !! ''a'' !! ''i'' !! ''u'' !! ''e'' !! ''o''
|-
!title="No lead consonant"|∅
|{{letter|ch=あ|color=pink}}
|{{letter|ch=い|color=pink}}
|{{letter|ch=う|color=pink}}
|{{letter|ch=え|color=pink}}
|{{letter|ch=お|color=pink}}
|}
{| class=wikitable
|{{letter|color=red|note=red|ch=Α α}}
|{{letter|color=orange|note=orange|ch=Β β}}
|{{letter|color=gold|note=gold|ch=Γ γ}}
|{{letter|color=green|note=green|ch=Δ δ}}
|{{letter|color=teal|note=teal|ch=Ε ε}}
|{{letter|color=blue|note=blue|ch=Ζ ζ}}
|{{letter|color=violet|note=violet|ch=Η η}}
|{{letter|color=pink|note=pink|ch=Θ θ}}
|{{letter|color=black|note=black|ch=Ι ι}}
|}
{| class="wikitable letters-lo"
|{{letter|l=jv|s=Java|color=violet|ch=ꦗ|iso=ja}}
|{{letter|l=jv|s=Java|color=violet|ch=ꦙ|iso=jha}}
|}
== Template Data ==
{{TemplateData header}}
<templatedata>
{
"description": "Formatting template for letters in alphabet and script articles.",
"params": {
"ch": {
"label": "character",
"description": "Character or characters to be formatted.",
"type": "string"
},
"ch1": {
"label": "first character",
"description": "First character. If ch1 and ch2 are used, they will be rendered side-by-side",
"type": "string"
},
"ch2": {
"label": "second character",
"description": "Second character. If ch1= and ch2= are used, they will be rendered side-by-side",
"type": "string"
},
"l": {
"label": "language",
"description": "An ISO 639 or ISO 15924 language code.",
"type": "string",
"required": false
},
"iso": {
"label": "ISO",
"description": "An ISO transcription based on the language code (l) provided.",
"type": "string",
"required": false
},
"s": {
"label": "script",
"description": "A script code",
"type": "string"
},
"tops": {
"label": "script-supported top line",
"description": "Will be formatted using the script code provided.",
"type": "string"
},
"top": {
"label": "top line",
"description": "Top line with no script support.",
"type": "string"
},
"ipa": {
"label": "IPA",
"description": "An IPA pronunciation for the character.",
"type": "string"
},
"note": {
"label": "note",
"description": "A bottom text line-- can be used for plain text notes, rough transcription, formatted footnotes, etc.",
"type": "string"
},
"notes": {
"label": "notes",
"description": "A script-supported bottom text line.",
"type": "string"
},
"color": {
"label": "color",
"description": "color applied to the main character(s)",
"type": "string",
"suggestedvalues": [
"red", "orange", "gold", "green", "teal", "blue", "violet", "pink", "black"
],
"default": "red"
}
},
"paramOrder": [
"ch",
"ch1",
"ch2",
"l",
"s",
"ipa",
"iso",
"tops",
"top",
"note",
"notes",
"color"
]
}
</templatedata>
<includeonly>{{Sandbox other||
<!-- Categories below this line -->
[[Category:Infobox templates]]
[[Category:Writing system templates]]
}}</includeonly>
l2vcusn9eqv9f5je1j0m8o27wxbtdnb
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Engvar
10
2632
7924
2026-10-05T22:37:32Z
Saimawnkham
28
Created page with "{{#invoke:Engvar|variants}}<noinclude> {{documentation}} </noinclude>"
7924
wikitext
text/x-wiki
{{#invoke:Engvar|variants}}<noinclude>
{{documentation}}
</noinclude>
g5v8sq6nrf0ygkkw2fwk6s2k41tr0o1
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Engvar/doc
10
2633
7925
2026-10-05T22:37:58Z
Saimawnkham
28
Created page with "{{Documentation subpage}} {{High-use}} {{Lua|module:Engvar}} This template is used inside other templates. <section begin="ledeMinusLeadSentence" />It allows templates to show '''[[WP:ENGVAR|national varieties of English]]''', when {{para|engvar}} is passed by each article. For example, one template can display "football" for {{para|engvar|en-UK}} articles, and "soccer" for {{para|engvar|en-US}} articles.<section end="ledeMinusLeadSentence" /> ==ᥘᥩᥒᥲ ᥓᥬᥳ..."
7925
wikitext
text/x-wiki
{{Documentation subpage}}
{{High-use}}
{{Lua|module:Engvar}}
This template is used inside other templates. <section begin="ledeMinusLeadSentence" />It allows templates to show '''[[WP:ENGVAR|national varieties of English]]''', when {{para|engvar}} is passed by each article.
For example, one template can display "football" for {{para|engvar|en-UK}} articles, and "soccer" for {{para|engvar|en-US}} articles.<section end="ledeMinusLeadSentence" />
==ᥘᥩᥒᥲ ᥓᥬᥳ ᥖᥪᥰ==
# '''Articles''' specify the English variety parameter for relevant templates like {{tlc|example|engvar{{=}}en-US}}. They do not use {{tlc|engvar}}.
# '''Templates''' use {{tlc|engvar}}. It should not forget to pass-through {{para|engvar|<nowiki>{{{engvar|}}}</nowiki>}}
<syntaxhighlight lang="wikitext">
...
| label3 = {{engvar |defaultWord=Colour |defaultLang=en-UK |en-US=Color |engvar={{{engvar|auto}}} }}
| data3 = {{{color|}}}
| label4 = {{engvar |defaultWord=Football |defaultLang=en-UK |en-US=Soccer |engvar={{{engvar|auto}}} }} team
| data4 = {{{team|}}}
...
</syntaxhighlight>
The {{para|defaultWord}} be shown by default. But if an article asks for an English variety that has a corresponding parameter specified in the template, the value will be shown.
In the example, the template specified a British English word as default whenever no {{para|engvar}} is specified by the article. The word can be changed in an American English article by that article specifying {{para|engvar|en-US}}. The fallback 'auto' value means it will try to determine the language based on templates like {{tl|Use British English}} or {{tl|Use American English}} being present on the page if no engvar is specified.
'''Note''': {{tlc|engvar}} is unrelated to parameter names like {{para|color}} vs. {{para|colour}}. See programming option {{para|data3|<nowiki>{{{color|{{{colour|}}} }}}</nowiki>}}
===Example===
Consider an example template, a fictive {{tlf|infobox personal likes}}. The demo is encoded in {{t|Engvar/doc/infobox demo}}.
====Template code====
{{#tag:syntaxhighlight|{{#invoke:DecodeEncode|decode|s={{msgnw:Template:Engvar/doc/infobox demo}}}}|lang=wikitext}}
====Three articles====
{{demo|<nowiki>{{Engvar/doc/infobox demo
| home country = Wales
| color = Blue
| team = [[FC Kuusysi]]
<!-- |engvar= not set; expect defaults -->
}}</nowiki>|reverse=1}}
{{clear}}
{{demo|<nowiki>{{Engvar/doc/infobox demo
| home country = Alaska
| color = Blue
| team = [[FC Kuusysi]]
| engvar= en-US
}}</nowiki>|reverse=1}}
{{clear}}
{{demo|<nowiki>{{Engvar/doc/infobox demo
| home country = Australia
| color = Blue
| team = [[FC Kuusysi]]
| engvar= Australian
}}</nowiki>|reverse=1}}
===A live example===
Currently, {{tl|infobox element}} has five {{tlf|engvar}} words. [[Phosphorus]] shows {{para|engvar|en-UK}} despite the {{para|engvar|en-US}} default.
==Parameter list==
===Template===
{{#tag:syntaxhighlight|{{module other|{{((}}#invoke:engvar{{!}}variants|{{((}}engvar}}
{{#invoke:DecodeEncode|decode|s={{expand wikitext|1=<nowiki>
| defaultWord =
| defaultLang =
| engvar = {{{engvar|}}}<!-- Pass-through the editor's choice, set to 'auto' to automatically detect -->
| en-XX = <!-- add country code for XX, and the nation language word -->
| en-YY = <!-- add more varieties as might be needed -->
| engvarCat = {{{engvarCat|}}} <!-- '=no' will suppress message category in article page -->
| fallback = <!-- set to 'true' to allow commonwealth languages to fallback to 'en-GB'. False by default unless engvar='auto'. -->
}}</nowiki>}}}}|lang=wikitext}}
===Article===
<syntaxhighlight lang="wikitext">
{{example
| engvar =
| engvarCat =
}}
</syntaxhighlight>
== List of English varieties==
In the ''template'', use the ''exact'' ISO-code as the parameter name like {{para|en-GB|vapour}}. Write {{para|en-US|soccer|green=1}} not {{para|American English|soccer|red=1}}. Needed varieties have articles using the template and words differing from the default.
{{anchor|List of Engvar codes|List of variety languages}}
{| class="wikitable sortable collapsible uncollapsed" style="min-width:50%;"
! English variety<!--All English varieties are part of the single English language-->
! ISO-code
|-
| [[American English]]
| {{pval|en-US}}
|-
| [[Australian English]]
| {{pval|en-AU}}
|-
| [[British English]]
| {{pval|en-GB}}
|-
| [[Canadian English]]
| {{pval|en-CA}}
|-
| [[Hiberno-English]] (Irish English)
| {{pval|en-EI}}
|-
| [[Hong Kong English]]
| {{pval|en-HK}}
|-
| [[Indian English]]
| {{pval|en-IN}}
|-
| [[Jamaican English]]
| {{pval|en-JM}}
|-
| [[Malawian English]]
| {{pval|en-MW}}
|-
| [[New Zealand English]]
| {{pval|en-NZ}}
|-
| [[Nigerian English]]
| {{pval|en-NG}}
|-
| [[Pakistani English]]
| {{pval|en-PK}}
|-
| [[Philippine English]]
| {{pval|en-PH}}
|-
| [[Scottish English]]
| {{pval|en-SCO}}
|-
| [[Singapore English]]
| {{pval|en-SG}}
|-
| [[South African English]]
| {{pval|en-ZA}}
|-
| [[Trinidadian English]]
| {{pval|en-TT}}
|-
| data-sort-value="_Oxford" | British English [[Oxford spelling]]<br/>British (Oxford) English<br/>''[[Oxford English Dictionary]]'' (OED)
| data-sort-value="_Oxford" | {{pval|en-OED}}
|-
| data-sort-value="_IUPAC" | IUPAC spelling
| data-sort-value="_IUPAC" | {{pval|en-IUPAC}}
|}
There is backwards compatibility for leeway in ''articles''. {{para|engvar|en-US}}, {{para|engvar|United States}}, {{para|engvar|US}} can all show the {{para|en-US|football}} variety.
==Maintenance category==
Articles with an invalid {{para|engvar}} will be placed in the hidden maintenance category [[:Category:Articles using an unknown Template:Engvar option]]. Articles listed may need editing.
An article's requested {{para|engvar}} may be unspecified in the template. For example, if an article uses {{tlc|example|engvar{{=}}South African English}} but the template has no {{para|en-ZA}}, then the template will return {{para|defaultWord|default color name}}. The category will not be used.
:When this categorization is not desired for a whole template, set {{para|engvarCat|no}} in the template
:Otherwise pass-through this setting from the article: {{para|engvarCat|<nowiki>{{{engvarCat|yes}}}</nowiki>}}. This allows the editor to switch categorization off per article.
Articles are sorted by {{para|engvarCatSort}} or {{magic word|pagename}} by default. Note that other templates will fill this category. Set this parameter like {{para|engvarCatSort|Personal prefs}} in a template to group its listings under "P".
==Template data==
{{Template data header}}
<templatedata>
{
"params": {
"defaultword": {
"label": "Default spelling",
"type": "string",
"example": "colour",
"suggested": true,
"description": "The default word, usually the word in the English variety most often used"
},
"defaultLang": {
"label": "Default English variety",
"type": "string",
"example": "en-US",
"suggested": true,
"suggestedvalues": [
"en-US",
"en-AU",
"en-GB",
"en-CA",
"en-EI",
"en-HK",
"en-IN",
"en-JM",
"en-MW",
"en-NZ",
"en-NG",
"en-PK",
"en-PH",
"en-SCO",
"en-SG",
"en-ZA",
"en-TT",
"en-OED",
"en-IUPAC"
],
"description": "Adding this helps document your {{engvar}} setting"
},
"engvar": {
"label": "English variety",
"type": "string",
"suggestedvalues": [
"{{{engvar|auto}}}",
"{{{engvar|}}}",
"auto"
],
"required": true,
"description": "English variety to use. Set to 'auto' to try to detect variety based on templates such as {{Use British English}} or {{EngvarB}} being present on the page."
},
"engvarCat": {
"label": "Suppress maintenance category",
"type": "string",
"suggestedvalues": [
"{{{engvarCat|yes}}}",
"no"
],
"default": "yes",
"suggested": true
},
"engvarCatSort": {
"label": "Maintenance category sort key",
"type": "string",
"default": "{{pagename}}"
},
"en-US": {
"label": "American English spelling",
"type": "string",
"example": "color"
},
"en-AU": {
"label": "Australian English spelling",
"type": "string"
},
"en-GB": {
"label": "British English spelling",
"type": "string"
},
"en-CA": {
"label": "Canadian English spelling",
"type": "string"
},
"en-EI": {
"label": "Hiberno-English (Irish-English) spelling",
"type": "string"
},
"en-HK": {
"label": "Hong Kong English spelling",
"type": "string"
},
"en-IN": {
"label": "Indian English spelling",
"type": "string"
},
"en-JM": {
"label": "Jamaican English spelling",
"type": "string"
},
"en-MW": {
"label": "Malawian English spelling",
"type": "string"
},
"en-NZ": {
"label": "New Zealand English spelling",
"type": "string"
},
"en-NG": {
"label": "Nigerian English spelling",
"type": "string"
},
"en-PK": {
"label": "Pakistani English spelling",
"type": "string"
},
"en-PH": {
"label": "Philippine English spelling",
"type": "string"
},
"en-SCO": {
"label": "Scottish English spelling",
"type": "string"
},
"en-SG": {
"label": "Singapore English spelling",
"type": "string"
},
"en-ZA": {
"label": "South African English spelling",
"type": "string"
},
"en-TT": {
"label": "Trinidadian English spelling",
"type": "string"
},
"en-OED": {
"label": "British (Oxford) English spelling",
"type": "string"
},
"en-IUPAC": {
"label": "IUPAC spelling",
"type": "string"
},
"fallback": {
"label": "Fallback",
"description": "Whether Commonwealth English languages should fallback to en-GB if not specified",
"type": "boolean",
"default": "false unless engvar=auto"
}
},
"paramOrder": [
"defaultword",
"defaultLang",
"engvar",
"engvarCat",
"fallback",
"engvarCatSort",
"en-US",
"en-AU",
"en-GB",
"en-CA",
"en-EI",
"en-HK",
"en-IN",
"en-JM",
"en-MW",
"en-NZ",
"en-NG",
"en-PK",
"en-PH",
"en-SCO",
"en-SG",
"en-ZA",
"en-TT",
"en-OED",
"en-IUPAC"
]
}
</templatedata>
==See also==
*[[HELP:ENGVAR]]
*[[:Category:Articles using an unknown Template:Engvar option]]
*[[ISO 3166-1 alpha-2]] -- The 2-letter country code
*{{ml|Engvar|explain|...}} - debugging
<includeonly>{{sandbox other||[[Category:National varieties of English on Wikipedia]]}}</includeonly>
iajfp7796daun4bquk77m3lnxa1gnms
ᥛᥨᥝᥱ ᥓᥧᥰ:Engvar
828
2634
7926
2026-10-05T22:38:12Z
Saimawnkham
28
Created page with "-- This module implements Template:Engvar. -- Template:Engvar is to be build into the template (like an infobox), with default & variant spellings defined. -- That template should also allow parameter '|engvar=' for the editor (article page). -- The module/template Engvar then returns the spelling variant as is set in that article (for example '|engvar=en-GB'). -- The defaultWord is returned, unless the engvar input hits on a defined (en-XX) variant word. local p = {} lo..."
7926
Scribunto
text/plain
-- This module implements Template:Engvar.
-- Template:Engvar is to be build into the template (like an infobox), with default & variant spellings defined.
-- That template should also allow parameter '|engvar=' for the editor (article page).
-- The module/template Engvar then returns the spelling variant as is set in that article (for example '|engvar=en-GB').
-- The defaultWord is returned, unless the engvar input hits on a defined (en-XX) variant word.
local p = {}
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local gsub = string.gsub
local lower = string.lower
local upper = string.upper
function p.variants(frame)
local args = getArgs(frame)
return p._variants(args)
end
local function fallback(args, useLang)
local cwealthLangs = { ['en-OED'] = 1, ['en-IUPAC'] = 1,
['en-AU'] = 1, ['en-CA'] = 1, ['en-EI'] = 1, ['en-HK'] = 1,
['en-IN'] = 1, ['en-JM'] = 1, ['en-NZ'] = 1, ['en-PK'] = 1,
['en-SCO'] = 1, ['en-SG'] = 1, ['en-ZA'] = 1 }
if (useLang == 'en-IUPAC' or useLang == 'en-OED') and (args['en-OED'] or args['en-CA']) then
return args['en-OED'] or args['en-CA']
elseif useLang == 'en-CA' and (args['en-OED'] or args['en-US']) then
return args['en-OED'] or args['en-US']
elseif cwealthLangs[useLang] and args['en-GB'] then
return args['en-GB']
end
return args.defaultWord or ''
end
function p._variants(args)
local returnWord = nil
local auto = false
local defaultWord = args.defaultWord or ''
local engvar = args.engvar
if (lower(engvar or '') == 'auto') then
engvar = require('Module:Engvar/detect').detect()
auto = true
end
if engvar == nil then
-- Nothing to look for; use defaultWord right away
returnWord = defaultWord
elseif args.defaultLang == gsub(lower(engvar), '^en%-(%w%w)$', formatISO) then
-- By the defaultLang, the defaultWord is asked
returnWord = defaultWord
else
returnWord = args[gsub(lower(engvar), '^en%-(%w%w)$', formatISO)]
end
if returnWord == nil then
-- No hit so far. Search by words in the engvar entered, checking the list
local useLang = engvarLang(engvar)
if useLang == nil then
returnWord = defaultWord .. addMaintCat(args)
elseif args[useLang] then
returnWord = args[useLang]
elseif yesno(args.fallback or auto, auto) then --default to fallback if auto, otherwise default to no fallback
returnWord = fallback(args, useLang)
else
returnWord = defaultWord
end
end
return returnWord
end
-- Returns arguments and intermediate result. Plus the template result, in front.
function p.explain(frame)
local args = getArgs(frame)
local ret = {}
local engvar = args.engvar or ''
table.insert(ret, '\n\n: Settings:')
table.insert(ret, 'defaultWord=' .. (args.defaultWord or '') .. '; ')
table.insert(ret, 'defaultLang=' .. (args.defaultLang or '') .. '; ')
table.insert(ret, 'engvarCat=' .. (args.engvarCat or '[default:yes]') .. '; ')
table.insert(ret, 'engvarCatSort=' .. (args.engvarCatSort or ''))
table.insert(ret, 'fallback=' .. (args.fallback or ''))
table.insert(ret, '\n\n: engvar=' .. engvar .. ' [input] ')
if (lower(engvar) == 'auto') then
engvar = require('Module:Engvar/detect').detect() or ''
table.insert(ret, 'engvar=' .. engvar .. ' [detected] ')
end
local useLang = engvarLang(engvar)
table.insert(ret, ' => Engvar code [used]: >' .. (useLang or '') .. '<.')
for k, v in pairs(args) do
if k == 'en-UK' then
table.insert(ret, k .. ' ? better: use "en-GB"; ')
elseif k == 'en-SA' then
table.insert(ret, k .. ' ? misleading; use "en-ZA"; ')
end
if k == 'defaultWord' then
elseif k == 'defaultLang' then
elseif k == 'engvar' then
elseif k == 'engvarcat' then
elseif k == gsub(lower(k), '^en%-(%w%w)$', formatISO) then
table.insert(ret, k .. '=' .. v .. '; ')
else
table.insert(ret, k .. ' [not standard:]=' .. v .. '; ')
end
end
return engvar .. ' => ' .. p._variants(args) .. table.concat(ret, ' ')
end
-- Turn a match into pattern 'en-XX'
function formatISO(country)
return ('en-' .. upper(country) or '')
end
function engvarLang(searchEngvar)
-- Search verbose language identifiers to ISO-format 'en-XX'
-- Assumed: not a blank string '' to search
local match = string.match
local langs = {
us = 'US', usa = 'US',
au = 'AU', aus = 'AU',
gb = 'GB', gbr = 'GB', uk = 'GB',
ca = 'CA', can = 'CA',
ei = 'EI', irl = 'EI',
hk = 'HK', hkg = 'HK',
['in'] = 'IN', ind = 'IN', --'in' is a reserved keyword and needs to be in quotes
jm = 'JM', jam = 'JM',
mw = 'MW', mwi = 'MW',
nz = 'NZ', nzl = 'NZ',
ng = 'NG', nga = 'NG',
pk = 'PK', pak = 'PK',
ph = 'PH', phl = 'PH',
sco = 'SCO',
sg = 'SG', sgp = 'SG',
za = 'ZA', zaf = 'ZA',
tt = 'TT', tto = 'TT',
oed = 'OED'};
searchEngvar = gsub(searchEngvar, '^%s*en%-(.*)', '%1') -- rm any opening 'en-'.
searchEngvar = gsub(lower(searchEngvar), '[%s%(%)%-]', '') -- To lc, remove all: (, ) , ws, hyphen.
--normalize language codes so we don't trigger the maintenence category on valid codes
local useLang = langs[searchEngvar]
if useLang then
return 'en-'..useLang
--Special codes
elseif match(searchEngvar, 'oxford') then
useLang = 'OED' -- 'oxford' to catch before anyting 'british'
elseif match(searchEngvar, 'iupac') then
useLang = 'IUPAC' -- chemistry
-- Very often used
elseif match(searchEngvar, 'british') then
useLang = 'GB'
elseif match(searchEngvar, 'unitedstates')
or match(searchEngvar, 'american') then
useLang = 'US'
elseif match(searchEngvar, 'australia') then
useLang = 'AU'
-- Often used
elseif match(searchEngvar, 'india') then
useLang = 'IN'
elseif match(searchEngvar, 'newzealand') then
useLang = 'NZ'
elseif match(searchEngvar, 'southafrica') then -- not: SA
useLang = 'ZA'
elseif match(searchEngvar, 'canad') then --'canada' or 'canadian'
useLang = 'CA'
elseif match(searchEngvar, 'hiberno')
or match(searchEngvar, 'ireland')
or match(searchEngvar, 'irish') then
useLang = 'EI'
elseif match(searchEngvar, 'hongkong') then
useLang = 'HK'
-- Less often used
elseif match(searchEngvar, 'jamaica') then
useLang = 'JM'
elseif match(searchEngvar, 'malawi') then
useLang = 'MW'
elseif match(searchEngvar, 'nigeria') then
useLang = 'NG'
elseif match(searchEngvar, 'pakistan') then
useLang = 'PK'
elseif match(searchEngvar, 'philippine') then
useLang = 'PH'
elseif match(searchEngvar, 'scotland')
or match(searchEngvar, 'scottish') then
useLang = 'SCO' -- Has no alpha-2 code; not 'scotch'
elseif match(searchEngvar, 'singapore') then
useLang = 'SG'
elseif match(searchEngvar, 'trinidad')
or match(searchEngvar, 'tobago') then
useLang = 'TT'
end
return useLang and 'en-'..useLang
end
function addMaintCat(args)
local catMaintenance
if args.engvarCat ~= 'no' then
local title = mw.title.getCurrentTitle()
if title:inNamespaces(0) then -- 0=main, 10=templ, 828=module
if args.engvarCatSort then
catMaintenance = '|' .. args.engvarCatSort .. ', ' .. title.text
end
catMaintenance = '[[Category:Articles using an unknown Template:Engvar option' .. (catMaintenance or '') .. ']]'
end
end
return catMaintenance or ''
end
return p
agxxpwxi2oy7hm2blyki9sy9gta86gn
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Transliteration/doc
10
2635
7928
2026-10-05T22:43:19Z
Saimawnkham
28
Created page with "{{Documentation subpage}} {{Redirect|Template:Transl|the template for translated text|Template:Translation}} {{High-use}} {{COinS safe|n}} {{Lua|Module:Lang}} {{Template shortcut|tlit|transl|translit|xlit}} {{Language templates}} This template is used to mark up text that has been '''[[transliteration|transliterated]] or [[romanisation|romanised]]''' from a non-Latin alphabet script to Latin alphabet script. This template should only be used for the transliterations of..."
7928
wikitext
text/x-wiki
{{Documentation subpage}}
{{Redirect|Template:Transl|the template for translated text|Template:Translation}}
{{High-use}}
{{COinS safe|n}}
{{Lua|Module:Lang}}
{{Template shortcut|tlit|transl|translit|xlit}}
{{Language templates}}
This template is used to mark up text that has been '''[[transliteration|transliterated]] or [[romanisation|romanised]]''' from a non-Latin alphabet script to Latin alphabet script.
This template should only be used for the transliterations of non-Latin scripts; for non-English language text displayed in its native script (such as Greek, Cyrillic and Arabic), {{tl|lang}} should be used, which tags non-transliterated text (written in original script). Transliteration is often used alongside that template, to allow non-readers of the script to interpret the text.
This template adds a [[tooltip]] label naming the transliteration scheme, and renders text in [[italics]] by default.
It also displays text in an appropriate font; romanisations marked up in {{tl|lang}} may display in fonts designed for that language's native text, whereas the transliteration template displays text in the same font as the rest of the article.
Some languages, such as [[Chinese language|Chinese]], have more than one style of transliteration (such as [[Wade–Giles]], [[pinyin]], etc). This template can be used for these different transliteration schemes, though Wikipedia has a number of [[:Category:Wikipedia multilingual support templates|language-specific templates]], some of which support more than one transliteration styles in their parameters, that may be better suited for marking up transliterations.
==Example==
The following code tags a Ukrainian name and its transliteration according to the Ukrainian National scheme.
{{demo|<nowiki>{{lang|uk|Ярослав Рудницький}} ({{transliteration|uk|ukrainian|Yaroslav Rudnytskyi}})</nowiki>|sep='''Renders as:'''}}
==Rationale==
This template is intended to unify all "transliteration" templates, such as {{tl|IAST}} and {{tl|ISOtranslit}}. These templates are still usable, but they just transclude or are redirected back to <nowiki>{{transl}}</nowiki>. For example, (e.g. <code><nowiki>{{IAST|saṃskṛtam}}</nowiki></code> is a shortcut for <code><nowiki>{{transliteration|sa|IAST|saṃskṛtam}}</nowiki></code>. Other transliteration templates that once existed, such as {{tl|ArabDIN}}, are now handled natively by this template: <code><nowiki>{{transliteration|ar|DIN|...}}</nowiki></code>).
This template is kept separate from {{tl|lang}} to address formatting issues (via CSS classes) and identification of transliteration schemes used. Ultimately, if these concerns are smartly addressed in the CSS file and/or in {{tl|lang}}, using <code><nowiki>{{transliteration|xx|...}}</nowiki></code> should be equivalent to using <code><nowiki>{{lang|xx-Latn|...}}</nowiki></code>.
==Usage==
There are two ways of using this template: with or without specifying the [[romanization|transliteration scheme]] used:
*two parameters, with [[ISO 639]] language code: <code><nowiki>{{transliteration|ar|al-Khwarizmi}}</nowiki></code> means that "al-Khwarizmi" is a transliteration from the Arabic in a loose or unspecified scheme.
*two parameters, with [[ISO 15924]] script code: <code><nowiki>{{transliteration|Ogam|MAQI}}</nowiki></code> means that "MAQI" transliterates an [[Ogham]] inscription without specifying the language. Potentially useful when writing systems themselves are under discussion, e.g. <code><nowiki>{{transliteration|Cyrl|š}}</nowiki></code>, not <code><nowiki>{{transliteration|cu|š}}</nowiki></code> or <code><nowiki>{{transliteration|ru|š}}</nowiki></code> when discussing the letter {{script|Cyrl|[[Ш]]}}.
*three parameters, with [[ISO 639]] language code: <code><nowiki>{{transliteration|ar|DIN|al-Ḫawārizmī}} / {{transliteration|ar|ALA|al-Khawārizmī}}</nowiki></code> the second parameter specifies the scheme used (DIN vs. ALA).
*three parameters, with [[ISO 15924]] script code: <code><nowiki>{{transliteration|Arab|DIN|Ḫ}} vs {{transliteration|Arab|ALA|Kh}}</nowiki></code> for {{script|Arab|[[ﺥ]]}}.
There is no need to add italic markup (<code><nowiki>''</nowiki></code>) to transliteration templates. Proper nouns – the names of people and places – are typically not italicized, and as such should use {{para|italic|no}} to suppress the default italicization of Latin scripts.
'''Note''': the language code is ISO 639 or IETF private-use tag (see [[Template:Lang#Private-use language tags]]); other forms of [[IETF BCP 47 language tag]]s are <em>not</em> supported.
===Transliteration scheme codes===
Codes for supported transliteration schemes can be seen by viewing the source of [[:Module:Lang/data]] – the {{code|translit_title_table}} data-structure lists for each such code the corresponding transliteration schemes. These may vary by language – e.g. code "ISO" means scheme [[ISO 233]] for Arabic but [[ISO 11940]] for Thai.
===Examples===
Inputting:
*<syntaxhighlight lang="wikitext" inline>{{transliteration|ar|[[al-Khwarizmi]]}} / [[DIN 31635]]: {{transliteration|ar|DIN|al-Ḫawārizmī}} / [[ISO 233]]: {{transliteration|ar|ISO|al-H̱awārizmī}} / [[ALA-LC Romanization|ALA]]: {{transliteration|ar|ALA|al-Khawārizmī}}</syntaxhighlight>
*<syntaxhighlight lang="wikitext" inline>[[Royal Thai General System of Transcription|RTGS]]: {{transliteration|th|phasa thai}} / [[ISO 11940]]: {{transliteration|th|ISO|p̣hās̄ʹāthịy}}</syntaxhighlight>
*<syntaxhighlight lang="wikitext" inline>{{cuneiform|[[Sumerian language|𒅴𒂠]]}} {{transliteration|sux|EME.GIR<sub>15</sub>}} / {{cuneiform|6|[[Hittite language|𒉈𒅆𒇷]]}} {{transliteration|hit|ne-ši-li}}</syntaxhighlight>
Results in:
*{{transliteration|ar|[[al-Khwarizmi]]}} / [[DIN 31635]]: {{transliteration|ar|DIN|al-Ḫawārizmī}} / [[ISO 233]]: {{transliteration|ar|ISO|al-H̱awārizmī}} / [[ALA-LC Romanization|ALA]]: {{transliteration|ar|ALA|al-Khawārizmī}}
* [[Royal Thai General System of Transcription|RTGS]]: {{transliteration|th|phasa thai}} / [[ISO 11940]]: {{transliteration|th|ISO|p̣hās̄ʹāthịy}}
*{{cuneiform|[[Sumerian language|𒅴𒂠]]}} {{transliteration|sux|EME.GIR<sub>15</sub>}} / {{cuneiform|6|[[Hittite language|𒉈𒅆𒇷]]}} {{transliteration|hit|ne-ši-li}}
'''ISO''':
*{{lang|ru|[[Russian language|русский]]}} <syntaxhighlight lang="wikitext" inline>{{transliteration|ru|ISO|russkij}}</syntaxhighlight>: {{transliteration|ru|ISO|russkij}}
*{{lang|ab|[[Abkhaz language|Аҧсуа]]}} <syntaxhighlight lang="wikitext" inline>{{transliteration|ab|ISO|aṗsua}}</syntaxhighlight>: {{transliteration|ab|ISO|aṗsua}}
*{{lang|ar|[[Arabic| عربي ]]}} <syntaxhighlight lang="wikitext" inline>{{transliteration|ar|ISO|ʿarabī}}</syntaxhighlight>: {{transliteration|ar|ISO|ʿarabī}}
*: ISO has huge issues transliterating {{transliteration|ar|alif}}, so it's better to use the Library of Congress transliteration, the [[DIN 31635|German Institute for Standardization]] or [[Hans Wehr transliteration]]; see [[Arabic transliteration]] and [[MOS:APOSTROPHE]]
*{{lang|ta|[[Tamil language|தமிழ் ]]}} <syntaxhighlight lang="wikitext" inline>{{transliteration|ta|ISO|tamiḻ}}</syntaxhighlight>: {{transliteration|ta|ISO|tamiḻ}}
*{{lang|bn|[[Bengali language|বাংলা ]]}} <syntaxhighlight lang="wikitext" inline>{{transliteration|bn|ISO|baṅla}}</syntaxhighlight>: {{transliteration|bn|ISO|baṅla}}
*{{lang|el|[[Greek language|ελληνικά ]]}} <syntaxhighlight lang="wikitext" inline>{{transliteration|el|ISO|ellēniká}}</syntaxhighlight>: {{transliteration|el|ISO|ellēniká}}
*{{lang|ka|[[Georgian language|ქართული]]}} <syntaxhighlight lang="wikitext" inline>{{transliteration|ka|ISO|k'art'uli}}</syntaxhighlight>: {{transliteration|ka|ISO|k'art'uli}}
*{{lang|zh|[[Pinyin|漢語拼音]]}} <syntaxhighlight lang="wikitext" inline>{{transliteration|zh|ISO|hànyǔ pīnyīn}}</syntaxhighlight>: {{transliteration|zh|ISO|hànyǔ pīnyīn}}
*{{lang|th|[[Thai language|ภาษาไทย]]}} <syntaxhighlight lang="wikitext" inline>{{transliteration|th|ISO|p̣hās̄ʹāthịy}}</syntaxhighlight>: {{transliteration|th|ISO|p̣hās̄ʹāthịy}}
==CSS==
In order to apply a style to all text marked as transliteration, use a CSS selector that chooses all text with <code>transliteration</code> or <code>romanization</code> in the [[HTML attribute#title|title attribute]] (tooltip). For instance, if you add the following to [[Special:MyPage/common.css|your common.css]], all transliterations will be colored {{color|teal}}:
<syntaxhighlight lang="CSS">
[title~="transliteration"],
[title~="romanization"] {
color: teal;
}
</syntaxhighlight>
==Tracking category==
* {{Category link with count|Transliteration template errors}}
==TemplateData==
{{TemplateData header}}
<templatedata>
{
"description": "Marks a text span transliterated from a particular language or writing system, and, optionally, according to a specific transliteration system.",
"params": {
"1": {
"label": "Language or script code",
"description": "ISO 639 language code, possibly with an ISO 15924 script code",
"required": true,
"type": "line",
"example": "hi (Hindi), sr-Cyrl (Serbian written in the Cyrillic script), und-Hani (an undetermined language written with Chinese characters), mis (an unknown language)"
},
"2": {
"label": "Text, OR transliteration scheme",
"description": "Latin-alphabet transliterated text, or, optionally, transliteration scheme (e.g., bgn/pcgn) then 3rd parameter will be text",
"type": "string",
"required": true
},
"3": {
"label": "Text",
"description": "Latin-alphabet transliterated text (required if a transliteration scheme is entered above)",
"required": false,
"suggested": true,
"type": "string"
},
"italics": {
"aliases": [
"i",
"italic"
],
"label": "Italics",
"description": "Allows for control over whether transliterated text is italicized. It is useful to disable italics in cases like proper names.",
"type": "string",
"suggestedvalues": [
"yes",
"no",
"invert",
"unset",
"inherit"
],
"default": "inherit"
}
},
"paramOrder": [
"1",
"2",
"3",
"italics"
]
}
</templatedata>
==See also==
* {{tl|lang}}
* {{tl|ISO 639 name}}
* {{tl|langx}}, which has a {{Para|translit}} parameter
* {{tl|script}}
* {{tl|translation}}
* [[Romanization]]
* [[List of ISO transliterations]]
{{ISO 15924 script codes and related Unicode data|state=collapsed}}
<includeonly>{{Sandbox other||
[[Category:Wikipedia multilingual support templates]]
[[Category:Templates that add a tracking category]]
}}</includeonly>
rul61xf45defivgxt16oek878snspn5
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Unicode chart Ahom
10
2636
7929
2026-10-05T22:44:49Z
Saimawnkham
28
Created page with "{| class="wikitable nounderlines" style="border-collapse:collapse;background:var(--background-color-base,#fff);color:inherit;font-size:large;text-align:center" | colspan="17" style="background:var(--background-color-neutral-subtle,#f8f9fa);color:inherit;font-size:small" | '''[[Ahom (Unicode block)|Ahom]]'''{{ref label|U11700_as_of_Unicode_version|1}}{{ref label|U11700_grey|2}}<br />[https://www.unicode.org/charts/PDF/U11700.pdf Official Unicode Consortium code chart] (PD..."
7929
wikitext
text/x-wiki
{| class="wikitable nounderlines" style="border-collapse:collapse;background:var(--background-color-base,#fff);color:inherit;font-size:large;text-align:center"
| colspan="17" style="background:var(--background-color-neutral-subtle,#f8f9fa);color:inherit;font-size:small" | '''[[Ahom (Unicode block)|Ahom]]'''{{ref label|U11700_as_of_Unicode_version|1}}{{ref label|U11700_grey|2}}<br />[https://www.unicode.org/charts/PDF/U11700.pdf Official Unicode Consortium code chart] (PDF)
|- style="background:var(--background-color-neutral-subtle,#f8f9fa);color:inherit;font-size:small"
| style="width:45pt" | || style="width:20pt" | 0 || style="width:20pt" | 1 || style="width:20pt" | 2 || style="width:20pt" | 3 || style="width:20pt" | 4 || style="width:20pt" | 5 || style="width:20pt" | 6 || style="width:20pt" | 7 || style="width:20pt" | 8 || style="width:20pt" | 9 || style="width:20pt" | A || style="width:20pt" | B || style="width:20pt" | C || style="width:20pt" | D || style="width:20pt" | E || style="width:20pt" | F
|-
| style="background:var(--background-color-neutral-subtle,#f8f9fa);color:inherit;font-size:small" | U+1170x
| title="U+11700: AHOM LETTER KA" | {{Script|Ahom|𑜀}}
| title="U+11701: AHOM LETTER KHA" | {{Script|Ahom|𑜁}}
| title="U+11702: AHOM LETTER NGA" | {{Script|Ahom|𑜂}}
| title="U+11703: AHOM LETTER NA" | {{Script|Ahom|𑜃}}
| title="U+11704: AHOM LETTER TA" | {{Script|Ahom|𑜄}}
| title="U+11705: AHOM LETTER ALTERNATE TA" | {{Script|Ahom|𑜅}}
| title="U+11706: AHOM LETTER PA" | {{Script|Ahom|𑜆}}
| title="U+11707: AHOM LETTER PHA" | {{Script|Ahom|𑜇}}
| title="U+11708: AHOM LETTER BA" | {{Script|Ahom|𑜈}}
| title="U+11709: AHOM LETTER MA" | {{Script|Ahom|𑜉}}
| title="U+1170A: AHOM LETTER JA" | {{Script|Ahom|𑜊}}
| title="U+1170B: AHOM LETTER CHA" | {{Script|Ahom|𑜋}}
| title="U+1170C: AHOM LETTER THA" | {{Script|Ahom|𑜌}}
| title="U+1170D: AHOM LETTER RA" | {{Script|Ahom|𑜍}}
| title="U+1170E: AHOM LETTER LA" | {{Script|Ahom|𑜎}}
| title="U+1170F: AHOM LETTER SA" | {{Script|Ahom|𑜏}}
|-
| style="background:var(--background-color-neutral-subtle,#f8f9fa);color:inherit;font-size:small" | U+1171x
| title="U+11710: AHOM LETTER NYA" | {{Script|Ahom|𑜐}}
| title="U+11711: AHOM LETTER HA" | {{Script|Ahom|𑜑}}
| title="U+11712: AHOM LETTER A" | {{Script|Ahom|𑜒}}
| title="U+11713: AHOM LETTER DA" | {{Script|Ahom|𑜓}}
| title="U+11714: AHOM LETTER DHA" | {{Script|Ahom|𑜔}}
| title="U+11715: AHOM LETTER GA" | {{Script|Ahom|𑜕}}
| title="U+11716: AHOM LETTER ALTERNATE GA" | {{Script|Ahom|𑜖}}
| title="U+11717: AHOM LETTER GHA" | {{Script|Ahom|𑜗}}
| title="U+11718: AHOM LETTER BHA" | {{Script|Ahom|𑜘}}
| title="U+11719: AHOM LETTER JHA" | {{Script|Ahom|𑜙}}
| title="U+1171A: AHOM LETTER ALTERNATE BA" | {{Script|Ahom|𑜚}}
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="U+1171D: AHOM CONSONANT SIGN MEDIAL LA" | {{Script|Ahom|𑜝}}
| title="U+1171E: AHOM CONSONANT SIGN MEDIAL RA" | {{Script|Ahom|𑜞}}
| title="U+1171F: AHOM CONSONANT SIGN MEDIAL LIGATING RA" | {{Script|Ahom|𑜟}}
|-
| style="background:var(--background-color-neutral-subtle,#f8f9fa);color:inherit;font-size:small" | U+1172x
| title="U+11720: AHOM VOWEL SIGN A" | {{Script|Ahom|𑜠}}
| title="U+11721: AHOM VOWEL SIGN AA" | {{Script|Ahom|𑜡}}
| title="U+11722: AHOM VOWEL SIGN I" | {{Script|Ahom|𑜢}}
| title="U+11723: AHOM VOWEL SIGN II" | {{Script|Ahom|𑜣}}
| title="U+11724: AHOM VOWEL SIGN U" | {{Script|Ahom|𑜤}}
| title="U+11725: AHOM VOWEL SIGN UU" | {{Script|Ahom|𑜥}}
| title="U+11726: AHOM VOWEL SIGN E" | {{Script|Ahom|𑜦}}
| title="U+11727: AHOM VOWEL SIGN AW" | {{Script|Ahom|𑜧}}
| title="U+11728: AHOM VOWEL SIGN O" | {{Script|Ahom|𑜨}}
| title="U+11729: AHOM VOWEL SIGN AI" | {{Script|Ahom|𑜩}}
| title="U+1172A: AHOM VOWEL SIGN AM" | {{Script|Ahom|𑜪}}
| title="U+1172B: AHOM SIGN KILLER" | {{Script|Ahom|𑜫}}
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
|-
| style="background:var(--background-color-neutral-subtle,#f8f9fa);color:inherit;font-size:small" | U+1173x
| title="U+11730: AHOM DIGIT ZERO" | {{Script|Ahom|𑜰}}
| title="U+11731: AHOM DIGIT ONE" | {{Script|Ahom|𑜱}}
| title="U+11732: AHOM DIGIT TWO" | {{Script|Ahom|𑜲}}
| title="U+11733: AHOM DIGIT THREE" | {{Script|Ahom|𑜳}}
| title="U+11734: AHOM DIGIT FOUR" | {{Script|Ahom|𑜴}}
| title="U+11735: AHOM DIGIT FIVE" | {{Script|Ahom|𑜵}}
| title="U+11736: AHOM DIGIT SIX" | {{Script|Ahom|𑜶}}
| title="U+11737: AHOM DIGIT SEVEN" | {{Script|Ahom|𑜷}}
| title="U+11738: AHOM DIGIT EIGHT" | {{Script|Ahom|𑜸}}
| title="U+11739: AHOM DIGIT NINE" | {{Script|Ahom|𑜹}}
| title="U+1173A: AHOM NUMBER TEN" | {{Script|Ahom|𑜺}}
| title="U+1173B: AHOM NUMBER TWENTY" | {{Script|Ahom|𑜻}}
| title="U+1173C: AHOM SIGN SMALL SECTION" | {{Script|Ahom|𑜼}}
| title="U+1173D: AHOM SIGN SECTION" | {{Script|Ahom|𑜽}}
| title="U+1173E: AHOM SIGN RULAI" | {{Script|Ahom|𑜾}}
| title="U+1173F: AHOM SYMBOL VI" | {{Script|Ahom|𑜿}}
|-
| style="background:var(--background-color-neutral-subtle,#f8f9fa);color:inherit;font-size:small" | U+1174x
| title="U+11740: AHOM LETTER CA" | {{Script|Ahom|𑝀}}
| title="U+11741: AHOM LETTER TTA" | {{Script|Ahom|𑝁}}
| title="U+11742: AHOM LETTER TTHA" | {{Script|Ahom|𑝂}}
| title="U+11743: AHOM LETTER DDA" | {{Script|Ahom|𑝃}}
| title="U+11744: AHOM LETTER DDHA" | {{Script|Ahom|𑝄}}
| title="U+11745: AHOM LETTER NNA" | {{Script|Ahom|𑝅}}
| title="U+11746: AHOM LETTER LLA" | {{Script|Ahom|𑝆}}
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
| title="Reserved" style="background-color:var(--background-color-disabled,#c8ccd1);color:inherit;" |
|-
| colspan="17" style="background:var(--background-color-neutral-subtle,#f8f9fa);color:inherit;font-size:small;text-align:left" | '''Notes'''
:1.{{note|U11700_as_of_Unicode_version}}{{Unicode version|prefix=Asof|version=18.0}}
:2.{{note|U11700_grey}}Grey areas indicate non-assigned code points
|}<noinclude>
{{documentation|template:Unicode chart/block documentation}}
</noinclude>
si1io7j5iqvvm5u4z6epb4h735xcftr
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Translation
10
2637
7931
2026-10-05T22:54:27Z
Saimawnkham
28
Created page with "{{#if:{{{sortable|}}} |<span style="display:none;">{{{1|}}}</span> }}{{#if:{{{i|}}} |<nowiki/>'' }}{{#switch:{{{literal|}}} |no|off = transl. |yes|on = {{Abbr|lit. transl.|literal translation}} |abbr |#default = {{Abbr|transl.|translation}} }}{{#if:{{{i|}}} |''<nowiki/> }}{{#if:{{{1|}}} |<span> {{{1}}}</span> }}{{#if:{{{2|}}} | – transl.<span> {{{2}}}</span> }}<noinclude> {{Documentation}} </noinclude>"
7931
wikitext
text/x-wiki
{{#if:{{{sortable|}}}
|<span style="display:none;">{{{1|}}}</span>
}}{{#if:{{{i|}}}
|<nowiki/>''
}}{{#switch:{{{literal|}}}
|no|off = transl.
|yes|on = {{Abbr|lit. transl.|literal translation}}
|abbr
|#default = {{Abbr|transl.|translation}}
}}{{#if:{{{i|}}}
|''<nowiki/>
}}{{#if:{{{1|}}}
|<span> {{{1}}}</span>
}}{{#if:{{{2|}}}
| – transl.<span> {{{2}}}</span>
}}<noinclude>
{{Documentation}}
</noinclude>
pbxohnvgjjwvrwz66c8byp3134gwtf5
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Translation/doc
10
2638
7932
2026-10-05T22:54:55Z
Saimawnkham
28
Created page with "{{For|the article maintenance tag|Template:Translate}} {{Documentation subpage}} {{Template shortcut|tr|xlat}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> {{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}} Indicate that a given span of text is a translation of the preceding text. == Usage == * {{tlx|translation|_show_result=yes}} * {{tlx|translation|literal{{=}}yes|_show_result=yes}} *..."
7932
wikitext
text/x-wiki
{{For|the article maintenance tag|Template:Translate}}
{{Documentation subpage}}
{{Template shortcut|tr|xlat}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use}}}}
Indicate that a given span of text is a translation of the preceding text.
== Usage ==
* {{tlx|translation|_show_result=yes}}
* {{tlx|translation|literal{{=}}yes|_show_result=yes}}
* {{tlx|translation|i{{=}}yes|_show_result=yes}}
* {{tlx|translation|a|_show_result=yes}}
* {{tlx|translation|a|b|_show_result=yes}}
== Spacing demonstration ==
{{clarify|reason=What's the purpose of this section? Why would you want to not use spaces, as in these examples?|date=August 2025}}
* <code><nowiki>a{{translation}}bcd</nowiki></code> → a{{translation}}bcd
* <code><nowiki>a{{translation|i=yes}}bcd</nowiki></code> → a{{translation|i=yes}}bcd
* <code><nowiki>a{{translation|b}}cd</nowiki></code> → a{{translation|b}}cd
* <code><nowiki>a{{translation|b|i=yes}}cd</nowiki></code> → a{{translation|b|i=yes}}cd
* <code><nowiki>a{{translation|b|c}}d</nowiki></code> → a{{translation|b|c}}d
* <code><nowiki>a{{translation|b|c|i=yes}}d</nowiki></code> → a{{translation|b|c|i=yes}}d
== TemplateData ==
{{TemplateData header}}
<templatedata>
{
"params": {
"1": {
"label": "meaning",
"example": "'not is'",
"type": "string",
"required": true
},
"2": {
"label": "second meaning",
"type": "string"
},
"sortable": {
"type": "string"
},
"i": {
"label": "italic",
"type": "string"
},
"literal": {
"label": "literal",
"type": "string"
}
},
"description": "Indicate that a given span of text is a translation of the preceding text. "
}
</templatedata>
== See also ==
* {{tlx|literal translation}}
<includeonly>{{Sandbox other||
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Wikipedia formatting templates]]
[[Category:Translation templates]]
}}</includeonly>
maxikbtdrxf294ked1fhu1k99pxx9vb
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Tr
10
2639
7933
2026-10-05T22:55:12Z
Saimawnkham
28
Redirected page to [[ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Translation]]
7933
wikitext
text/x-wiki
#REDIRECT [[ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Translation]]
i6c3hmdyhanmyfnthfpr1825ujmrlkz
ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Xlat
10
2640
7934
2026-10-05T22:55:16Z
Saimawnkham
28
Redirected page to [[ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Translation]]
7934
wikitext
text/x-wiki
#REDIRECT [[ᥗᥦᥛᥰ ᥙᥣ ᥘᥥᥐᥳ:Translation]]
i6c3hmdyhanmyfnthfpr1825ujmrlkz